! / 1352506117 0 0 0 2000 ` ||||||||````````_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetBuiltinsCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetDebuggerCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE17GetRawScriptsSizeEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE19SetRawScriptsSourceENS0_6VectorIKcEE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetScriptsSourceEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE8GetIndexEPKc_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE13GetScriptNameEi_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE18GetRawScriptSourceEi_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetBuiltinsCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetDebuggerCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE17GetRawScriptsSizeEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE19SetRawScriptsSourceENS0_6VectorIKcEE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetScriptsSourceEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE8GetIndexEPKc_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE13GetScriptNameEi_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE18GetRawScriptSourceEi_ZN2v88internal8Snapshot5data_E_ZN2v88internal8Snapshot9raw_data_E_ZN2v88internal8Snapshot5size_E_ZN2v88internal8Snapshot9raw_size_E_ZN2v88internal8Snapshot13context_data_E_ZN2v88internal8Snapshot17context_raw_data_E_ZN2v88internal8Snapshot13context_size_E_ZN2v88internal8Snapshot17context_raw_size_E_ZN2v88internal8Snapshot15new_space_used_E_ZN2v88internal8Snapshot19pointer_space_used_E_ZN2v88internal8Snapshot16data_space_used_E_ZN2v88internal8Snapshot16code_space_used_E_ZN2v88internal8Snapshot15map_space_used_E_ZN2v88internal8Snapshot16cell_space_used_E_ZN2v88internal8Snapshot17large_space_used_E// 44 ` experimental-libraries.o/ snapshot-empty.o/ libraries.o/ 1352506116 1001 1001 100644 241832 ` ELF 4(ŜD$Ŝdebugmirrorliveeditruntimev8nativesarraystringurimathmessagesapinativesdatejsonregexpnative debug.jsnative mirror.jsnative liveedit.jsnative runtime.jsnative v8natives.jsnative array.jsnative string.jsnative uri.jsnative math.jsnative messages.jsnative apinatives.jsnative date.jsnative json.jsnative regexp.jsWVS\$18u[^_ñ8t 8tƱ8t 8t(8t.8V58898 > 8 G 8R 8W 8\(Ƀ|t$t$ $cstttht\ tPtD t8 t, #t 2t At R0ɍv؋t$ʋ$L$ $t$u#$t$Ít&ft&  t&  1҃ RifVt&Չ$t$aá)(&{;$t$ál)%N?E-;^K{Bb&giS var $Object=global.Object; var $Array=global.Array; var $String=global.String; var $Number=global.Number; var $Function=global.Function; var $Boolean=global.Boolean; var $NaN=%GetRootNaN(); var builtins=this; function EQUALS(a){ if((typeof(this)==='string')&&(typeof(a)==='string'))return %StringEquals(this,a); var b=this; while(true){ if((typeof(b)==='number')){ while(true){ if((typeof(a)==='number'))return %NumberEquals(b,a); if((a==null))return 1; if(!(%_IsSpecObject(a))){ return %NumberEquals(b,%ToNumber(a)); } a=%ToPrimitive(a,0); } }else if((typeof(b)==='string')){ while(true){ if((typeof(a)==='string'))return %StringEquals(b,a); if((typeof(a)==='number'))return %NumberEquals(%ToNumber(b),a); if((typeof(a)==='boolean'))return %NumberEquals(%ToNumber(b),%ToNumber(a)); if((a==null))return 1; a=%ToPrimitive(a,0); } }else if((typeof(b)==='boolean')){ if((typeof(a)==='boolean'))return %_ObjectEquals(b,a)?0:1; if((a==null))return 1; if((typeof(a)==='number'))return %NumberEquals(%ToNumber(b),a); if((typeof(a)==='string'))return %NumberEquals(%ToNumber(b),%ToNumber(a)); b=%ToNumber(b); a=%ToPrimitive(a,0); }else if((b==null)){ return(a==null)?0:1; }else{ if((%_IsSpecObject(a))){ return %_ObjectEquals(b,a)?0:1; } if((a==null))return 1; if((typeof(a)==='boolean'))a=%ToNumber(a); b=%ToPrimitive(b,0); } } } function STRICT_EQUALS(a){ if((typeof(this)==='string')){ if(!(typeof(a)==='string'))return 1; return %StringEquals(this,a); } if((typeof(this)==='number')){ if(!(typeof(a)==='number'))return 1; return %NumberEquals(this,a); } return %_ObjectEquals(this,a)?0:1; } function COMPARE(a,b){ var c; var d; if((typeof(this)==='string')){ if((typeof(a)==='string'))return %_StringCompare(this,a); if((typeof(a)==='undefined'))return b; c=this; }else if((typeof(this)==='number')){ if((typeof(a)==='number'))return %NumberCompare(this,a,b); if((typeof(a)==='undefined'))return b; c=this; }else if((typeof(this)==='undefined')){ if(!(typeof(a)==='undefined')){ %ToPrimitive(a,1); } return b; }else if((typeof(a)==='undefined')){ %ToPrimitive(this,1); return b; }else{ c=%ToPrimitive(this,1); } d=%ToPrimitive(a,1); if((typeof(c)==='string')&&(typeof(d)==='string')){ return %_StringCompare(c,d); }else{ var e=%ToNumber(c); var f=%ToNumber(d); if((!%_IsSmi(%IS_VAR(e))&&!(e==e))||(!%_IsSmi(%IS_VAR(f))&&!(f==f)))return b; return %NumberCompare(e,f,b); } } function ADD(a){ if((typeof(this)==='number')&&(typeof(a)==='number'))return %NumberAdd(this,a); if((typeof(this)==='string')&&(typeof(a)==='string'))return %_StringAdd(this,a); var b=%ToPrimitive(this,0); var c=%ToPrimitive(a,0); if((typeof(b)==='string')){ return %_StringAdd(b,%ToString(c)); }else if((typeof(c)==='string')){ return %_StringAdd(%NonStringToString(b),c); }else{ return %NumberAdd(%ToNumber(b),%ToNumber(c)); } } function STRING_ADD_LEFT(a){ if(!(typeof(a)==='string')){ if((%_ClassOf(a)==='String')&&%_IsStringWrapperSafeForDefaultValueOf(a)){ a=%_ValueOf(a); }else{ a=(typeof(a)==='number') ?%_NumberToString(a) :%ToString(%ToPrimitive(a,0)); } } return %_StringAdd(this,a); } function STRING_ADD_RIGHT(a){ var b=this; if(!(typeof(b)==='string')){ if((%_ClassOf(b)==='String')&&%_IsStringWrapperSafeForDefaultValueOf(b)){ b=%_ValueOf(b); }else{ b=(typeof(b)==='number') ?%_NumberToString(b) :%ToString(%ToPrimitive(b,0)); } } return %_StringAdd(b,a); } function SUB(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberSub(b,a); } function MUL(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberMul(b,a); } function DIV(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberDiv(b,a); } function MOD(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberMod(b,a); } function BIT_OR(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberOr(b,a); } function BIT_AND(a){ var b; if((typeof(this)==='number')){ b=this; if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); }else{ b=%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return 0; } return %NumberAnd(b,a); } function BIT_XOR(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberXor(b,a); } function UNARY_MINUS(){ var a=(typeof(this)==='number')?this:%NonNumberToNumber(this); return %NumberUnaryMinus(a); } function BIT_NOT(){ var a=(typeof(this)==='number')?this:%NonNumberToNumber(this); return %NumberNot(a); } function SHL(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberShl(b,a); } function SAR(a){ var b; if((typeof(this)==='number')){ b=this; if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); }else{ b=%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return 0; } return %NumberSar(b,a); } function SHR(a){ var b=(typeof(this)==='number')?this:%NonNumberToNumber(this); if(!(typeof(a)==='number'))a=%NonNumberToNumber(a); return %NumberShr(b,a); } function DELETE(a,b){ return %DeleteProperty(%ToObject(this),%ToString(a),b); } function IN(a){ if(!(%_IsSpecObject(a))){ throw %MakeTypeError('invalid_in_operator_use',[this,a]); } return %_IsNonNegativeSmi(this)? %HasElement(a,this):%HasProperty(a,%ToString(this)); } function INSTANCE_OF(a){ var b=this; if(!(%_ClassOf(a)==='Function')){ throw %MakeTypeError('instanceof_function_expected',[b]); } if(!(%_IsSpecObject(b))){ return 1; } var c=%BoundFunctionGetBindings(a); if(c){ a=c[0]; } var d=a.prototype; if(!(%_IsSpecObject(d))){ throw %MakeTypeError('instanceof_nonobject_proto',[d]); } return %IsInPrototypeChain(d,b)?0:1; } function FILTER_KEY(a){ var b=%ToString(a); if(%HasProperty(this,b))return b; return 0; } function CALL_NON_FUNCTION(){ var a=%GetFunctionDelegate(this); if(!(%_IsFunction(a))){ throw %MakeTypeError('called_non_callable',[typeof this]); } return %Apply(a,this,arguments,0,%_ArgumentsLength()); } function CALL_NON_FUNCTION_AS_CONSTRUCTOR(){ var a=%GetConstructorDelegate(this); if(!(%_IsFunction(a))){ throw %MakeTypeError('called_non_callable',[typeof this]); } return %Apply(a,this,arguments,0,%_ArgumentsLength()); } function CALL_FUNCTION_PROXY(){ var a=%_ArgumentsLength()-1; var b=%_Arguments(a); var c=%GetCallTrap(b); return %Apply(c,this,arguments,0,a); } function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR(){ var a=this; var b=%GetConstructTrap(a); return %Apply(b,this,arguments,0,%_ArgumentsLength()); } function APPLY_PREPARE(a){ var b; if((%_IsArray(a))){ b=a.length; if(%_IsSmi(b)&&b>=0&&b<0x800000&& (%_ClassOf(this)==='Function')){ return b; } } b=(a==null)?0:%ToUint32(a.length); if(b>0x800000){ throw %MakeRangeError('stack_overflow',[]); } if(!(%_ClassOf(this)==='Function')){ throw %MakeTypeError('apply_non_function', [%ToString(this),typeof this]); } if(a!=null&&!(%_IsSpecObject(a))){ throw %MakeTypeError('apply_wrong_args',[]); } return b; } function APPLY_OVERFLOW(a){ throw %MakeRangeError('stack_overflow',[]); } function TO_OBJECT(){ return %ToObject(this); } function TO_NUMBER(){ return %ToNumber(this); } function TO_STRING(){ return %ToString(this); } function ToPrimitive(a,b){ if((typeof(a)==='string'))return a; if(!(%_IsSpecObject(a)))return a; if(b==0)b=((%_ClassOf(a)==='Date'))?2:1; return(b==1)?%DefaultNumber(a):%DefaultString(a); } function ToBoolean(a){ if((typeof(a)==='boolean'))return a; if((typeof(a)==='string'))return a.length!=0; if(a==null)return false; if((typeof(a)==='number'))return!((a==0)||(!%_IsSmi(%IS_VAR(a))&&!(a==a))); return true; } function ToNumber(a){ if((typeof(a)==='number'))return a; if((typeof(a)==='string')){ return %_HasCachedArrayIndex(a)?%_GetCachedArrayIndex(a) :%StringToNumber(a); } if((typeof(a)==='boolean'))return a?1:0; if((typeof(a)==='undefined'))return $NaN; return((a===null))?0:ToNumber(%DefaultNumber(a)); } function NonNumberToNumber(a){ if((typeof(a)==='string')){ return %_HasCachedArrayIndex(a)?%_GetCachedArrayIndex(a) :%StringToNumber(a); } if((typeof(a)==='boolean'))return a?1:0; if((typeof(a)==='undefined'))return $NaN; return((a===null))?0:ToNumber(%DefaultNumber(a)); } function ToString(a){ if((typeof(a)==='string'))return a; if((typeof(a)==='number'))return %_NumberToString(a); if((typeof(a)==='boolean'))return a?'true':'false'; if((typeof(a)==='undefined'))return'undefined'; return((a===null))?'null':%ToString(%DefaultString(a)); } function NonStringToString(a){ if((typeof(a)==='number'))return %_NumberToString(a); if((typeof(a)==='boolean'))return a?'true':'false'; if((typeof(a)==='undefined'))return'undefined'; return((a===null))?'null':%ToString(%DefaultString(a)); } function ToObject(a){ if((typeof(a)==='string'))return new $String(a); if((typeof(a)==='number'))return new $Number(a); if((typeof(a)==='boolean'))return new $Boolean(a); if((a==null)&&!(%_IsUndetectableObject(a))){ throw %MakeTypeError('null_to_object',[]); } return a; } function ToInteger(a){ if(%_IsSmi(a))return a; return %NumberToInteger(ToNumber(a)); } function ToUint32(a){ if(%_IsSmi(a)&&a>=0)return a; return %NumberToJSUint32(ToNumber(a)); } function ToInt32(a){ if(%_IsSmi(a))return a; return %NumberToJSInt32(ToNumber(a)); } function SameValue(a,b){ if(typeof a!=typeof b)return false; if((typeof(a)==='number')){ if((!%_IsSmi(%IS_VAR(a))&&!(a==a))&&(!%_IsSmi(%IS_VAR(b))&&!(b==b)))return true; if(a===0&&b===0&&(1/a)!=(1/b))return false; } return a===b; } function IsPrimitive(a){ return!(%_IsSpecObject(a)); } function DefaultNumber(a){ var b=a.valueOf; if((%_ClassOf(b)==='Function')){ var c=%_CallFunction(a,b); if(%IsPrimitive(c))return c; } var d=a.toString; if((%_ClassOf(d)==='Function')){ var e=%_CallFunction(a,d); if(%IsPrimitive(e))return e; } throw %MakeTypeError('cannot_convert_to_primitive',[]); } function DefaultString(a){ var b=a.toString; if((%_ClassOf(b)==='Function')){ var c=%_CallFunction(a,b); if(%IsPrimitive(c))return c; } var d=a.valueOf; if((%_ClassOf(d)==='Function')){ var e=%_CallFunction(a,d); if(%IsPrimitive(e))return e; } throw %MakeTypeError('cannot_convert_to_primitive',[]); } %FunctionSetPrototype($Array,new $Array(0)); var $isNaN=GlobalIsNaN; var $isFinite=GlobalIsFinite; function InstallFunctions(a,b,c){ if(c.length>=8){ %OptimizeObjectForAddingMultipleProperties(a,c.length>>1); } for(var d=0;d>1)+(b?b.length:0); if(e>=4){ %OptimizeObjectForAddingMultipleProperties(d,e); } if(b){ for(var f=0;f>0)); if(!(b==0||(2<=b&&b<=36))){ return $NaN; } } if(%_HasCachedArrayIndex(a)&& (b==0||b==10)){ return %_GetCachedArrayIndex(a); } return %StringParseInt(a,b); } function GlobalParseFloat(a){ a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); if(%_HasCachedArrayIndex(a))return %_GetCachedArrayIndex(a); return %StringParseFloat(a); } function GlobalEval(a){ if(!(typeof(a)==='string'))return a; var b=%GlobalReceiver(global); var c=(global===b); if(c){ throw new $EvalError('The "this" value passed to eval must '+ 'be the global object from which eval originated'); } var d=%CompileString(a); if(!(%_IsFunction(d)))return d; return %_CallFunction(b,d); } function SetUpGlobal(){ %CheckIsBootstrapping(); %SetProperty(global,"NaN",$NaN,2|4|1); %SetProperty(global,"Infinity",1/0,2|4|1); %SetProperty(global,"undefined",void 0, 2|4|1); InstallFunctions(global,2,$Array( "isNaN",GlobalIsNaN, "isFinite",GlobalIsFinite, "parseInt",GlobalParseInt, "parseFloat",GlobalParseFloat, "eval",GlobalEval )); } SetUpGlobal(); %SetCode($Boolean,function(a){ if(%_IsConstructCall()){ %_SetValueOf(this,ToBoolean(a)); }else{ return ToBoolean(a); } }); %FunctionSetPrototype($Boolean,new $Boolean(false)); %SetProperty($Boolean.prototype,"constructor",$Boolean,2); $Object.prototype.constructor=$Object; function ObjectToString(){ if((typeof(this)==='undefined')&&!(%_IsUndetectableObject(this))){ return'[object Undefined]'; } if((this===null))return'[object Null]'; return"[object "+%_ClassOf(ToObject(this))+"]"; } function ObjectToLocaleString(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Object.prototype.toLocaleString"]); } return this.toString(); } function ObjectValueOf(){ return ToObject(this); } function ObjectHasOwnProperty(a){ if(%IsJSProxy(this)){ var b=%GetHandler(this); return CallTrap1(b,"hasOwn",DerivedHasOwnTrap,((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a))); } return %HasLocalProperty(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)),((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a))); } function ObjectIsPrototypeOf(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Object.prototype.isPrototypeOf"]); } if(!(%_IsSpecObject(a)))return false; return %IsInPrototypeChain(this,a); } function ObjectPropertyIsEnumerable(a){ var b=ToString(a); if(%IsJSProxy(this)){ var c=GetOwnProperty(this,b); return(typeof(c)==='undefined')?false:c.isEnumerable(); } return %IsPropertyEnumerable(ToObject(this),b); } function ObjectDefineGetter(a,b){ var c=this; if(c==null&&!(%_IsUndetectableObject(c))){ c=%GlobalReceiver(global); } if(!(%_ClassOf(b)==='Function')){ throw new $TypeError( 'Object.prototype.__defineGetter__: Expecting function'); } var d=new PropertyDescriptor(); d.setGet(b); d.setEnumerable(true); d.setConfigurable(true); DefineOwnProperty(ToObject(c),ToString(a),d,false); } function ObjectLookupGetter(a){ var b=this; if(b==null&&!(%_IsUndetectableObject(b))){ b=%GlobalReceiver(global); } return %LookupAccessor(ToObject(b),ToString(a),0); } function ObjectDefineSetter(a,b){ var c=this; if(c==null&&!(%_IsUndetectableObject(c))){ c=%GlobalReceiver(global); } if(!(%_ClassOf(b)==='Function')){ throw new $TypeError( 'Object.prototype.__defineSetter__: Expecting function'); } var d=new PropertyDescriptor(); d.setSet(b); d.setEnumerable(true); d.setConfigurable(true); DefineOwnProperty(ToObject(c),ToString(a),d,false); } function ObjectLookupSetter(a){ var b=this; if(b==null&&!(%_IsUndetectableObject(b))){ b=%GlobalReceiver(global); } return %LookupAccessor(ToObject(b),ToString(a),1); } function ObjectKeys(a){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("called_on_non_object",["Object.keys"]); } if(%IsJSProxy(a)){ var b=%GetHandler(a); var c=CallTrap0(b,"keys",DerivedKeysTrap); return ToStringArray(c,"keys"); } return %LocalKeys(a); } function IsAccessorDescriptor(a){ if((typeof(a)==='undefined'))return false; return a.hasGetter()||a.hasSetter(); } function IsDataDescriptor(a){ if((typeof(a)==='undefined'))return false; return a.hasValue()||a.hasWritable(); } function IsGenericDescriptor(a){ if((typeof(a)==='undefined'))return false; return!(IsAccessorDescriptor(a)||IsDataDescriptor(a)); } function IsInconsistentDescriptor(a){ return IsAccessorDescriptor(a)&&IsDataDescriptor(a); } function FromPropertyDescriptor(a){ if((typeof(a)==='undefined'))return a; if(IsDataDescriptor(a)){ return{value:a.getValue(), writable:a.isWritable(), enumerable:a.isEnumerable(), configurable:a.isConfigurable()}; } return{get:a.getGet(), set:a.getSet(), enumerable:a.isEnumerable(), configurable:a.isConfigurable()}; } function FromGenericPropertyDescriptor(a){ if((typeof(a)==='undefined'))return a; var b=new $Object(); if(a.hasValue()){ %IgnoreAttributesAndSetProperty(b,"value",a.getValue(),0); } if(a.hasWritable()){ %IgnoreAttributesAndSetProperty(b,"writable",a.isWritable(),0); } if(a.hasGetter()){ %IgnoreAttributesAndSetProperty(b,"get",a.getGet(),0); } if(a.hasSetter()){ %IgnoreAttributesAndSetProperty(b,"set",a.getSet(),0); } if(a.hasEnumerable()){ %IgnoreAttributesAndSetProperty(b,"enumerable", a.isEnumerable(),0); } if(a.hasConfigurable()){ %IgnoreAttributesAndSetProperty(b,"configurable", a.isConfigurable(),0); } return b; } function ToPropertyDescriptor(a){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("property_desc_object",[a]); } var b=new PropertyDescriptor(); if("enumerable"in a){ b.setEnumerable(ToBoolean(a.enumerable)); } if("configurable"in a){ b.setConfigurable(ToBoolean(a.configurable)); } if("value"in a){ b.setValue(a.value); } if("writable"in a){ b.setWritable(ToBoolean(a.writable)); } if("get"in a){ var c=a.get; if(!(typeof(c)==='undefined')&&!(%_ClassOf(c)==='Function')){ throw MakeTypeError("getter_must_be_callable",[c]); } b.setGet(c); } if("set"in a){ var d=a.set; if(!(typeof(d)==='undefined')&&!(%_ClassOf(d)==='Function')){ throw MakeTypeError("setter_must_be_callable",[d]); } b.setSet(d); } if(IsInconsistentDescriptor(b)){ throw MakeTypeError("value_and_accessor",[a]); } return b; } function ToCompletePropertyDescriptor(a){ var b=ToPropertyDescriptor(a); if(IsGenericDescriptor(b)||IsDataDescriptor(b)){ if(!b.hasValue())b.setValue(void 0); if(!b.hasWritable())b.setWritable(false); }else{ if(!b.hasGetter())b.setGet(void 0); if(!b.hasSetter())b.setSet(void 0); } if(!b.hasEnumerable())b.setEnumerable(false); if(!b.hasConfigurable())b.setConfigurable(false); return b; } function PropertyDescriptor(){ this.value_=void 0; this.hasValue_=false; this.writable_=false; this.hasWritable_=false; this.enumerable_=false; this.hasEnumerable_=false; this.configurable_=false; this.hasConfigurable_=false; this.get_=void 0; this.hasGetter_=false; this.set_=void 0; this.hasSetter_=false; } SetUpLockedPrototype(PropertyDescriptor,$Array( "value_", "hasValue_", "writable_", "hasWritable_", "enumerable_", "hasEnumerable_", "configurable_", "hasConfigurable_", "get_", "hasGetter_", "set_", "hasSetter_" ),$Array( "toString",function(){ return"[object PropertyDescriptor]"; }, "setValue",function(a){ this.value_=a; this.hasValue_=true; }, "getValue",function(){ return this.value_; }, "hasValue",function(){ return this.hasValue_; }, "setEnumerable",function(a){ this.enumerable_=a; this.hasEnumerable_=true; }, "isEnumerable",function(){ return this.enumerable_; }, "hasEnumerable",function(){ return this.hasEnumerable_; }, "setWritable",function(a){ this.writable_=a; this.hasWritable_=true; }, "isWritable",function(){ return this.writable_; }, "hasWritable",function(){ return this.hasWritable_; }, "setConfigurable",function(a){ this.configurable_=a; this.hasConfigurable_=true; }, "hasConfigurable",function(){ return this.hasConfigurable_; }, "isConfigurable",function(){ return this.configurable_; }, "setGet",function(a){ this.get_=a; this.hasGetter_=true; }, "getGet",function(){ return this.get_; }, "hasGetter",function(){ return this.hasGetter_; }, "setSet",function(a){ this.set_=a; this.hasSetter_=true; }, "getSet",function(){ return this.set_; }, "hasSetter",function(){ return this.hasSetter_; })); function ConvertDescriptorArrayToDescriptor(a){ if(a===false){ throw'Internal error: invalid desc_array'; } if((typeof(a)==='undefined')){ return void 0; } var b=new PropertyDescriptor(); if(a[0]){ b.setGet(a[2]); b.setSet(a[3]); }else{ b.setValue(a[1]); b.setWritable(a[4]); } b.setEnumerable(a[5]); b.setConfigurable(a[6]); return b; } function GetTrap(a,b,c){ var d=a[b]; if((typeof(d)==='undefined')){ if((typeof(c)==='undefined')){ throw MakeTypeError("handler_trap_missing",[a,b]); } d=c; }else if(!(%_ClassOf(d)==='Function')){ throw MakeTypeError("handler_trap_must_be_callable",[a,b]); } return d; } function CallTrap0(a,b,c){ return %_CallFunction(a,GetTrap(a,b,c)); } function CallTrap1(a,b,c,d){ return %_CallFunction(a,d,GetTrap(a,b,c)); } function CallTrap2(a,b,c,d,e){ return %_CallFunction(a,d,e,GetTrap(a,b,c)); } function GetOwnProperty(a,b){ var c=ToString(b); if(%IsJSProxy(a)){ var d=%GetHandler(a); var e=CallTrap1(d,"getOwnPropertyDescriptor",void 0,c); if((typeof(e)==='undefined'))return e; var f=ToCompletePropertyDescriptor(e); if(!f.isConfigurable()){ throw MakeTypeError("proxy_prop_not_configurable", [d,"getOwnPropertyDescriptor",c,e]); } return f; } var g=%GetOwnProperty(ToObject(a),ToString(b)); if(g===false)return void 0; return ConvertDescriptorArrayToDescriptor(g); } function Delete(a,b,c){ var d=GetOwnProperty(a,b); if((typeof(d)==='undefined'))return true; if(d.isConfigurable()){ %DeleteProperty(a,b,0); return true; }else if(c){ throw MakeTypeError("define_disallowed",[b]); }else{ return; } } function DefineProxyProperty(a,b,c,d){ var e=%GetHandler(a); var f=CallTrap2(e,"defineProperty",void 0,b,c); if(!ToBoolean(f)){ if(d){ throw MakeTypeError("handler_returned_false", [e,"defineProperty"]); }else{ return false; } } return true; } function DefineObjectProperty(a,b,c,d){ var e=%GetOwnProperty(ToObject(a),ToString(b)); if(e===false)return void 0; var f=ConvertDescriptorArrayToDescriptor(e); var g=%IsExtensible(ToObject(a)); if((typeof(f)==='undefined')&&!g){ if(d){ throw MakeTypeError("define_disallowed",[b]); }else{ return false; } } if(!(typeof(f)==='undefined')){ if((IsGenericDescriptor(c)|| IsDataDescriptor(c)==IsDataDescriptor(f))&& (!c.hasEnumerable()|| SameValue(c.isEnumerable(),f.isEnumerable()))&& (!c.hasConfigurable()|| SameValue(c.isConfigurable(),f.isConfigurable()))&& (!c.hasWritable()|| SameValue(c.isWritable(),f.isWritable()))&& (!c.hasValue()|| SameValue(c.getValue(),f.getValue()))&& (!c.hasGetter()|| SameValue(c.getGet(),f.getGet()))&& (!c.hasSetter()|| SameValue(c.getSet(),f.getSet()))){ return true; } if(!f.isConfigurable()){ if(c.isConfigurable()|| (c.hasEnumerable()&& c.isEnumerable()!=f.isEnumerable())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(!IsGenericDescriptor(c)){ if(IsDataDescriptor(f)!=IsDataDescriptor(c)){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(IsDataDescriptor(f)&&IsDataDescriptor(c)){ if(!f.isWritable()&&c.isWritable()){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(!f.isWritable()&&c.hasValue()&& !SameValue(c.getValue(),f.getValue())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } } if(IsAccessorDescriptor(c)&&IsAccessorDescriptor(f)){ if(c.hasSetter()&&!SameValue(c.getSet(),f.getSet())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(c.hasGetter()&&!SameValue(c.getGet(),f.getGet())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } } } } } var h=0; if(c.hasEnumerable()){ h|=c.isEnumerable()?0:2; }else if(!(typeof(f)==='undefined')){ h|=f.isEnumerable()?0:2; }else{ h|=2; } if(c.hasConfigurable()){ h|=c.isConfigurable()?0:4; }else if(!(typeof(f)==='undefined')){ h|=f.isConfigurable()?0:4; }else h|=4; if(IsDataDescriptor(c)|| (IsGenericDescriptor(c)&& ((typeof(f)==='undefined')||IsDataDescriptor(f)))){ if(c.hasWritable()){ h|=c.isWritable()?0:1; }else if(!(typeof(f)==='undefined')){ h|=f.isWritable()?0:1; }else{ h|=1; } var i=void 0; if(c.hasValue()){ i=c.getValue(); }else if(!(typeof(f)==='undefined')&&IsDataDescriptor(f)){ i=f.getValue(); } %DefineOrRedefineDataProperty(a,b,i,h); }else{ var j=c.hasGetter()?c.getGet():null; var k=c.hasSetter()?c.getSet():null; %DefineOrRedefineAccessorProperty(a,b,j,k,h); } return true; } function DefineArrayProperty(a,b,c,d){ if(b=="length"){ var e=a.length; if(!c.hasValue()){ return DefineObjectProperty(a,"length",c,d); } var f=ToUint32(c.getValue()); if(f!=ToNumber(c.getValue())){ throw new $RangeError('defineProperty() array length out of range'); } var g=GetOwnProperty(a,"length"); if(f!=e&&!g.isWritable()){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } var h=false; while(f=e&&!g.isWritable())|| !DefineObjectProperty(a,b,c,true)){ if(d){ throw MakeTypeError("define_disallowed",[b]); }else{ return false; } } if(i>=e){ a.length=i+1; } return true; } return DefineObjectProperty(a,b,c,d); } function DefineOwnProperty(a,b,c,d){ if(%IsJSProxy(a)){ var e=FromGenericPropertyDescriptor(c); return DefineProxyProperty(a,b,e,d); }else if((%_IsArray(a))){ return DefineArrayProperty(a,b,c,d); }else{ return DefineObjectProperty(a,b,c,d); } } function ObjectGetPrototypeOf(a){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("called_on_non_object",["Object.getPrototypeOf"]); } return %GetPrototype(a); } function ObjectGetOwnPropertyDescriptor(a,b){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("called_on_non_object", ["Object.getOwnPropertyDescriptor"]); } var c=GetOwnProperty(a,b); return FromPropertyDescriptor(c); } function ToStringArray(a,b){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("proxy_non_object_prop_names",[a,b]); } var c=ToUint32(a.length); var d=new $Array(c); var e={}; for(var f=0;f36){ throw new $RangeError('toString() radix argument must be between 2 and 36'); } return %NumberToRadixString(b,a); } function NumberToLocaleString(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Number.prototype.toLocaleString"]); } return this.toString(); } function NumberValueOf(){ if(!(typeof(this)==='number')&&!(%_ClassOf(this)==='Number')){ throw new $TypeError('Number.prototype.valueOf is not generic'); } return %_ValueOf(this); } function NumberToFixed(a){ var b=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(b<0||b>20){ throw new $RangeError("toFixed() digits argument must be between 0 and 20"); } if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Number.prototype.toFixed"]); } var c=ToNumber(this); return %NumberToFixed(c,b); } function NumberToExponential(a){ var b=-1; if(!(typeof(a)==='undefined')){ b=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(b<0||b>20){ throw new $RangeError( "toExponential() argument must be between 0 and 20"); } } if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Number.prototype.toExponential"]); } var c=ToNumber(this); return %NumberToExponential(c,b); } function NumberToPrecision(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Number.prototype.toPrecision"]); } if((typeof(a)==='undefined'))return ToString(%_ValueOf(this)); var b=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(b<1||b>21){ throw new $RangeError("toPrecision() argument must be between 1 and 21"); } var c=ToNumber(this); return %NumberToPrecision(c,b); } function NumberIsFinite(a){ return(typeof(a)==='number')&&(%_IsSmi(%IS_VAR(a))||((a==a)&&(a!=1/0)&&(a!=-1/0))); } function NumberIsNaN(a){ return(typeof(a)==='number')&&(!%_IsSmi(%IS_VAR(a))&&!(a==a)); } function SetUpNumber(){ %CheckIsBootstrapping(); %OptimizeObjectForAddingMultipleProperties($Number.prototype,8); %SetProperty($Number.prototype,"constructor",$Number,2); %OptimizeObjectForAddingMultipleProperties($Number,5); %SetProperty($Number, "MAX_VALUE", 1.7976931348623157e+308, 2|4|1); %SetProperty($Number,"MIN_VALUE",5e-324, 2|4|1); %SetProperty($Number,"NaN",$NaN,2|4|1); %SetProperty($Number, "NEGATIVE_INFINITY", -1/0, 2|4|1); %SetProperty($Number, "POSITIVE_INFINITY", 1/0, 2|4|1); %ToFastProperties($Number); InstallFunctions($Number.prototype,2,$Array( "toString",NumberToString, "toLocaleString",NumberToLocaleString, "valueOf",NumberValueOf, "toFixed",NumberToFixed, "toExponential",NumberToExponential, "toPrecision",NumberToPrecision )); InstallFunctions($Number,2,$Array( "isFinite",NumberIsFinite, "isNaN",NumberIsNaN )); } SetUpNumber(); $Function.prototype.constructor=$Function; function FunctionSourceString(a){ while(%IsJSFunctionProxy(a)){ a=%GetCallTrap(a); } if(!(%_IsFunction(a))){ throw new $TypeError('Function.prototype.toString is not generic'); } var b=%FunctionGetSourceCode(a); if(!(typeof(b)==='string')||%FunctionIsBuiltin(a)){ var c=%FunctionGetName(a); if(c){ return'function '+c+'() { [native code] }'; }else{ return'function () { [native code] }'; } } var c=%FunctionNameShouldPrintAsAnonymous(a) ?'anonymous' :%FunctionGetName(a); return'function '+c+b; } function FunctionToString(){ return FunctionSourceString(this); } function FunctionBind(a){ if(!(%_ClassOf(this)==='Function')){ throw new $TypeError('Bind must be called on a function'); } var b=function(){ "use strict"; if(%_IsConstructCall()){ return %NewObjectFromBound(b); } var c=%BoundFunctionGetBindings(b); var d=%_ArgumentsLength(); if(d==0){ return %Apply(c[0],c[1],c,2,c.length-2); } if(c.length===2){ return %Apply(c[0],c[1],arguments,0,d); } var e=c.length-2; var f=new InternalArray(e+d); for(var g=0;g>>0)===j)){ var d=%_ArgumentsLength(); if(d>0)d--; i=j-d; if(i<0)i=0; } } var k=%FunctionBindArguments(b,this, a,i); return k; } function NewFunction(a){ var b=%_ArgumentsLength(); var c=''; if(b>1){ c=new InternalArray(b-1); for(var d=0;d0)?ToString(%_Arguments(b-1)):''; var f='(function('+c+') {\n'+e+'\n})'; var g=%CompileString(f)(); %FunctionMarkNameShouldPrintAsAnonymous(g); return %SetNewFunctionAttributes(g); } %SetCode($Function,NewFunction); function SetUpFunction(){ %CheckIsBootstrapping(); InstallFunctions($Function.prototype,2,$Array( "bind",FunctionBind, "toString",FunctionToString )); } SetUpFunction(); var visited_arrays=new InternalArray(); function GetSortedArrayKeys(a,b){ var c=b.length; var d=[]; for(var e=0;e1000&& (!%_IsSmi(b)|| %EstimateNumberOfElements(a)<(b>>2)); } function Join(a,b,c,d){ if(b==0)return''; var e=(%_IsArray(a)); if(e){ if(!%PushIfAbsent(visited_arrays,a))return''; } try{ if(UseSparseVariant(a,b,e)){ if(c.length==0){ return SparseJoin(a,b,d); }else{ return SparseJoinWithSeparator(a,b,d,c); } } if(b==1){ var f=a[0]; if((typeof(f)==='string'))return f; return d(f); } var g=new InternalArray(b); if(c.length==0){ var h=0; for(var i=0;i=b){ var m=a[j]; if(!(typeof(m)==='undefined')||j in a){ f[j-b]=m; } } } } } } function SmartMove(a,b,c,d,f){ var g=new InternalArray(d-c+f); var h=%GetArrayKeys(a,d); var i=h.length; for(var j=0;j=b+c){ var n=a[k]; if(!(typeof(n)==='undefined')||k in a){ g[k-c+f]=n; } } } } } %MoveArrayContents(g,a); } function SimpleSlice(a,b,c,d,f){ for(var g=0;gc){ for(var g=d-c;g>b;g--){ var h=g+c-1; var i=g+f-1; var j=a[h]; if(!(typeof(j)==='undefined')||h in a){ a[i]=j; }else{ delete a[i]; } } }else{ for(var g=b;gd-c+f;g--){ delete a[g-1]; } } } } function ArrayToString(){ var a; var b; if((%_IsArray(this))){ b=this.join; if(b===ArrayJoin){ return Join(this,this.length,',',ConvertToString); } a=this; }else{ a=ToObject(this); b=a.join; } if(!(%_ClassOf(b)==='Function')){ return %_CallFunction(a,ObjectToString); } return %_CallFunction(a,b); } function ArrayToLocaleString(){ var a=ToObject(this); var b=a.length; var c=(b>>>0); if(c===0)return""; return Join(a,c,',',ConvertToLocaleString); } function ArrayJoin(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.join"]); } if((typeof(a)==='undefined')){ a=','; }else if(!(typeof(a)==='string')){ a=NonStringToString(a); } var b=%_FastAsciiArrayJoin(this,a); if(!(typeof(b)==='undefined'))return b; return Join(this,(this.length>>>0),a,ConvertToString); } function ArrayPop(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.pop"]); } var a=(this.length>>>0); if(a==0){ this.length=a; return; } a--; var b=this[a]; this.length=a; delete this[a]; return b; } function ArrayPush(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.push"]); } var a=(this.length>>>0); var b=%_ArgumentsLength(); for(var c=0;c=g){ j=g; while(c[++f]==g){} k=b-g-1; } var l=a[j]; if(!(typeof(l)==='undefined')||j in a){ var m=a[k]; if(!(typeof(m)==='undefined')||k in a){ a[j]=m; a[k]=l; }else{ a[k]=l; delete a[j]; } }else{ var m=a[k]; if(!(typeof(m)==='undefined')||k in a){ a[j]=m; delete a[k]; } } } } function ArrayReverse(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.reverse"]); } var a=(this.length>>>0)-1; if(UseSparseVariant(this,a,(%_IsArray(this)))){ SparseReverse(this,a+1); return this; } for(var b=0;b>>0); if(a===0){ this.length=0; return; } var b=this[0]; if((%_IsArray(this))){ SmartMove(this,0,1,a,0); }else{ SimpleMove(this,0,1,a,0); } this.length=a-1; return b; } function ArrayUnshift(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.unshift"]); } var b=(this.length>>>0); var c=%_ArgumentsLength(); if((%_IsArray(this))){ SmartMove(this,0,0,b,c); }else{ SimpleMove(this,0,0,b,c); } for(var d=0;d>>0); var d=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); var f=c; if(b!==void 0)f=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(d<0){ d+=c; if(d<0)d=0; }else{ if(d>c)d=c; } if(f<0){ f+=c; if(f<0)f=0; }else{ if(f>c)f=c; } var g=[]; if(f1000)&& (%EstimateNumberOfElements(this)>>0); var f=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(f<0){ f+=d; if(f<0)f=0; }else{ if(f>d)f=d; } var g=0; if(c==1){ g=d-f; }else{ g=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(g<0)g=0; if(g>d-f)g=d-f; } var h=[]; h.length=g; var i=0; if(c>2){ i=c-2; } var j=true; if((%_IsArray(this))&&i!==g){ var k=%EstimateNumberOfElements(this); if(d>20&&(k>>2)<(d-f)){ j=false; } } if(j){ SimpleSlice(this,f,g,d,h); SimpleMove(this,f,g,d,i); }else{ SmartSlice(this,f,g,d,h); SmartMove(this,f,g,d,i); } var l=f; var m=2; var n=%_ArgumentsLength(); while(m=h;l--){ var m=g[l]; var n=%_CallFunction(d,m,k,a); if(n>0){ g[l+1]=m; }else{ break; } } g[l+1]=k; } }; var o=function QuickSort(g,h,i){ if(i-h<=10){ f(g,h,i); return; } var q=g[h]; var r=g[i-1]; var s=h+((i-h)>>1); var t=g[s]; var u=%_CallFunction(d,q,r,a); if(u>0){ var m=q; q=r; r=m; } var w=%_CallFunction(d,q,t,a); if(w>=0){ var m=q; q=t; t=r; r=m; }else{ var z=%_CallFunction(d,r,t,a); if(z>0){ var m=r; r=t; t=m; } } g[h]=q; g[i-1]=t; var A=r; var B=h+1; var C=i-1; g[s]=g[B]; g[B]=A; partition:for(var j=B+1;j0){ do{ C--; if(C==j)break partition; var D=g[C]; n=%_CallFunction(d,D,A,a); }while(n>0); g[j]=g[C]; g[C]=k; if(n<0){ k=g[j]; g[j]=g[B]; g[B]=k; B++; } } } o(g,h,B); o(g,C,i); }; var E=function CopyFromPrototype(G,H){ var I=0; for(var J=G.__proto__;J;J=J.__proto__){ var K=%GetArrayKeys(J,H); if(K.length>0){ if(K[0]==-1){ var L=K[1]; for(var j=0;j=I){I=j+1;} } } }else{ for(var j=0;j=I){I=M+1;} } } } } } return I; }; var N=function(G,h,i){ for(var J=G.__proto__;J;J=J.__proto__){ var K=%GetArrayKeys(J,i); if(K.length>0){ if(K[0]==-1){ var L=K[1]; for(var j=h;j>>0); if(H<2)return this; var S=(%_IsArray(this)); var T; if(!S){ T=E(this,H); } var U=%RemoveArrayHoles(this,H); if(U==-1){ U=O(this); } o(this,0,U); if(!S&&(U+1>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } if((b==null)){ b=%GetDefaultReceiver(a)||b; }else if(!(%_IsSpecObject(b))){ b=ToObject(b); } if(%DebugCallbackSupportsStepping(a)){ for(var g=0;g>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } if((b==null)){ b=%GetDefaultReceiver(a)||b; }else if(!(%_IsSpecObject(b))){ b=ToObject(b); } if(%DebugCallbackSupportsStepping(a)){ for(var g=0;g>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } if((b==null)){ b=%GetDefaultReceiver(a)||b; }else if(!(%_IsSpecObject(b))){ b=ToObject(b); } if(%DebugCallbackSupportsStepping(a)){ for(var g=0;g>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } if((b==null)){ b=%GetDefaultReceiver(a)||b; }else if(!(%_IsSpecObject(b))){ b=ToObject(b); } var g=new $Array(); var h=new InternalArray(d); if(%DebugCallbackSupportsStepping(a)){ for(var i=0;i>>0); if(c==0)return-1; if((typeof(b)==='undefined')){ b=0; }else{ b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(b<0){ b=c+b; if(b<0)b=0; } } var d=b; var g=c; if(UseSparseVariant(this,c,(%_IsArray(this)))){ var h=%GetArrayKeys(this,c); if(h.length==2&&h[0]<0){ var i=-(h[0]+1); var j=i+h[1]; if(d>>0); if(c==0)return-1; if(%_ArgumentsLength()<2){ b=c-1; }else{ b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(b<0)b+=c; if(b<0)return-1; else if(b>=c)b=c-1; } var d=0; var g=b; if(UseSparseVariant(this,c,(%_IsArray(this)))){ var h=%GetArrayKeys(this,b+1); if(h.length==2&&h[0]<0){ var i=-(h[0]+1); var j=i+h[1]; if(d=0){ var m=k[l]; if(!(typeof(m)==='undefined')&&this[m]===a)return m; l--; } return-1; } } if(!(typeof(a)==='undefined')){ for(var l=g;l>=d;l--){ if(this[l]===a)return l; } return-1; } for(var l=g;l>=d;l--){ if((typeof(this[l])==='undefined')&&l in this){ return l; } } return-1; } function ArrayReduce(a,b){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["Array.prototype.reduce"]); } var c=ToObject(this); var d=ToUint32(c.length); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var g=0; find_initial:if(%_ArgumentsLength()<2){ for(;g=0;g--){ b=c[g]; if(!(typeof(b)==='undefined')||g in c){ g--; break find_initial; } } throw MakeTypeError('reduce_no_initial',[]); } var h=%GetDefaultReceiver(a); if(%DebugCallbackSupportsStepping(a)){ for(;g>=0;g--){ if(g in c){ var i=c[g]; %DebugPrepareStepInIfStepping(a); b= %_CallFunction(h,b,i,g,c,a); } } }else{ for(;g>=0;g--){ if(g in c){ var i=c[g]; b= %_CallFunction(h,b,i,g,c,a); } } } return b; } function ArrayIsArray(a){ return(%_IsArray(a)); } function SetUpArray(){ %CheckIsBootstrapping(); %SetProperty($Array.prototype,"constructor",$Array,2); InstallFunctions($Array,2,$Array( "isArray",ArrayIsArray )); var a=%SpecialArrayFunctions({}); var b=function(c,d,g){ var h=d; if(a.hasOwnProperty(c)){ h=a[c]; } if(!(typeof(g)==='undefined')){ %FunctionSetLength(h,g); } return h; }; InstallFunctions($Array.prototype,2,$Array( "toString",b("toString",ArrayToString), "toLocaleString",b("toLocaleString",ArrayToLocaleString), "join",b("join",ArrayJoin), "pop",b("pop",ArrayPop), "push",b("push",ArrayPush,1), "concat",b("concat",ArrayConcat,1), "reverse",b("reverse",ArrayReverse), "shift",b("shift",ArrayShift), "unshift",b("unshift",ArrayUnshift,1), "slice",b("slice",ArraySlice,2), "splice",b("splice",ArraySplice,2), "sort",b("sort",ArraySort), "filter",b("filter",ArrayFilter,1), "forEach",b("forEach",ArrayForEach,1), "some",b("some",ArraySome,1), "every",b("every",ArrayEvery,1), "map",b("map",ArrayMap,1), "indexOf",b("indexOf",ArrayIndexOf,1), "lastIndexOf",b("lastIndexOf",ArrayLastIndexOf,1), "reduce",b("reduce",ArrayReduce,1), "reduceRight",b("reduceRight",ArrayReduceRight,1) )); %FinishArrayPrototypeSetup($Array.prototype); SetUpLockedPrototype(InternalArray,$Array(),$Array( "join",b("join",ArrayJoin), "pop",b("pop",ArrayPop), "push",b("push",ArrayPush) )); } SetUpArray(); %SetCode($String,function(a){ var b=%_ArgumentsLength()==0?'':((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); if(%_IsConstructCall()){ %_SetValueOf(this,b); }else{ return b; } }); %FunctionSetPrototype($String,new $String()); function StringToString(){ if(!(typeof(this)==='string')&&!(%_ClassOf(this)==='String')){ throw new $TypeError('String.prototype.toString is not generic'); } return %_ValueOf(this); } function StringValueOf(){ if(!(typeof(this)==='string')&&!(%_ClassOf(this)==='String')){ throw new $TypeError('String.prototype.valueOf is not generic'); } return %_ValueOf(this); } function StringCharAt(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.charAt"]); } var b=%_StringCharAt(this,a); if(%_IsSmi(b)){ b=%_StringCharAt(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))); } return b; } function StringCharCodeAt(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.charCodeAt"]); } var b=%_StringCharCodeAt(this,a); if(!%_IsSmi(b)){ b=%_StringCharCodeAt(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))); } return b; } function StringConcat(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.concat"]); } var a=%_ArgumentsLength(); var b=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); if(a===1){ return b+%_Arguments(0); } var c=new InternalArray(a+1); c[0]=b; for(var d=0;d1){ c=%_Arguments(1); c=(%_IsSmi(%IS_VAR(c))?c:%NumberToInteger(ToNumber(c))); if(c<0)c=0; if(c>b.length)c=b.length; } return %StringIndexOf(b,a,c); } function StringLastIndexOf(a){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.lastIndexOf"]); } var b=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var c=b.length; var a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); var d=a.length; var g=c-d; if(%_ArgumentsLength()>1){ var h=ToNumber(%_Arguments(1)); if(!(!%_IsSmi(%IS_VAR(h))&&!(h==h))){ h=(%_IsSmi(%IS_VAR(h))?h:%NumberToInteger(ToNumber(h))); if(h<0){ h=0; } if(h+d0xFF&& (typeof(b)==='string')&& %StringIndexOf(b,'$',0)<0){ return %StringReplaceOneCharWithString(c,a,b); } var h=%StringIndexOf(c,a,0); if(h<0)return c; var i=h+a.length; var j=SubString(c,0,h); if((%_ClassOf(b)==='Function')){ var k=%GetDefaultReceiver(b); j+=%_CallFunction(k,a,h,c,b); }else{ reusableMatchInfo[3]=h; reusableMatchInfo[4]=i; b=((typeof(%IS_VAR(b))==='string')?b:NonStringToString(b)); j=ExpandReplacement(b,c,reusableMatchInfo,j); } return j+SubString(c,i,c.length); } function ExpandReplacement(a,b,c,d){ var g=a.length; var h=%StringIndexOf(a,'$',0); if(h<0){ if(g>0)d+=a; return d; } if(h>0)d+=SubString(a,0,h); while(true){ var i='$'; var j=h+1; if(jj){ d+=SubString(a,j,h); } } return d; } function CaptureString(a,b,c){ var d=c<<1; var g=b[(3+(d))]; if(g<0)return; var h=b[(3+(d+1))]; return SubString(a,g,h); } var reusableReplaceArray=new InternalArray(16); function StringReplaceGlobalRegExpWithFunction(a,b,c){ var d=reusableReplaceArray; if(d){ reusableReplaceArray=null; }else{ d=new InternalArray(16); } var g=%RegExpExecMultiple(b, a, lastMatchInfo, d); b.lastIndex=0; if((g===null)){ reusableReplaceArray=d; return a; } var h=g.length; if(((lastMatchInfo)[0])==2){ var i=0; var j=new InternalArray(null,0,a); var k=%GetDefaultReceiver(c); for(var l=0;l0){ i=(m>>11)+(m&0x7ff); }else{ i=g[++l]-m; } }else{ j[0]=m; j[1]=i; lastMatchInfoOverride=j; var n= %_CallFunction(k,m,i,a,c); g[l]=((typeof(%IS_VAR(n))==='string')?n:NonStringToString(n)); i+=m.length; } } }else{ var k=%GetDefaultReceiver(c); for(var l=0;l>1; var k; var l=%GetDefaultReceiver(c); if(j==1){ var m=SubString(a,g,i); k=%_CallFunction(l,m,g,a,c); }else{ var n=new InternalArray(j+2); for(var o=0;od){ return''; } } if(h<0){ h+=d; if(h<0){ return''; } }else{ if(h>d){ h=d; } } if(h<=g){ return''; } return SubString(c,g,h); } function StringSplit(a,b){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.split"]); } var c=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); b=((typeof(b)==='undefined'))?0xffffffff:(b>>>0); if((typeof(a)==='undefined')){ return[c]; } var d=c.length; if(!(%_IsRegExp(a))){ a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); if(b===0)return[]; var g=a.length; if(g===0)return %StringToArray(c,b); var h=%StringSplit(c,a,b); return h; } if(b===0)return[]; return StringSplitOnRegExp(c,a,b,d); } function StringSplitOnRegExp(a,b,c,d){ %_Log('regexp','regexp-split,%0S,%1r',[a,b]); if(d===0){ if(DoRegExpExec(b,a,0,0)!=null){ return[]; } return[a]; } var g=0; var h=0; var i=0; var j=[]; outer_loop: while(true){ if(h===d){ j.push(SubString(a,g,d)); break; } var k=DoRegExpExec(b,a,h); if(k==null||d===(i=k[3])){ j.push(SubString(a,g,d)); break; } var l=k[4]; if(h===l&&l===g){ h++; continue; } if(g+1==i){ j.push(%_StringCharAt(a,g)); }else{ j.push(%_SubString(a,g,i)); } if(j.length===c)break; var m=((k)[0])+3; for(var n=3+2;nd){ g=d; } var h=d; if(!(typeof(b)==='undefined')){ h=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(h>d){ h=d; }else{ if(h<0)h=0; if(g>h){ var i=h; h=g; g=i; } } } return((g+1==h) ?%_StringCharAt(c,g) :%_SubString(c,g,h)); } function StringSubstr(a,b){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.substr"]); } var c=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var d; if(b===void 0){ d=c.length; }else{ d=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(d<=0)return''; } if(a===void 0){ a=0; }else{ a=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(a>=c.length)return''; if(a<0){ a+=c.length; if(a<0)a=0; } } var g=a+d; if(g>c.length)g=c.length; return((a+1==g) ?%_StringCharAt(c,a) :%_SubString(c,a,g)); } function StringToLowerCase(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.toLowerCase"]); } return %StringToLowerCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); } function StringToLocaleLowerCase(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.toLocaleLowerCase"]); } return %StringToLowerCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); } function StringToUpperCase(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.toUpperCase"]); } return %StringToUpperCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); } function StringToLocaleUpperCase(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.toLocaleUpperCase"]); } return %StringToUpperCase(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this))); } function StringTrim(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.trim"]); } return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),true,true); } function StringTrimLeft(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.trimLeft"]); } return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),true,false); } function StringTrimRight(){ if((this==null)&&!(%_IsUndetectableObject(this))){ throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.trimRight"]); } return %StringTrim(((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)),false,true); } var static_charcode_array=new InternalArray(4); function StringFromCharCode(a){ var b=%_ArgumentsLength(); if(b==1){ if(!%_IsSmi(a))a=ToNumber(a); return %_StringCharFromCode(a&0xffff); } var c=static_charcode_array; for(var d=0;d/g,">") .replace(/"/g,""") .replace(/'/g,"'"); } function StringLink(a){ return""+this+""; } function StringAnchor(a){ return""+this+""; } function StringFontcolor(a){ return""+this+""; } function StringFontsize(a){ return""+this+""; } function StringBig(){ return""+this+""; } function StringBlink(){ return""+this+""; } function StringBold(){ return""+this+""; } function StringFixed(){ return""+this+""; } function StringItalics(){ return""+this+""; } function StringSmall(){ return""+this+""; } function StringStrike(){ return""+this+""; } function StringSub(){ return""+this+""; } function StringSup(){ return""+this+""; } function ReplaceResultBuilder(a){ if(%_ArgumentsLength()>1){ this.elements=%_Arguments(1); }else{ this.elements=new InternalArray(); } this.special_string=a; } SetUpLockedPrototype(ReplaceResultBuilder, $Array("elements","special_string"),$Array( "add",function(a){ a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); if(a.length>0)this.elements.push(a); }, "addSpecialSlice",function(a,b){ var c=b-a; if(a<0||c<=0)return; if(a<0x80000&&c<0x800){ this.elements.push((a<<11)|c); }else{ var d=this.elements; d.push(-c); d.push(a); } }, "generate",function(){ var a=this.elements; return %StringBuilderConcat(a,a.length,this.special_string); } )); function SetUpString(){ %CheckIsBootstrapping(); %SetProperty($String.prototype,"constructor",$String,2); InstallFunctions($String,2,$Array( "fromCharCode",StringFromCharCode )); InstallFunctions($String.prototype,2,$Array( "valueOf",StringValueOf, "toString",StringToString, "charAt",StringCharAt, "charCodeAt",StringCharCodeAt, "concat",StringConcat, "indexOf",StringIndexOf, "lastIndexOf",StringLastIndexOf, "localeCompare",StringLocaleCompare, "match",StringMatch, "replace",StringReplace, "search",StringSearch, "slice",StringSlice, "split",StringSplit, "substring",StringSubstring, "substr",StringSubstr, "toLowerCase",StringToLowerCase, "toLocaleLowerCase",StringToLocaleLowerCase, "toUpperCase",StringToUpperCase, "toLocaleUpperCase",StringToLocaleUpperCase, "trim",StringTrim, "trimLeft",StringTrimLeft, "trimRight",StringTrimRight, "link",StringLink, "anchor",StringAnchor, "fontcolor",StringFontcolor, "fontsize",StringFontsize, "big",StringBig, "blink",StringBlink, "bold",StringBold, "fixed",StringFixed, "italics",StringItalics, "small",StringSmall, "strike",StringStrike, "sub",StringSub, "sup",StringSup )); } SetUpString(); var hexCharArray=0; var hexCharCodeArray=0; function URIAddEncodedOctetToBuffer(a,b,c){ b[c++]=37; b[c++]=hexCharCodeArray[a>>4]; b[c++]=hexCharCodeArray[a&0x0F]; return c; } function URIEncodeOctets(a,b,c){ if(hexCharCodeArray===0){ hexCharCodeArray=[48,49,50,51,52,53,54,55,56,57, 65,66,67,68,69,70]; } c=URIAddEncodedOctetToBuffer(a[0],b,c); if(a[1])c=URIAddEncodedOctetToBuffer(a[1],b,c); if(a[2])c=URIAddEncodedOctetToBuffer(a[2],b,c); if(a[3])c=URIAddEncodedOctetToBuffer(a[3],b,c); return c; } function URIEncodeSingle(a,b,c){ var d=(a>>12)&0xF; var g=(a>>6)&63; var h=a&63; var i=new $Array(3); if(a<=0x007F){ i[0]=a; }else if(a<=0x07FF){ i[0]=g+192; i[1]=h+128; }else{ i[0]=d+224; i[1]=g+128; i[2]=h+128; } return URIEncodeOctets(i,b,c); } function URIEncodePair(a,b,c,d){ var g=((a>>6)&0xF)+1; var h=(a>>2)&0xF; var i=a&3; var j=(b>>6)&0xF; var k=b&63; var l=new $Array(4); l[0]=(g>>2)+240; l[1]=(((g&3)<<4)|h)+128; l[2]=((i<<4)|j)+128; l[3]=k+128; return URIEncodeOctets(l,c,d); } function URIHexCharsToCharCode(a,b){ var c=HexValueOf(a); var d=HexValueOf(b); if(c==-1||d==-1){ throw new $URIError("URI malformed"); } return(c<<4)|d; } function URIDecodeOctets(a,b,c){ var d; var g=a[0]; if(g<0x80){ d=g; }else if(g<0xc2){ throw new $URIError("URI malformed"); }else{ var h=a[1]; if(g<0xe0){ var i=g&0x1f; if((h<0x80)||(h>0xbf)){ throw new $URIError("URI malformed"); } var j=h&0x3f; d=(i<<6)+j; if(d<0x80||d>0x7ff){ throw new $URIError("URI malformed"); } }else{ var k=a[2]; if(g<0xf0){ var i=g&0x0f; if((h<0x80)||(h>0xbf)){ throw new $URIError("URI malformed"); } var j=h&0x3f; if((k<0x80)||(k>0xbf)){ throw new $URIError("URI malformed"); } var l=k&0x3f; d=(i<<12)+(j<<6)+l; if((d<0x800)||(d>0xffff)){ throw new $URIError("URI malformed"); } }else{ var m=a[3]; if(g<0xf8){ var i=(g&0x07); if((h<0x80)||(h>0xbf)){ throw new $URIError("URI malformed"); } var j=(h&0x3f); if((k<0x80)||(k>0xbf)){ throw new $URIError("URI malformed"); } var l=(k&0x3f); if((m<0x80)||(m>0xbf)){ throw new $URIError("URI malformed"); } var o=(m&0x3f); d=(i<<18)+(j<<12)+(l<<6)+o; if((d<0x10000)||(d>0x10ffff)){ throw new $URIError("URI malformed"); } }else{ throw new $URIError("URI malformed"); } } } } if(0xD800<=d&&d<=0xDFFF){ throw new $URIError("URI malformed"); } if(d<0x10000){ b[c++]=d; return c; }else{ b[c++]=(d>>10)+0xd7c0; b[c++]=(d&0x3ff)+0xdc00; return c; } } function Encode(a,b){ var c=a.length; var d=new InternalArray(c); var g=0; for(var h=0;h=0xDC00&&i<=0xDFFF)throw new $URIError("URI malformed"); if(i<0xD800||i>0xDBFF){ g=URIEncodeSingle(i,d,g); }else{ h++; if(h==c)throw new $URIError("URI malformed"); var j=a.charCodeAt(h); if(j<0xDC00||j>0xDFFF)throw new $URIError("URI malformed"); g=URIEncodePair(i,j,d,g); } } } return %StringFromCharCodeArray(d); } function Decode(a,b){ var c=a.length; var d=new InternalArray(c); var g=0; for(var h=0;h=c)throw new $URIError("URI malformed"); var j=URIHexCharsToCharCode(a.charCodeAt(++h),a.charCodeAt(++h)); if(j>>7){ var k=0; while(((j<<++k)&0x80)!=0){} if(k==1||k>4)throw new $URIError("URI malformed"); var l=new $Array(k); l[0]=j; if(h+3*(k-1)>=c)throw new $URIError("URI malformed"); for(var m=1;m=48&&a<=57)return a-48; if(a>=65&&a<=70)return a-55; if(a>=97&&a<=102)return a-87; return-1; } function CharCodeToHex4Str(a){ var b=""; if(hexCharArray===0){ hexCharArray=["0","1","2","3","4","5","6","7","8","9", "A","B","C","D","E","F"]; } for(var c=0;c<4;++c){ var d=hexCharArray[a&0x0F]; b=d+b; a=a>>>4; } return b; } function IsValidHex(a){ for(var b=0;b=0?a:-a; if(!(typeof(a)==='number'))a=NonNumberToNumber(a); if(a===0)return 0; return a>0?a:-a; } function MathAcos(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %Math_acos(a); } function MathAsin(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %Math_asin(a); } function MathAtan(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %Math_atan(a); } function MathAtan2(a,b){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); if(!(typeof(b)==='number'))b=NonNumberToNumber(b); return %Math_atan2(a,b); } function MathCeil(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %Math_ceil(a); } function MathCos(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %_MathCos(a); } function MathExp(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %Math_exp(a); } function MathFloor(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); if(a<0x80000000&&a>0){ return(a>>>0); }else{ return %Math_floor(a); } } function MathLog(a){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); return %_MathLog(a); } function MathMax(a,b){ var c=%_ArgumentsLength(); if(c==2){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); if(!(typeof(b)==='number'))b=NonNumberToNumber(b); if(b>a)return b; if(a>b)return a; if(a==b){ return(a==0&&!%_IsSmi(a)&&1/a<0)?b:a; } return 0/0; } if(c==0){ return-1/0; } var d=a; if(!(typeof(d)==='number'))d=NonNumberToNumber(d); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return d; for(var g=1;gd||(d==0&&h==0&&!%_IsSmi(d)&&1/d<0))d=h; } return d; } function MathMin(a,b){ var c=%_ArgumentsLength(); if(c==2){ if(!(typeof(a)==='number'))a=NonNumberToNumber(a); if(!(typeof(b)==='number'))b=NonNumberToNumber(b); if(b>a)return a; if(a>b)return b; if(a==b){ return(a==0&&!%_IsSmi(a)&&1/a<0)?a:b; } return 0/0; } if(c==0){ return 1/0; } var d=a; if(!(typeof(d)==='number'))d=NonNumberToNumber(d); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return d; for(var g=1;g>>0; if(g<4){ try{ i=ToDetailString(c[g]); }catch(e){ i="#"; } } } d+=i; } return d; } function IsNativeErrorObject(a){ switch(%_ClassOf(a)){ case'Error': case'EvalError': case'RangeError': case'ReferenceError': case'SyntaxError': case'TypeError': case'URIError': return true; } return false; } function ToStringCheckErrorObject(a){ if(IsNativeErrorObject(a)){ return %_CallFunction(a,ErrorToString); }else{ return ToString(a); } } function ToDetailString(a){ if(a!=null&&(%_IsObject(a))&&a.toString===ObjectToString){ var b=a.constructor; if(typeof b=="function"){ var c=b.name; if((typeof(c)==='string')&&c!==""){ return"#<"+c+">"; } } } return ToStringCheckErrorObject(a); } function MakeGenericError(a,b,c){ if((typeof(c)==='undefined')){ c=[]; } var d=new a(kAddMessageAccessorsMarker); d.type=b; d.arguments=c; return d; } %FunctionSetInstanceClassName(Script,'Script'); %SetProperty(Script.prototype,'constructor',Script, 2|4|1); %SetCode(Script,function(a){ throw new $Error("Not supported"); }); function FormatMessage(a){ if(kMessages===0){ var b=[ "cyclic_proto",["Cyclic __proto__ value"], "code_gen_from_strings",["Code generation from strings disallowed for this context"], "unexpected_token",["Unexpected token ","%0"], "unexpected_token_number",["Unexpected number"], "unexpected_token_string",["Unexpected string"], "unexpected_token_identifier",["Unexpected identifier"], "unexpected_reserved",["Unexpected reserved word"], "unexpected_strict_reserved",["Unexpected strict mode reserved word"], "unexpected_eos",["Unexpected end of input"], "malformed_regexp",["Invalid regular expression: /","%0","/: ","%1"], "unterminated_regexp",["Invalid regular expression: missing /"], "regexp_flags",["Cannot supply flags when constructing one RegExp from another"], "incompatible_method_receiver",["Method ","%0"," called on incompatible receiver ","%1"], "invalid_lhs_in_assignment",["Invalid left-hand side in assignment"], "invalid_lhs_in_for_in",["Invalid left-hand side in for-in"], "invalid_lhs_in_postfix_op",["Invalid left-hand side expression in postfix operation"], "invalid_lhs_in_prefix_op",["Invalid left-hand side expression in prefix operation"], "multiple_defaults_in_switch",["More than one default clause in switch statement"], "newline_after_throw",["Illegal newline after throw"], "redeclaration",["%0"," '","%1","' has already been declared"], "no_catch_or_finally",["Missing catch or finally after try"], "unknown_label",["Undefined label '","%0","'"], "uncaught_exception",["Uncaught ","%0"], "stack_trace",["Stack Trace:\n","%0"], "called_non_callable",["%0"," is not a function"], "undefined_method",["Object ","%1"," has no method '","%0","'"], "property_not_function",["Property '","%0","' of object ","%1"," is not a function"], "cannot_convert_to_primitive",["Cannot convert object to primitive value"], "not_constructor",["%0"," is not a constructor"], "not_defined",["%0"," is not defined"], "non_object_property_load",["Cannot read property '","%0","' of ","%1"], "non_object_property_store",["Cannot set property '","%0","' of ","%1"], "non_object_property_call",["Cannot call method '","%0","' of ","%1"], "with_expression",["%0"," has no properties"], "illegal_invocation",["Illegal invocation"], "no_setter_in_callback",["Cannot set property ","%0"," of ","%1"," which has only a getter"], "apply_non_function",["Function.prototype.apply was called on ","%0",", which is a ","%1"," and not a function"], "apply_wrong_args",["Function.prototype.apply: Arguments list has wrong type"], "invalid_in_operator_use",["Cannot use 'in' operator to search for '","%0","' in ","%1"], "instanceof_function_expected",["Expecting a function in instanceof check, but got ","%0"], "instanceof_nonobject_proto",["Function has non-object prototype '","%0","' in instanceof check"], "null_to_object",["Cannot convert null to object"], "reduce_no_initial",["Reduce of empty array with no initial value"], "getter_must_be_callable",["Getter must be a function: ","%0"], "setter_must_be_callable",["Setter must be a function: ","%0"], "value_and_accessor",["Invalid property. A property cannot both have accessors and be writable or have a value, ","%0"], "proto_object_or_null",["Object prototype may only be an Object or null"], "property_desc_object",["Property description must be an object: ","%0"], "redefine_disallowed",["Cannot redefine property: ","%0"], "define_disallowed",["Cannot define property:","%0",", object is not extensible."], "non_extensible_proto",["%0"," is not extensible"], "handler_non_object",["Proxy.","%0"," called with non-object as handler"], "proto_non_object",["Proxy.","%0"," called with non-object as prototype"], "trap_function_expected",["Proxy.","%0"," called with non-function for '","%1","' trap"], "handler_trap_missing",["Proxy handler ","%0"," has no '","%1","' trap"], "handler_trap_must_be_callable",["Proxy handler ","%0"," has non-callable '","%1","' trap"], "handler_returned_false",["Proxy handler ","%0"," returned false from '","%1","' trap"], "handler_returned_undefined",["Proxy handler ","%0"," returned undefined from '","%1","' trap"], "proxy_prop_not_configurable",["Proxy handler ","%0"," returned non-configurable descriptor for property '","%2","' from '","%1","' trap"], "proxy_non_object_prop_names",["Trap '","%1","' returned non-object ","%0"], "proxy_repeated_prop_name",["Trap '","%1","' returned repeated property name '","%2","'"], "invalid_weakmap_key",["Invalid value used as weak map key"], "invalid_array_length",["Invalid array length"], "stack_overflow",["Maximum call stack size exceeded"], "invalid_time_value",["Invalid time value"], "unable_to_parse",["Parse error"], "invalid_regexp_flags",["Invalid flags supplied to RegExp constructor '","%0","'"], "invalid_regexp",["Invalid RegExp pattern /","%0","/"], "illegal_break",["Illegal break statement"], "illegal_continue",["Illegal continue statement"], "illegal_return",["Illegal return statement"], "illegal_let",["Illegal let declaration outside extended mode"], "error_loading_debugger",["Error loading debugger"], "no_input_to_regexp",["No input to ","%0"], "invalid_json",["String '","%0","' is not valid JSON"], "circular_structure",["Converting circular structure to JSON"], "called_on_non_object",["%0"," called on non-object"], "called_on_null_or_undefined",["%0"," called on null or undefined"], "array_indexof_not_defined",["Array.getIndexOf: Argument undefined"], "object_not_extensible",["Can't add property ","%0",", object is not extensible"], "illegal_access",["Illegal access"], "invalid_preparser_data",["Invalid preparser data for function ","%0"], "strict_mode_with",["Strict mode code may not include a with statement"], "strict_catch_variable",["Catch variable may not be eval or arguments in strict mode"], "too_many_arguments",["Too many arguments in function call (only 32766 allowed)"], "too_many_parameters",["Too many parameters in function definition (only 32766 allowed)"], "too_many_variables",["Too many variables declared (only 32767 allowed)"], "strict_param_name",["Parameter name eval or arguments is not allowed in strict mode"], "strict_param_dupe",["Strict mode function may not have duplicate parameter names"], "strict_var_name",["Variable name may not be eval or arguments in strict mode"], "strict_function_name",["Function name may not be eval or arguments in strict mode"], "strict_octal_literal",["Octal literals are not allowed in strict mode."], "strict_duplicate_property",["Duplicate data property in object literal not allowed in strict mode"], "accessor_data_property",["Object literal may not have data and accessor property with the same name"], "accessor_get_set",["Object literal may not have multiple get/set accessors with the same name"], "strict_lhs_assignment",["Assignment to eval or arguments is not allowed in strict mode"], "strict_lhs_postfix",["Postfix increment/decrement may not have eval or arguments operand in strict mode"], "strict_lhs_prefix",["Prefix increment/decrement may not have eval or arguments operand in strict mode"], "strict_reserved_word",["Use of future reserved word in strict mode"], "strict_delete",["Delete of an unqualified identifier in strict mode."], "strict_delete_property",["Cannot delete property '","%0","' of ","%1"], "strict_const",["Use of const in strict mode."], "strict_function",["In strict mode code, functions can only be declared at top level or immediately within another function."], "strict_read_only_property",["Cannot assign to read only property '","%0","' of ","%1"], "strict_cannot_assign",["Cannot assign to read only '","%0","' in strict mode"], "strict_poison_pill",["'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them"], "strict_caller",["Illegal access to a strict mode caller function."], "unprotected_let",["Illegal let declaration in unprotected statement context."], "unprotected_const",["Illegal const declaration in unprotected statement context."], "cant_prevent_ext_external_array_elements",["Cannot prevent extension of an object with external array elements"], "redef_external_array_element",["Cannot redefine a property of an object with external array elements"], "harmony_const_assign",["Assignment to constant variable."], "invalid_module_path",["Module does not export '","%0","', or export is not itself a module"], "module_type_error",["Module '","%0","' used improperly"], ]; var c={__proto__:null}; for(var d=0;d"; return FormatString(h,a); } function GetLineNumber(a){ var b=%MessageGetStartPosition(a); if(b==-1)return 0; var c=%MessageGetScript(a); var d=c.locationFromPosition(b,true); if(d==null)return 0; return d.line+1; } function GetSourceLine(a){ var b=%MessageGetScript(a); var c=%MessageGetStartPosition(a); var d=b.locationFromPosition(c,true); if(d==null)return""; d.restrict(); return d.sourceText(); } function MakeTypeError(a,b){ return MakeGenericError($TypeError,a,b); } function MakeRangeError(a,b){ return MakeGenericError($RangeError,a,b); } function MakeSyntaxError(a,b){ return MakeGenericError($SyntaxError,a,b); } function MakeReferenceError(a,b){ return MakeGenericError($ReferenceError,a,b); } function MakeEvalError(a,b){ return MakeGenericError($EvalError,a,b); } function MakeError(a,b){ return MakeGenericError($Error,a,b); } function ScriptLineFromPosition(a){ var b=0; var c=this.lineCount()-1; var d=this.line_ends; if(a>d[c]){ return-1; } if(a<=d[0]){ return 0; } while(c>=1){ var g=(b+c)>>1; if(a>d[g]){ b=g+1; }else if(a<=d[g-1]){ c=g-1; }else{ return g; } } return-1; } function ScriptLocationFromPosition(position, include_resource_offset){ var a=this.lineFromPosition(position); if(a==-1)return null; var b=this.line_ends; var c=a==0?0:b[a-1]+1; var d=b[a]; if(d>0&&%_CallFunction(this.source,d-1,StringCharAt)=='\r'){ d--; } var g=position-c; if(include_resource_offset){ a+=this.line_offset; if(a==this.line_offset){ g+=this.column_offset; } } return new SourceLocation(this,position,a,g,c,d); } function ScriptLocationFromLine(a,b,c){ var d=0; if(!(typeof(a)==='undefined')){ d=a-this.line_offset; } var g=b||0; if(d==0){ g-=this.column_offset; } var h=c||0; if(d<0||g<0||h<0)return null; if(d==0){ return this.locationFromPosition(h+g,false); }else{ var i=this.lineFromPosition(h); if(i==-1||i+d>=this.lineCount()){ return null; } return this.locationFromPosition( this.line_ends[i+d-1]+1+g); } } function ScriptSourceSlice(a,b){ var c=(typeof(a)==='undefined')?this.line_offset :a; var d=(typeof(b)==='undefined')?this.line_offset+this.lineCount() :b; c-=this.line_offset; d-=this.line_offset; if(c<0)c=0; if(d>this.lineCount())d=this.lineCount(); if(c>=this.lineCount()|| d<0|| c>d){ return null; } var g=this.line_ends; var h=c==0?0:g[c-1]+1; var i=d==0?0:g[d-1]+1; return new SourceSlice(this, c+this.line_offset, d+this.line_offset, h,i); } function ScriptSourceLine(a){ var b=0; if(!(typeof(a)==='undefined')){ b=a-this.line_offset; } if(b<0||this.lineCount()<=b){ return null; } var c=this.line_ends; var d=b==0?0:c[b-1]+1; var g=c[b]; return %_CallFunction(this.source,d,g,StringSubstring); } function ScriptLineCount(){ return this.line_ends.length; } function ScriptNameOrSourceURL(){ if(this.name){ return this.name; } if(this.hasCachedNameOrSourceURL) return this.cachedNameOrSourceURL; this.hasCachedNameOrSourceURL=true; var a=ToString(this.source); var b=%StringIndexOf(a,"sourceURL=",0); this.cachedNameOrSourceURL=this.name; if(b>4){ var c= /\/\/@[\040\t]sourceURL=[\040\t]*([^\s\'\"]*)[\040\t]*$/gm; var d=new InternalArray((3+(3))+1); var g= %_RegExpExec(c,a,b-4,d); if(g){ this.cachedNameOrSourceURL= SubString(a,d[(3+(2))],d[(3+(3))]); } } return this.cachedNameOrSourceURL; } SetUpLockedPrototype(Script, $Array("source","name","line_ends","line_offset","column_offset", "cachedNameOrSourceURL","hasCachedNameOrSourceURL"), $Array( "lineFromPosition",ScriptLineFromPosition, "locationFromPosition",ScriptLocationFromPosition, "locationFromLine",ScriptLocationFromLine, "sourceSlice",ScriptSourceSlice, "sourceLine",ScriptSourceLine, "lineCount",ScriptLineCount, "nameOrSourceURL",ScriptNameOrSourceURL ) ); function SourceLocation(a,b,c,d,g,h){ this.script=a; this.position=b; this.line=c; this.column=d; this.start=g; this.end=h; } var kLineLengthLimit=78; function SourceLocationRestrict(a,b){ var c; var d; if(!(typeof(a)==='undefined')){ c=a; }else{ c=kLineLengthLimit; } if(!(typeof(b)==='undefined')){ d=b; }else{ if(c<=20){ d=$floor(c/2); }else{ d=c-10; } } if(d>=c){ d=c-1; } if(this.end-this.start>c){ var g=this.position-d; var h=this.position+c-d; if(this.start"); } }else if(j){ g+="new "+(h||""); }else if(h){ g+=h; }else{ g+=b; i=false; } if(i){ g+=" ("+b+")"; } return g; } SetUpLockedPrototype(CallSite,$Array("receiver","fun","pos"),$Array( "getThis",CallSiteGetThis, "getTypeName",CallSiteGetTypeName, "isToplevel",CallSiteIsToplevel, "isEval",CallSiteIsEval, "getEvalOrigin",CallSiteGetEvalOrigin, "getScriptNameOrSourceURL",CallSiteGetScriptNameOrSourceURL, "getFunction",CallSiteGetFunction, "getFunctionName",CallSiteGetFunctionName, "getMethodName",CallSiteGetMethodName, "getFileName",CallSiteGetFileName, "getLineNumber",CallSiteGetLineNumber, "getColumnNumber",CallSiteGetColumnNumber, "isNative",CallSiteIsNative, "getPosition",CallSiteGetPosition, "isConstructor",CallSiteIsConstructor, "toString",CallSiteToString )); function FormatEvalOrigin(a){ var b=a.nameOrSourceURL(); if(b){ return b; } var c="eval at "; if(a.eval_from_function_name){ c+=a.eval_from_function_name; }else{ c+=""; } var d=a.eval_from_script; if(d){ if(d.compilation_type==1){ c+=" ("+FormatEvalOrigin(d)+")"; }else{ if(d.name){ c+=" ("+d.name; var g=d.locationFromPosition( a.eval_from_script_position,true); if(g){ c+=":"+(g.line+1); c+=":"+(g.column+1); } c+=")"; }else{ c+=" (unknown source)"; } } } return c; } function FormatStackTrace(a,b){ var c=[]; try{ c.push(a.toString()); }catch(e){ try{ c.push(""); }catch(ee){ c.push(""); } } for(var d=0;d"; }catch(ee){ h=""; } } c.push(" at "+h); } return c.join("\n"); } function FormatRawStackTrace(a,b){ var c=[]; for(var d=0;d10000){ c=10000; } var d=%CollectStackTrace(a, b?b:captureStackTrace, c); DefineOneShotAccessor(a,'stack',function(a){ return FormatRawStackTrace(a,d); }); } function SetUpError(){ var a=function(b){ var c=b.name; %SetProperty(global,c,b,2); %SetProperty(builtins,'$'+c,b,2|4|1); if(c=='Error'){ var d=function(){}; %FunctionSetPrototype(d,$Object.prototype); %FunctionSetInstanceClassName(d,'Error'); %FunctionSetPrototype(b,new d()); }else{ %FunctionSetPrototype(b,new $Error()); } %FunctionSetInstanceClassName(b,'Error'); %SetProperty(b.prototype,'constructor',b,2); %SetProperty(b.prototype,"name",c,2); %SetCode(b,function(g){ if(%_IsConstructCall()){ %IgnoreAttributesAndSetProperty(this,'stack',void 0,2); %IgnoreAttributesAndSetProperty(this,'arguments',void 0,2); %IgnoreAttributesAndSetProperty(this,'type',void 0,2); if(g===kAddMessageAccessorsMarker){ DefineOneShotAccessor(this,'message',function(h){ return FormatMessage(%NewMessageObject(h.type,h.arguments)); }); }else if(!(typeof(g)==='undefined')){ %IgnoreAttributesAndSetProperty( this,'message',ToString(g),2); } captureStackTrace(this,b); }else{ return new b(g); } }); %SetNativeFlag(b); }; a(function Error(){}); a(function TypeError(){}); a(function RangeError(){}); a(function SyntaxError(){}); a(function ReferenceError(){}); a(function EvalError(){}); a(function URIError(){}); } SetUpError(); $Error.captureStackTrace=captureStackTrace; %SetProperty($Error.prototype,'message','',2); var visited_errors=new InternalArray(); var cyclic_error_marker=new $Object(); function GetPropertyWithoutInvokingMonkeyGetters(a,b){ while(a&&!%HasLocalProperty(a,b)){ a=a.__proto__; } if(a===null)return void 0; if(!(%_IsObject(a)))return a[b]; var c=%GetOwnProperty(a,b); if(c&&c[0]){ var d=b==="name"; if(a===$ReferenceError.prototype) return d?"ReferenceError":void 0; if(a===$SyntaxError.prototype) return d?"SyntaxError":void 0; if(a===$TypeError.prototype) return d?"TypeError":void 0; } return a[b]; } function ErrorToStringDetectCycle(a){ if(!%PushIfAbsent(visited_errors,a))throw cyclic_error_marker; try{ var b=GetPropertyWithoutInvokingMonkeyGetters(a,"type"); var c=GetPropertyWithoutInvokingMonkeyGetters(a,"name"); c=(typeof(c)==='undefined')?"Error":((typeof(%IS_VAR(c))==='string')?c:NonStringToString(c)); var d=GetPropertyWithoutInvokingMonkeyGetters(a,"message"); var g=%_CallFunction(a,"message",ObjectHasOwnProperty); if(b&&!g){ var h=GetPropertyWithoutInvokingMonkeyGetters(a,"arguments"); d=FormatMessage(%NewMessageObject(b,h)); } d=(typeof(d)==='undefined')?"":((typeof(%IS_VAR(d))==='string')?d:NonStringToString(d)); if(c==="")return d; if(d==="")return c; return c+": "+d; }finally{ visited_errors.length=visited_errors.length-1; } } function ErrorToString(){ if(!(%_IsSpecObject(this))){ throw MakeTypeError("called_on_non_object",["Error.prototype.toString"]); } try{ return ErrorToStringDetectCycle(this); }catch(e){ if(e===cyclic_error_marker){ return''; } throw e; } } InstallFunctions($Error.prototype,2,['toString',ErrorToString]); var kStackOverflowBoilerplate=MakeRangeError('stack_overflow',[]); function CreateDate(a){ var b=new $Date(); b.setTime(a); return b; } var kApiFunctionCache={}; var functionCache=kApiFunctionCache; function Instantiate(a,b){ if(!%IsTemplate(a))return a; var c=%GetTemplateField(a,0); switch(c){ case 0: return InstantiateFunction(a,b); case 1: var d=%GetTemplateField(a,2); var g=typeof d==='undefined'? {}:new(Instantiate(d))(); ConfigureTemplateInstance(g,a); g=%ToFastProperties(g); return g; default: throw'Unknown API tag <'+c+'>'; } } function InstantiateFunction(a,b){ var c=kApiFunctionCache; var d=%GetTemplateField(a,2); var g= (d in c)&&(c[d]!=-1); if(!g){ try{ c[d]=null; var h=%CreateApiFunction(a); if(b)%FunctionSetName(h,b); c[d]=h; var i=%GetTemplateField(a,5); var j=%GetTemplateField(a,14); h.prototype=typeof i==='undefined'? {}:Instantiate(i); if(j&(1<<3)){ %FunctionSetReadOnlyPrototype(h); } %SetProperty(h.prototype,"constructor",h,2); var k=%GetTemplateField(a,6); if(!(typeof k==='undefined')){ var l=Instantiate(k); h.prototype.__proto__=l.prototype; } ConfigureTemplateInstance(h,a); }catch(e){ c[d]=-1; throw e; } } return c[d]; } function ConfigureTemplateInstance(a,b){ var c=%GetTemplateField(b,1); if(c){ var d=%DisableAccessChecks(a); try{ for(var g=0;g0){ this.ignoreCount_--; return false; } return true; }; function IsBreakPointTriggered(a,b){ return b.isTriggered(MakeExecutionState(a)); } function ScriptBreakPoint(type,script_id_or_name,opt_line,opt_column, opt_groupId){ this.type_=type; if(type==Debug.ScriptBreakPointType.ScriptId){ this.script_id_=script_id_or_name; }else if(type==Debug.ScriptBreakPointType.ScriptName){ this.script_name_=script_id_or_name; }else if(type==Debug.ScriptBreakPointType.ScriptRegExp){ this.script_regexp_object_=new RegExp(script_id_or_name); }else{ throw new Error("Unexpected breakpoint type "+type); } this.line_=opt_line||0; this.column_=opt_column; this.groupId_=opt_groupId; this.hit_count_=0; this.active_=true; this.condition_=null; this.ignoreCount_=0; this.break_points_=[]; } ScriptBreakPoint.prototype.cloneForOtherScript=function(a){ var b=new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, a.id,this.line_,this.column_,this.groupId_); b.number_=next_break_point_number++; script_break_points.push(b); b.hit_count_=this.hit_count_; b.active_=this.active_; b.condition_=this.condition_; b.ignoreCount_=this.ignoreCount_; return b; }; ScriptBreakPoint.prototype.number=function(){ return this.number_; }; ScriptBreakPoint.prototype.groupId=function(){ return this.groupId_; }; ScriptBreakPoint.prototype.type=function(){ return this.type_; }; ScriptBreakPoint.prototype.script_id=function(){ return this.script_id_; }; ScriptBreakPoint.prototype.script_name=function(){ return this.script_name_; }; ScriptBreakPoint.prototype.script_regexp_object=function(){ return this.script_regexp_object_; }; ScriptBreakPoint.prototype.line=function(){ return this.line_; }; ScriptBreakPoint.prototype.column=function(){ return this.column_; }; ScriptBreakPoint.prototype.actual_locations=function(){ var a=[]; for(var b=0;b=this.frameCount()){ throw new Error('Illegal frame index.'); } return new FrameMirror(this.break_id,a); }; ExecutionState.prototype.setSelectedFrame=function(a){ var b=%ToNumber(a); if(b<0||b>=this.frameCount())throw new Error('Illegal frame index.'); this.selected_frame=b; }; ExecutionState.prototype.selectedFrame=function(){ return this.selected_frame; }; ExecutionState.prototype.debugCommandProcessor=function(a){ return new DebugCommandProcessor(this,a); }; function MakeBreakEvent(a,b){ return new BreakEvent(a,b); } function BreakEvent(a,b){ this.exec_state_=a; this.break_points_hit_=b; } BreakEvent.prototype.executionState=function(){ return this.exec_state_; }; BreakEvent.prototype.eventType=function(){ return Debug.DebugEvent.Break; }; BreakEvent.prototype.func=function(){ return this.exec_state_.frame(0).func(); }; BreakEvent.prototype.sourceLine=function(){ return this.exec_state_.frame(0).sourceLine(); }; BreakEvent.prototype.sourceColumn=function(){ return this.exec_state_.frame(0).sourceColumn(); }; BreakEvent.prototype.sourceLineText=function(){ return this.exec_state_.frame(0).sourceLineText(); }; BreakEvent.prototype.breakPointsHit=function(){ return this.break_points_hit_; }; BreakEvent.prototype.toJSONProtocol=function(){ var a={seq:next_response_seq++, type:"event", event:"break", body:{invocationText:this.exec_state_.frame(0).invocationText(), } }; var b=this.func().script(); if(b){ a.body.sourceLine=this.sourceLine(), a.body.sourceColumn=this.sourceColumn(), a.body.sourceLineText=this.sourceLineText(), a.body.script=MakeScriptObject_(b,false); } if(this.breakPointsHit()){ a.body.breakpoints=[]; for(var c=0;c0){ a.body.sourceLine=this.sourceLine(); a.body.sourceColumn=this.sourceColumn(); a.body.sourceLineText=this.sourceLineText(); var b=this.func().script(); if(b){ a.body.script=MakeScriptObject_(b,false); } }else{ a.body.sourceLine=-1; } return a.toJSONProtocol(); }; function MakeCompileEvent(a,b,c){ return new CompileEvent(a,b,c); } function CompileEvent(a,b,c){ this.exec_state_=a; this.script_=MakeMirror(b); this.before_=c; } CompileEvent.prototype.executionState=function(){ return this.exec_state_; }; CompileEvent.prototype.eventType=function(){ if(this.before_){ return Debug.DebugEvent.BeforeCompile; }else{ return Debug.DebugEvent.AfterCompile; } }; CompileEvent.prototype.script=function(){ return this.script_; }; CompileEvent.prototype.toJSONProtocol=function(){ var a=new ProtocolMessage(); a.running=true; if(this.before_){ a.event="beforeCompile"; }else{ a.event="afterCompile"; } a.body={}; a.body.script=this.script_; return a.toJSONProtocol(); }; function MakeNewFunctionEvent(a){ return new NewFunctionEvent(a); } function NewFunctionEvent(a){ this.func=a; } NewFunctionEvent.prototype.eventType=function(){ return Debug.DebugEvent.NewFunction; }; NewFunctionEvent.prototype.name=function(){ return this.func.name; }; NewFunctionEvent.prototype.setBreakPoint=function(a){ Debug.setBreakPoint(this.func,a||0); }; function MakeScriptCollectedEvent(a,b){ return new ScriptCollectedEvent(a,b); } function ScriptCollectedEvent(a,b){ this.exec_state_=a; this.id_=b; } ScriptCollectedEvent.prototype.id=function(){ return this.id_; }; ScriptCollectedEvent.prototype.executionState=function(){ return this.exec_state_; }; ScriptCollectedEvent.prototype.toJSONProtocol=function(){ var a=new ProtocolMessage(); a.running=true; a.event="scriptCollected"; a.body={}; a.body.script={id:this.id()}; return a.toJSONProtocol(); }; function MakeScriptObject_(a,b){ var c={id:a.id(), name:a.name(), lineOffset:a.lineOffset(), columnOffset:a.columnOffset(), lineCount:a.lineCount(), }; if(!(typeof(a.data())==='undefined')){ c.data=a.data(); } if(b){ c.source=a.source(); } return c; } function DebugCommandProcessor(a,b){ this.exec_state_=a; this.running_=b||false; } DebugCommandProcessor.prototype.processDebugRequest=function(a){ return this.processDebugJSONRequest(a); }; function ProtocolMessage(a){ this.seq=next_response_seq++; if(a){ this.type='response'; this.request_seq=a.seq; this.command=a.command; }else{ this.type='event'; } this.success=true; this.running=undefined; } ProtocolMessage.prototype.setOption=function(a,b){ if(!this.options_){ this.options_={}; } this.options_[a]=b; }; ProtocolMessage.prototype.failed=function(a){ this.success=false; this.message=a; }; ProtocolMessage.prototype.toJSONProtocol=function(){ var a={}; a.seq=this.seq; if(this.request_seq){ a.request_seq=this.request_seq; } a.type=this.type; if(this.event){ a.event=this.event; } if(this.command){ a.command=this.command; } if(this.success){ a.success=this.success; }else{ a.success=false; } if(this.body){ var b; var c=MakeMirrorSerializer(true,this.options_); if(this.body instanceof Mirror){ b=c.serializeValue(this.body); }else if(this.body instanceof Array){ b=[]; for(var d=0;d=this.exec_state_.frameCount()){ return b.failed('Invalid frame "'+d+'"'); } b.body=this.exec_state_.frame(o).evaluate( c,Boolean(h),j); return; }else{ b.body=this.exec_state_.frame().evaluate( c,Boolean(h),j); return; } }; DebugCommandProcessor.prototype.getobjRequest_=function(a,b){ if(!a.arguments){ return b.failed('Missing arguments'); } var c=a.arguments.obj_id; if((typeof(c)==='undefined')){ return b.failed('Argument "obj_id" missing'); } b.body=MakeMirror(%GetLOLObj(c)); }; DebugCommandProcessor.prototype.lookupRequest_=function(a,b){ if(!a.arguments){ return b.failed('Missing arguments'); } var c=a.arguments.handles; if((typeof(c)==='undefined')){ return b.failed('Argument "handles" missing'); } if(!(typeof(a.arguments.includeSource)==='undefined')){ includeSource=%ToBoolean(a.arguments.includeSource); b.setOption('includeSource',includeSource); } var d={}; for(var g=0;g=this.exec_state_.frameCount()){ return b.failed('Invalid frame "'+g+'"'); } g=this.exec_state_.frame(h); } } var i=g.func().script(); if(!i){ return b.failed('No source'); } var j=i.sourceSlice(c,d); if(!j){ return b.failed('Invalid line interval'); } b.body={}; b.body.source=j.sourceText(); b.body.fromLine=j.from_line; b.body.toLine=j.to_line; b.body.fromPosition=j.from_position; b.body.toPosition=j.to_position; b.body.totalLines=i.lineCount(); }; DebugCommandProcessor.prototype.scriptsRequest_=function(a,b){ var c=ScriptTypeFlag(Debug.ScriptType.Normal); var d=false; var g=null; if(a.arguments){ if(!(typeof(a.arguments.types)==='undefined')){ c=%ToNumber(a.arguments.types); if(isNaN(c)||c<0){ return b.failed('Invalid types "'+ a.arguments.types+'"'); } } if(!(typeof(a.arguments.includeSource)==='undefined')){ d=%ToBoolean(a.arguments.includeSource); b.setOption('includeSource',d); } if((%_IsArray(a.arguments.ids))){ g={}; var h=a.arguments.ids; for(var i=0;i=0){ q=true; } } if(!q)continue; } if(c&ScriptTypeFlag(m[i].type)){ b.body.push(MakeMirror(m[i])); } } }; DebugCommandProcessor.prototype.threadsRequest_=function(a,b){ var c=this.exec_state_.threadCount(); var d=[]; for(var g=0;g>>4; } return b; } function ObjectToProtocolObject_(a,b){ var c={}; for(var d in a){ if(typeof d=='string'){ var g=ValueToProtocolValue_(a[d], b); if(!(typeof(g)==='undefined')){ c[d]=g; } } } return c; } function ArrayToProtocolArray_(a,b){ var c=[]; for(var d=0;d"; }; function ValueMirror(a,b,c){ %_CallFunction(this,a,Mirror); this.value_=b; if(!c){ this.allocateHandle_(); }else{ this.allocateTransientHandle_(); } } inherits(ValueMirror,Mirror); Mirror.prototype.handle=function(){ return this.handle_; }; ValueMirror.prototype.isPrimitive=function(){ var a=this.type(); return a==='undefined'|| a==='null'|| a==='boolean'|| a==='number'|| a==='string'; }; ValueMirror.prototype.value=function(){ return this.value_; }; function UndefinedMirror(){ %_CallFunction(this,UNDEFINED_TYPE,void 0,ValueMirror); } inherits(UndefinedMirror,ValueMirror); UndefinedMirror.prototype.toText=function(){ return'undefined'; }; function NullMirror(){ %_CallFunction(this,NULL_TYPE,null,ValueMirror); } inherits(NullMirror,ValueMirror); NullMirror.prototype.toText=function(){ return'null'; }; function BooleanMirror(a){ %_CallFunction(this,BOOLEAN_TYPE,a,ValueMirror); } inherits(BooleanMirror,ValueMirror); BooleanMirror.prototype.toText=function(){ return this.value_?'true':'false'; }; function NumberMirror(a){ %_CallFunction(this,NUMBER_TYPE,a,ValueMirror); } inherits(NumberMirror,ValueMirror); NumberMirror.prototype.toText=function(){ return %NumberToString(this.value_); }; function StringMirror(a){ %_CallFunction(this,STRING_TYPE,a,ValueMirror); } inherits(StringMirror,ValueMirror); StringMirror.prototype.length=function(){ return this.value_.length; }; StringMirror.prototype.getTruncatedValue=function(a){ if(a!=-1&&this.length()>a){ return this.value_.substring(0,a)+ '... (length: '+this.length()+')'; } return this.value_; }; StringMirror.prototype.toText=function(){ return this.getTruncatedValue(kMaxProtocolStringLength); }; function ObjectMirror(a,b,c){ %_CallFunction(this,b||OBJECT_TYPE,a,c,ValueMirror); } inherits(ObjectMirror,ValueMirror); ObjectMirror.prototype.className=function(){ return %_ClassOf(this.value_); }; ObjectMirror.prototype.constructorFunction=function(){ return MakeMirror(%DebugGetProperty(this.value_,'constructor')); }; ObjectMirror.prototype.prototypeObject=function(){ return MakeMirror(%DebugGetProperty(this.value_,'prototype')); }; ObjectMirror.prototype.protoObject=function(){ return MakeMirror(%DebugGetPrototype(this.value_)); }; ObjectMirror.prototype.primitiveValue=function(){ if(!(%_ClassOf(this.value_)==='String')&&!(%_ClassOf(this.value_)==='Number')&& !(%_ClassOf(this.value_)==='Boolean')){ return void 0; } var a=%_ValueOf(this.value_); if((typeof(a)==='undefined')){ return void 0; } return MakeMirror(a); }; ObjectMirror.prototype.hasNamedInterceptor=function(){ var a=%GetInterceptorInfo(this.value_); return(a&2)!=0; }; ObjectMirror.prototype.hasIndexedInterceptor=function(){ var a=%GetInterceptorInfo(this.value_); return(a&1)!=0; }; ObjectMirror.prototype.propertyNames=function(a,b){ a=a||PropertyKind.Named|PropertyKind.Indexed; var c; var d; var g=0; if(a&PropertyKind.Named){ c=%GetLocalPropertyNames(this.value_); g+=c.length; if(this.hasNamedInterceptor()&&(a&PropertyKind.Named)){ var h= %GetNamedInterceptorPropertyNames(this.value_); if(h){ c=c.concat(h); g+=h.length; } } } if(a&PropertyKind.Indexed){ d=%GetLocalElementNames(this.value_); g+=d.length; if(this.hasIndexedInterceptor()&&(a&PropertyKind.Indexed)){ var i= %GetIndexedInterceptorElementNames(this.value_); if(i){ d=d.concat(i); g+=i.length; } } } b=Math.min(b||g,g); var j=new Array(b); var k=0; if(a&PropertyKind.Named){ for(var l=0;k'; }; function FunctionMirror(a){ %_CallFunction(this,a,FUNCTION_TYPE,ObjectMirror); this.resolved_=true; } inherits(FunctionMirror,ObjectMirror); FunctionMirror.prototype.resolved=function(){ return this.resolved_; }; FunctionMirror.prototype.name=function(){ return %FunctionGetName(this.value_); }; FunctionMirror.prototype.inferredName=function(){ return %FunctionGetInferredName(this.value_); }; FunctionMirror.prototype.source=function(){ if(this.resolved()){ return builtins.FunctionSourceString(this.value_); } }; FunctionMirror.prototype.script=function(){ if(this.resolved()){ var a=%FunctionGetScript(this.value_); if(a){ return MakeMirror(a); } } }; FunctionMirror.prototype.sourcePosition_=function(){ if(this.resolved()){ return %FunctionGetScriptSourcePosition(this.value_); } }; FunctionMirror.prototype.sourceLocation=function(){ if(this.resolved()&&this.script()){ return this.script().locationFromPosition(this.sourcePosition_(), true); } }; FunctionMirror.prototype.constructedBy=function(a){ if(this.resolved()){ var b=%DebugConstructedBy(this.value_,a||0); for(var c=0;cb)return new Array(); var c=new Array(b-a+1); for(var d=a;d<=b;d++){ var g=%DebugGetPropertyDetails(this.value_,%ToString(d)); var h; if(g){ h=new PropertyMirror(this,d,g); }else{ h=GetUndefinedMirror(); } c[d-a]=h; } return c; }; function DateMirror(a){ %_CallFunction(this,a,ObjectMirror); } inherits(DateMirror,ObjectMirror); DateMirror.prototype.toText=function(){ var a=JSON.stringify(this.value_); return a.substring(1,a.length-1); }; function RegExpMirror(a){ %_CallFunction(this,a,REGEXP_TYPE,ObjectMirror); } inherits(RegExpMirror,ObjectMirror); RegExpMirror.prototype.source=function(){ return this.value_.source; }; RegExpMirror.prototype.global=function(){ return this.value_.global; }; RegExpMirror.prototype.ignoreCase=function(){ return this.value_.ignoreCase; }; RegExpMirror.prototype.multiline=function(){ return this.value_.multiline; }; RegExpMirror.prototype.toText=function(){ return"/"+this.source()+"/"; }; function ErrorMirror(a){ %_CallFunction(this,a,ERROR_TYPE,ObjectMirror); } inherits(ErrorMirror,ObjectMirror); ErrorMirror.prototype.message=function(){ return this.value_.message; }; ErrorMirror.prototype.toText=function(){ var a; try{ str=%_CallFunction(this.value_,builtins.ErrorToString); }catch(e){ str='#'; } return str; }; function PropertyMirror(a,b,c){ %_CallFunction(this,PROPERTY_TYPE,Mirror); this.mirror_=a; this.name_=b; this.value_=c[0]; this.details_=c[1]; if(c.length>2){ this.exception_=c[2]; this.getter_=c[3]; this.setter_=c[4]; } } inherits(PropertyMirror,Mirror); PropertyMirror.prototype.isReadOnly=function(){ return(this.attributes()&PropertyAttribute.ReadOnly)!=0; }; PropertyMirror.prototype.isEnum=function(){ return(this.attributes()&PropertyAttribute.DontEnum)==0; }; PropertyMirror.prototype.canDelete=function(){ return(this.attributes()&PropertyAttribute.DontDelete)==0; }; PropertyMirror.prototype.name=function(){ return this.name_; }; PropertyMirror.prototype.isIndexed=function(){ for(var a=0;a0; }; FrameDetails.prototype.inlinedFrameIndex=function(){ %CheckExecutionState(this.break_id_); var a=kFrameDetailsFlagInlinedFrameIndexMask; return(this.details_[kFrameDetailsFlagsIndex]&a)>>2; }; FrameDetails.prototype.argumentCount=function(){ %CheckExecutionState(this.break_id_); return this.details_[kFrameDetailsArgumentCountIndex]; }; FrameDetails.prototype.argumentName=function(a){ %CheckExecutionState(this.break_id_); if(a>=0&&a=0&&a=0&&a=0&&a0){ for(var c=0;c0){ a+=this.lineOffset(); a+='-'; a+=this.lineOffset()+this.lineCount()-1; }else{ a+=this.lineCount(); } a+=')'; return a; }; function ContextMirror(a){ %_CallFunction(this,CONTEXT_TYPE,Mirror); this.data_=a; this.allocateHandle_(); } inherits(ContextMirror,Mirror); ContextMirror.prototype.data=function(){ return this.data_; }; function MakeMirrorSerializer(a,b){ return new JSONProtocolSerializer(a,b); } function JSONProtocolSerializer(a,b){ this.details_=a; this.options_=b; this.mirrors_=[]; } JSONProtocolSerializer.prototype.serializeReference=function(a){ return this.serialize_(a,true,true); }; JSONProtocolSerializer.prototype.serializeValue=function(a){ var b=this.serialize_(a,false,true); return b; }; JSONProtocolSerializer.prototype.serializeReferencedObjects=function(){ var a=[]; var b=this.mirrors_.length; for(var c=0;cthis.maxStringLength_()){ var b=mirror.getTruncatedValue(this.maxStringLength_()); a.value=b; a.fromIndex=0; a.toIndex=this.maxStringLength_(); }else{ a.value=mirror.value(); } a.length=mirror.length(); break; case OBJECT_TYPE: case FUNCTION_TYPE: case ERROR_TYPE: case REGEXP_TYPE: this.serializeObject_(mirror,a,details); break; case PROPERTY_TYPE: throw new Error('PropertyMirror cannot be serialized independeltly'); break; case FRAME_TYPE: this.serializeFrame_(mirror,a); break; case SCOPE_TYPE: this.serializeScope_(mirror,a); break; case SCRIPT_TYPE: if(mirror.name()){ a.name=mirror.name(); } a.id=mirror.id(); a.lineOffset=mirror.lineOffset(); a.columnOffset=mirror.columnOffset(); a.lineCount=mirror.lineCount(); if(mirror.data()){ a.data=mirror.data(); } if(this.includeSource_()){ a.source=mirror.source(); }else{ var c=mirror.source().substring(0,80); a.sourceStart=c; } a.sourceLength=mirror.source().length; a.scriptType=mirror.scriptType(); a.compilationType=mirror.compilationType(); if(mirror.compilationType()==1&& mirror.evalFromScript()){ a.evalFromScript= this.serializeReference(mirror.evalFromScript()); var d=mirror.evalFromLocation(); if(d){ a.evalFromLocation={line:d.line, column:d.column}; } if(mirror.evalFromFunctionName()){ a.evalFromFunctionName=mirror.evalFromFunctionName(); } } if(mirror.context()){ a.context=this.serializeReference(mirror.context()); } break; case CONTEXT_TYPE: a.data=mirror.data(); break; } a.text=mirror.toText(); return a; }; JSONProtocolSerializer.prototype.serializeObject_=function(mirror,content, details){ content.className=mirror.className(); content.constructorFunction= this.serializeReference(mirror.constructorFunction()); content.protoObject=this.serializeReference(mirror.protoObject()); content.prototypeObject=this.serializeReference(mirror.prototypeObject()); var a=mirror.primitiveValue(); if(!(typeof(a)==='undefined')){ content.primitiveValue=this.serializeReference(a); } if(mirror.hasNamedInterceptor()){ content.namedInterceptor=true; } if(mirror.hasIndexedInterceptor()){ content.indexedInterceptor=true; } if(mirror.isFunction()){ content.name=mirror.name(); if(!(typeof(mirror.inferredName())==='undefined')){ content.inferredName=mirror.inferredName(); } content.resolved=mirror.resolved(); if(mirror.resolved()){ content.source=mirror.source(); } if(mirror.script()){ content.script=this.serializeReference(mirror.script()); content.scriptId=mirror.script().id(); serializeLocationFields(mirror.sourceLocation(),content); } content.scopes=[]; for(var b=0;b0){ return'Infinity'; }else{ return'-Infinity'; } } return a; } Debug.LiveEdit=new function(){ var a; function ApplyPatchMultiChunk(script,diff_array,new_source,preview_only, change_log){ var b=script.source; var c=GatherCompileInfo(b,script); var d=BuildCodeInfoTree(c); var g=new PosTranslator(diff_array); MarkChangedFunctions(d,g.GetChunks()); FindLiveSharedInfos(d,script); var h; try{ h=GatherCompileInfo(new_source,script); }catch(e){ throw new Failure("Failed to compile new version of script: "+e); } var i=BuildCodeInfoTree(h); FindCorrespondingFunctions(d,i); var j=new Array(); var k=new Array(); var l=new Array(); var m=new Array(); function HarvestTodo(o){ function CollectDamaged(q){ k.push(q); for(var r=0;rM[A].start_position){ O=A; } } if(O!=r){ var P=M[O]; var Q=N[O]; M[O]=M[r]; N[O]=N[r]; M[r]=P; N[r]=Q; } } var R=0; function ResetIndexes(S,T){ var U=-1; while(R=aJ.pos1+aJ.len1){ return aD+aJ.pos2+aJ.len2-aJ.pos1-aJ.len1; } if(!aE){ aE=PosTranslator.DefaultInsideChunkHandler; } return aE(aD,aJ); }; PosTranslator.DefaultInsideChunkHandler=function(aD,aK){ Assert(false,"Cannot translate position in changed area"); }; PosTranslator.ShiftWithTopInsideChunkHandler= function(aD,aK){ return aD-aK.pos1+aK.pos2; }; var a={ UNCHANGED:"unchanged", SOURCE_CHANGED:"source changed", CHANGED:"changed", DAMAGED:"damaged" }; function CodeInfoTreeNode(aL,aM,aN){ this.info=aL; this.children=aM; this.array_index=aN; this.parent=void 0; this.status=a.UNCHANGED; this.status_explanation=void 0; this.new_start_pos=void 0; this.new_end_pos=void 0; this.corresponding_node=void 0; this.unmatched_new_nodes=void 0; this.textual_corresponding_node=void 0; this.textually_unmatched_new_nodes=void 0; this.live_shared_function_infos=void 0; } function BuildCodeInfoTree(aO){ var aP=0; function BuildNode(){ var aQ=aP; aP++; var aR=new Array(); while(aP=ax.length;}; this.TranslatePos=function(aD){return aD+aW;}; }; function ProcessInternals(aX){ aX.new_start_pos=aU.TranslatePos( aX.info.start_position); var aY=0; var aZ=false; var ba=false; while(!aU.done()&& aU.current().pos1= aU.current().pos1+aU.current().len1){ aZ=true; aU.next(); continue; }else if(bb.info.start_position<=aU.current().pos1&& bb.info.end_position>=aU.current().pos1+ aU.current().len1){ ProcessInternals(bb); ba=ba|| (bb.status!=a.UNCHANGED); aZ=aZ|| (bb.status==a.DAMAGED); aY++; continue; }else{ aZ=true; bb.status=a.DAMAGED; bb.status_explanation= "Text diff overlaps with function boundary"; aY++; continue; } }else{ if(aU.current().pos1+aU.current().len1<= aX.info.end_position){ aX.status=a.CHANGED; aU.next(); continue; }else{ aX.status=a.DAMAGED; aX.status_explanation= "Text diff overlaps with function boundary"; return; } } Assert("Unreachable",false); } while(aY0){ return bo; } } function TraverseTree(q){ q.live_shared_function_infos=FindFunctionInfos(q.info); for(var r=0;r0){ X.push({dropped_from_stack:bC}); } if(bB.length>0){ X.push({functions_on_stack:bB}); throw new Failure("Blocked by functions on stack"); } return bC.length; } var bx={ AVAILABLE_FOR_PATCH:1, BLOCKED_ON_ACTIVE_STACK:2, BLOCKED_ON_OTHER_STACK:3, BLOCKED_UNDER_NATIVE_CODE:4, REPLACED_ON_ACTIVE_STACK:5 }; bx.SymbolName=function(bF){ var bG=bx; for(name in bG){ if(bG[name]==bF){ return name; } } }; function Failure(ar){ this.message=ar; } this.Failure=Failure; Failure.prototype.toString=function(){ return"LiveEdit Failure: "+this.message; }; function GetPcFromSourcePos(bH,bI){ return %GetFunctionCodePositionFromSource(bH,bI); } this.GetPcFromSourcePos=GetPcFromSourcePos; function SetScriptSource(K,bJ,bK,X){ var b=K.source; var bL=CompareStrings(b,bJ); return ApplyPatchMultiChunk(K,bL,bJ,bK, X); } this.SetScriptSource=SetScriptSource; function CompareStrings(bM,bN){ return %LiveEditCompareStrings(bM,bN); } function ApplySingleChunkPatch(K,change_pos,change_len,new_str, X){ var b=K.source; var bJ=b.substring(0,change_pos)+ new_str+b.substring(change_pos+change_len); return ApplyPatchMultiChunk(K, [change_pos,change_pos+change_len,change_pos+new_str.length], bJ,false,X); } function DescribeChangeTree(bc){ function ProcessOldNode(q){ var bO=[]; for(var r=0;r1000000|| b<-10000000||b>10000000){ return $NaN; } return %DateMakeDay(a,b)+c-1; } function MakeDate(a,b){ var b=a*86400000+b; if($abs(b)>8640002592000000)return $NaN; return b; } function TimeClip(a){ if(!$isFinite(a))return $NaN; if($abs(a)>8640000000000000)return $NaN; return(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); } var Date_cache={ time:$NaN, string:null }; %SetCode($Date,function(a,b,c,d,g,h,i){ if(!%_IsConstructCall()){ return(new $Date()).toString(); } var j=%_ArgumentsLength(); var k; if(j==0){ k=%DateCurrentTime(); (%DateSetValue(this,k,1)); }else if(j==1){ if((typeof(a)==='number')){ k=a; }else if((typeof(a)==='string')){ var l=Date_cache; if(l.string===a){ k=l.time; }else{ k=DateParse(a); if(!(!%_IsSmi(%IS_VAR(k))&&!(k==k))){ l.time=k; l.string=a; } } }else{ var m=ToPrimitive(a,1); k=(typeof(m)==='string')?DateParse(m):ToNumber(m); } (%DateSetValue(this,k,1)); }else{ a=ToNumber(a); b=ToNumber(b); c=j>2?ToNumber(c):1; d=j>3?ToNumber(d):0; g=j>4?ToNumber(g):0; h=j>5?ToNumber(h):0; i=j>6?ToNumber(i):0; a=(!(!%_IsSmi(%IS_VAR(a))&&!(a==a))&& 0<=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))&& (%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))<=99)?1900+(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))):a; var o=MakeDay(a,b,c); var m=MakeTime(d,g,h,i); k=MakeDate(o,m); (%DateSetValue(this,k,0)); } }); %FunctionSetPrototype($Date,new $Date($NaN)); var WeekDays=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var Months=['Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec']; function TwoDigitString(a){ return a<10?"0"+a:""+a; } function DateString(a){ return WeekDays[(%_DateField(a,4))]+' ' +Months[(%_DateField(a,2))]+' ' +TwoDigitString((%_DateField(a,3)))+' ' +(%_DateField(a,1)); } var LongWeekDays=['Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday']; var LongMonths=['January','February','March','April','May','June', 'July','August','September','October','November','December']; function LongDateString(a){ return LongWeekDays[(%_DateField(a,4))]+', ' +LongMonths[(%_DateField(a,2))]+' ' +TwoDigitString((%_DateField(a,3)))+', ' +(%_DateField(a,1)); } function TimeString(a){ return TwoDigitString((%_DateField(a,5)))+':' +TwoDigitString((%_DateField(a,6)))+':' +TwoDigitString((%_DateField(a,7))); } function TimeStringUTC(a){ return TwoDigitString((%_DateField(a,15)))+':' +TwoDigitString((%_DateField(a,16)))+':' +TwoDigitString((%_DateField(a,17))); } function LocalTimezoneString(a){ var b=LocalTimezone((%_DateField(a,0))); var c=-(%_DateField(a,21)); var d=(c>=0)?1:-1; var g=$floor((d*c)/60); var h=$floor((d*c)%60); var i=' GMT'+((d==1)?'+':'-')+ TwoDigitString(g)+TwoDigitString(h); return i+' ('+b+')'; } function DatePrintString(a){ return DateString(a)+' '+TimeString(a); } var parse_buffer=$Array(8); function DateParse(a){ var b=%DateParseString(ToString(a),parse_buffer); if((b===null))return $NaN; var c=MakeDay(b[0],b[1],b[2]); var d=MakeTime(b[3],b[4],b[5],b[6]); var g=MakeDate(c,d); if((b[7]===null)){ return TimeClip(UTC(g)); }else{ return TimeClip(g-b[7]*1000); } } function DateUTC(a,b,c,d,g,h,i){ a=ToNumber(a); b=ToNumber(b); var j=%_ArgumentsLength(); c=j>2?ToNumber(c):1; d=j>3?ToNumber(d):0; g=j>4?ToNumber(g):0; h=j>5?ToNumber(h):0; i=j>6?ToNumber(i):0; a=(!(!%_IsSmi(%IS_VAR(a))&&!(a==a))&& 0<=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))&& (%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))<=99)?1900+(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))):a; var k=MakeDay(a,b,c); var l=MakeTime(d,g,h,i); return TimeClip(MakeDate(k,l)); } function DateNow(){ return %DateCurrentTime(); } function DateToString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)) if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; var b=LocalTimezoneString(this) return DatePrintString(this)+b; } function DateToDateString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; return DateString(this); } function DateToTimeString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; var b=LocalTimezoneString(this); return TimeString(this)+b; } function DateToLocaleString(){ return %_CallFunction(this,DateToString); } function DateToLocaleDateString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; return LongDateString(this); } function DateToLocaleTimeString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; return TimeString(this); } function DateValueOf(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,0)); } function DateGetTime(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,0)); } function DateGetFullYear(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,1)); } function DateGetUTCFullYear(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,11)); } function DateGetMonth(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,2)); } function DateGetUTCMonth(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,12)); } function DateGetDate(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,3)); } function DateGetUTCDate(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,13)); } function DateGetDay(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,4)); } function DateGetUTCDay(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,14)); } function DateGetHours(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,5)); } function DateGetUTCHours(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,15)); } function DateGetMinutes(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,6)); } function DateGetUTCMinutes(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,16)); } function DateGetSeconds(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,7)); } function DateGetUTCSeconds(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,17)) } function DateGetMilliseconds(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,8)); } function DateGetUTCMilliseconds(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,18)); } function DateGetTimezoneOffset(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,21)); } function DateSetTime(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); (%DateSetValue(this,ToNumber(a),1)); return(%_DateField(this,0)); } function DateSetMilliseconds(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var b=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); var c=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),(%_DateField(this,7)),a); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),c),0)); } function DateSetUTCMilliseconds(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var b=(%_DateField(this,0)); a=ToNumber(a); var c=MakeTime((%_DateField(this,15)), (%_DateField(this,16)), (%_DateField(this,17)), a); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),c),1)); } function DateSetSeconds(a,b){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var c=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); b=%_ArgumentsLength()<2?(%_DateField(this,8)):ToNumber(b); var d=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),a,b); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),d),0)); } function DateSetUTCSeconds(a,b){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var c=(%_DateField(this,0)); a=ToNumber(a); b=%_ArgumentsLength()<2?(%_DateField(this,18)):ToNumber(b); var d=MakeTime((%_DateField(this,15)),(%_DateField(this,16)),a,b); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),d),1)); } function DateSetMinutes(a,b,c){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var d=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); var g=%_ArgumentsLength(); b=g<2?(%_DateField(this,7)):ToNumber(b); c=g<3?(%_DateField(this,8)):ToNumber(c); var h=MakeTime((%_DateField(this,5)),a,b,c); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); } function DateSetUTCMinutes(a,b,c){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var d=(%_DateField(this,0)); a=ToNumber(a); var g=%_ArgumentsLength(); b=g<2?(%_DateField(this,17)):ToNumber(b); c=g<3?(%_DateField(this,18)):ToNumber(c); var h=MakeTime((%_DateField(this,15)),a,b,c); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); } function DateSetHours(a,b,c,d){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var g=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); var h=%_ArgumentsLength(); b=h<2?(%_DateField(this,6)):ToNumber(b); c=h<3?(%_DateField(this,7)):ToNumber(c); d=h<4?(%_DateField(this,8)):ToNumber(d); var i=MakeTime(a,b,c,d); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),i),0)); } function DateSetUTCHours(a,b,c,d){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var g=(%_DateField(this,0)); a=ToNumber(a); var h=%_ArgumentsLength(); b=h<2?(%_DateField(this,16)):ToNumber(b); c=h<3?(%_DateField(this,17)):ToNumber(c); d=h<4?(%_DateField(this,18)):ToNumber(d); var i=MakeTime(a,b,c,d); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),i),1)); } function DateSetDate(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var b=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); var c=MakeDay((%_DateField(this,1)),(%_DateField(this,2)),a); return(%DateSetValue(this,MakeDate(c,(%_DateField(this,10))),0)); } function DateSetUTCDate(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var b=(%_DateField(this,0)); a=ToNumber(a); var c=MakeDay((%_DateField(this,11)),(%_DateField(this,12)),a); return(%DateSetValue(this,MakeDate(c,(%_DateField(this,20))),1)); } function DateSetMonth(a,b){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var c=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); b=%_ArgumentsLength()<2?(%_DateField(this,3)):ToNumber(b); var d=MakeDay((%_DateField(this,1)),a,b); return(%DateSetValue(this,MakeDate(d,(%_DateField(this,10))),0)); } function DateSetUTCMonth(a,b){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var c=(%_DateField(this,0)); a=ToNumber(a); b=%_ArgumentsLength()<2?(%_DateField(this,13)):ToNumber(b); var d=MakeDay((%_DateField(this,11)),a,b); return(%DateSetValue(this,MakeDate(d,(%_DateField(this,20))),1)); } function DateSetFullYear(a,b,c){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var d=(%_DateField(this,0)+%_DateField(this,21)); a=ToNumber(a); var g=%_ArgumentsLength(); var h; if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ b=g<2?0:ToNumber(b); c=g<3?1:ToNumber(c); h=0; }else{ b=g<2?(%_DateField(this,2)):ToNumber(b); c=g<3?(%_DateField(this,3)):ToNumber(c); h=(%_DateField(this,10)); } var i=MakeDay(a,b,c); return(%DateSetValue(this,MakeDate(i,h),0)); } function DateSetUTCFullYear(a,b,c){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var d=(%_DateField(this,0)); a=ToNumber(a); var g=%_ArgumentsLength(); var h; if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ b=g<2?0:ToNumber(b); c=g<3?1:ToNumber(c); h=0; }else{ b=g<2?(%_DateField(this,12)):ToNumber(b); c=g<3?(%_DateField(this,13)):ToNumber(c); h=(%_DateField(this,20)); } var i=MakeDay(a,b,c); return(%DateSetValue(this,MakeDate(i,h),1)); } function DateToUTCString(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); var a=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return'Invalid Date'; return WeekDays[(%_DateField(this,14))]+', ' +TwoDigitString((%_DateField(this,13)))+' ' +Months[(%_DateField(this,12))]+' ' +(%_DateField(this,11))+' ' +TimeStringUTC(this)+' GMT'; } function DateGetYear(){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); return(%_DateField(this,1))-1900; } function DateSetYear(a){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); a=ToNumber(a); if((!%_IsSmi(%IS_VAR(a))&&!(a==a)))return(%DateSetValue(this,$NaN,1)); a=(0<=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))&&(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))<=99) ?1900+(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))):a; var b=(%_DateField(this,0)+%_DateField(this,21)); var c,d,g; if((!%_IsSmi(%IS_VAR(b))&&!(b==b))){ c=0; d=1; g=0; }else{ c=(%_DateField(this,2)); d=(%_DateField(this,3)); g=(%_DateField(this,10)); } var h=MakeDay(a,c,d); return(%DateSetValue(this,MakeDate(h,g),0)); } function DateToGMTString(){ return %_CallFunction(this,DateToUTCString); } function PadInt(a,b){ if(b==1)return a; return a=0&&b<=9999){ c=PadInt(b,4); }else{ if(b<0){ c="-"+PadInt(-b,6); }else{ c="+"+PadInt(b,6); } } return c+ '-'+PadInt(this.getUTCMonth()+1,2)+ '-'+PadInt(this.getUTCDate(),2)+ 'T'+PadInt(this.getUTCHours(),2)+ ':'+PadInt(this.getUTCMinutes(),2)+ ':'+PadInt(this.getUTCSeconds(),2)+ '.'+PadInt(this.getUTCMilliseconds(),3)+ 'Z'; } function DateToJSON(a){ var b=ToObject(this); var c=DefaultNumber(b); if((typeof(c)==='number')&&!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0)))){ return null; } return b.toISOString(); } function ResetDateCache(){ timezone_cache_time=$NaN; timezone_cache_timezone=undefined; cache=Date_cache; cache.time=$NaN; cache.string=null; } function SetUpDate(){ %CheckIsBootstrapping(); InstallFunctions($Date,2,$Array( "UTC",DateUTC, "parse",DateParse, "now",DateNow )); %SetProperty($Date.prototype,"constructor",$Date,2); InstallFunctions($Date.prototype,2,$Array( "toString",DateToString, "toDateString",DateToDateString, "toTimeString",DateToTimeString, "toLocaleString",DateToLocaleString, "toLocaleDateString",DateToLocaleDateString, "toLocaleTimeString",DateToLocaleTimeString, "valueOf",DateValueOf, "getTime",DateGetTime, "getFullYear",DateGetFullYear, "getUTCFullYear",DateGetUTCFullYear, "getMonth",DateGetMonth, "getUTCMonth",DateGetUTCMonth, "getDate",DateGetDate, "getUTCDate",DateGetUTCDate, "getDay",DateGetDay, "getUTCDay",DateGetUTCDay, "getHours",DateGetHours, "getUTCHours",DateGetUTCHours, "getMinutes",DateGetMinutes, "getUTCMinutes",DateGetUTCMinutes, "getSeconds",DateGetSeconds, "getUTCSeconds",DateGetUTCSeconds, "getMilliseconds",DateGetMilliseconds, "getUTCMilliseconds",DateGetUTCMilliseconds, "getTimezoneOffset",DateGetTimezoneOffset, "setTime",DateSetTime, "setMilliseconds",DateSetMilliseconds, "setUTCMilliseconds",DateSetUTCMilliseconds, "setSeconds",DateSetSeconds, "setUTCSeconds",DateSetUTCSeconds, "setMinutes",DateSetMinutes, "setUTCMinutes",DateSetUTCMinutes, "setHours",DateSetHours, "setUTCHours",DateSetUTCHours, "setDate",DateSetDate, "setUTCDate",DateSetUTCDate, "setMonth",DateSetMonth, "setUTCMonth",DateSetUTCMonth, "setFullYear",DateSetFullYear, "setUTCFullYear",DateSetUTCFullYear, "toGMTString",DateToGMTString, "toUTCString",DateToUTCString, "getYear",DateGetYear, "setYear",DateSetYear, "toISOString",DateToISOString, "toJSON",DateToJSON )); } SetUpDate(); var $JSON=global.JSON; function Revive(a,b,c){ var d=a[b]; if((%_IsObject(d))){ if((%_IsArray(d))){ var g=d.length; for(var h=0;h0){ var o=",\n"+d; m="[\n"+d+i.join(o)+"\n"+ h+"]"; }else{ m="[]"; } c.pop(); return m; } function SerializeObject(a,b,c,d,g){ if(!%PushIfAbsent(c,a)){ throw MakeTypeError('circular_structure',$Array()); } var h=d; d+=g; var i=new InternalArray(); if((%_IsArray(b))){ var j=b.length; for(var k=0;k0){ var r=",\n"+d; q="{\n"+d+i.join(r)+"\n"+ h+"}"; }else{ q="{}"; } c.pop(); return q; } function JSONSerialize(a,b,c,d,g,h){ var i=b[a]; if((%_IsSpecObject(i))){ var j=i.toJSON; if((%_ClassOf(j)==='Function')){ i=%_CallFunction(i,a,j); } } if((%_ClassOf(c)==='Function')){ i=%_CallFunction(b,a,i,c); } if((typeof(i)==='string')){ return %QuoteJSONString(i); }else if((typeof(i)==='number')){ return((%_IsSmi(%IS_VAR(i))||i-i==0)?%_NumberToString(i):"null"); }else if((typeof(i)==='boolean')){ return i?"true":"false"; }else if((i===null)){ return"null"; }else if((%_IsSpecObject(i))&&!(typeof i=="function")){ if((%_IsArray(i))){ return SerializeArray(i,c,d,g,h); }else if((%_ClassOf(i)==='Number')){ i=ToNumber(i); return((%_IsSmi(%IS_VAR(i))||i-i==0)?%_NumberToString(i):"null"); }else if((%_ClassOf(i)==='String')){ return %QuoteJSONString(ToString(i)); }else if((%_ClassOf(i)==='Boolean')){ return %_ValueOf(i)?"true":"false"; }else{ return SerializeObject(i,c,d,g,h); } } return void 0; } function BasicSerializeArray(a,b,c){ var d=a.length; if(d==0){ c.push("[]"); return; } if(!%PushIfAbsent(b,a)){ throw MakeTypeError('circular_structure',$Array()); } c.push("["); var g=a[0]; if((typeof(g)==='string')){ var h=%QuoteJSONStringArray(a); if(!(typeof(h)==='undefined')){ c[c.length-1]=h; b.pop(); return; }else{ c.push(%QuoteJSONString(g)); for(var i=1;i10){ h=SubString(c,0,10); }else{ h=c; } }else{ h=""; } return JSONSerialize('',{'':a},b,new InternalArray(),"",h); } function SetUpJSON(){ %CheckIsBootstrapping(); InstallFunctions($JSON,2,$Array( "parse",JSONParse, "stringify",JSONStringify )); } SetUpJSON(); var $RegExp=global.RegExp; function DoConstructRegExp(a,b,c){ if((%_IsRegExp(b))){ if(!(typeof(c)==='undefined')){ throw MakeTypeError('regexp_flags',[]); } c=(b.global?'g':'') +(b.ignoreCase?'i':'') +(b.multiline?'m':''); b=b.source; } b=(typeof(b)==='undefined')?'':ToString(b); c=(typeof(c)==='undefined')?'':ToString(c); var d=false; var g=false; var h=false; for(var i=0;i>1; var d=a[3]; var g=a[4]; var h=%_RegExpConstructResult(c,d,b); if(d+1==g){ h[0]=%_StringCharAt(b,d); }else{ h[0]=%_SubString(b,d,g); } var i=3+2; for(var j=1;ja.length){ this.lastIndex=0; return null; } }else{ c=0; } %_Log('regexp','regexp-exec,%0r,%1S,%2i',[this,a,b]); var g=%_RegExpExec(this,a,c,lastMatchInfo); if(g===null){ if(d)this.lastIndex=0; return null; } lastMatchInfoOverride=null; if(d){ this.lastIndex=lastMatchInfo[4]; } return BuildResultFromMatchInfo(g,a); } var regexp_key; var regexp_val; function RegExpTest(a){ if(!(%_IsRegExp(this))){ throw MakeTypeError('incompatible_method_receiver', ['RegExp.prototype.test',this]); } a=((typeof(%IS_VAR(a))==='string')?a:NonStringToString(a)); var b=this.lastIndex; var c=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(this.global){ if(c<0||c>a.length){ this.lastIndex=0; return false; } %_Log('regexp','regexp-exec,%0r,%1S,%2i',[this,a,b]); var d=%_RegExpExec(this,a,c,lastMatchInfo); if(d===null){ this.lastIndex=0; return false; } lastMatchInfoOverride=null; this.lastIndex=lastMatchInfo[4]; return true; }else{ var g=this; if(%_StringCharCodeAt(g.source,0)==46&& %_StringCharCodeAt(g.source,1)==42&& %_StringCharCodeAt(g.source,2)!=63){ g=TrimRegExp(g); } %_Log('regexp','regexp-exec,%0r,%1S,%2i',[g,a,b]); var d=%_RegExpExec(g,a,0,lastMatchInfo); if(d===null)return false; lastMatchInfoOverride=null; return true; } } function TrimRegExp(a){ if(!%_ObjectEquals(regexp_key,a)){ regexp_key=a; regexp_val= new $RegExp(SubString(a.source,2,a.source.length), (a.ignoreCase?a.multiline?"im":"i" :a.multiline?"m":"")); } return regexp_val; } function RegExpToString(){ if(!(%_IsRegExp(this))){ throw MakeTypeError('incompatible_method_receiver', ['RegExp.prototype.toString',this]); } var a='/'+this.source+'/'; if(this.global)a+='g'; if(this.ignoreCase)a+='i'; if(this.multiline)a+='m'; return a; } function RegExpGetLastMatch(){ if(lastMatchInfoOverride!==null){ return((lastMatchInfoOverride)[0]); } var a=((lastMatchInfo)[1]); return SubString(a, lastMatchInfo[3], lastMatchInfo[4]); } function RegExpGetLastParen(){ if(lastMatchInfoOverride){ var a=lastMatchInfoOverride; if(a.length<=3)return''; return a[a.length-3]; } var b=((lastMatchInfo)[0]); if(b<=2)return''; var c=((lastMatchInfo)[1]); var d=lastMatchInfo[(3+(b-2))]; var g=lastMatchInfo[(3+(b-1))]; if(d!=-1&&g!=-1){ return SubString(c,d,g); } return""; } function RegExpGetLeftContext(){ var a; var b; if(!lastMatchInfoOverride){ a=lastMatchInfo[3]; b=((lastMatchInfo)[1]); }else{ var c=lastMatchInfoOverride; a=((c)[(c).length-2]); b=((c)[(c).length-1]); } return SubString(b,0,a); } function RegExpGetRightContext(){ var a; var b; if(!lastMatchInfoOverride){ a=lastMatchInfo[4]; b=((lastMatchInfo)[1]); }else{ var c=lastMatchInfoOverride; b=((c)[(c).length-1]); var d=((c)[0]); a=((c)[(c).length-2])+d.length; } return SubString(b,a,b.length); } function RegExpMakeCaptureGetter(a){ return function(){ if(lastMatchInfoOverride){ if(a=((lastMatchInfo)[0]))return''; var c=lastMatchInfo[(3+(b))]; var d=lastMatchInfo[(3+(b+1))]; if(c==-1||d==-1)return''; return SubString(((lastMatchInfo)[1]),c,d); }; } var lastMatchInfo=new InternalArray( 2, "", void 0, 0, 0 ); var lastMatchInfoOverride=null; function SetUpRegExp(){ %CheckIsBootstrapping(); %FunctionSetInstanceClassName($RegExp,'RegExp'); %SetProperty($RegExp.prototype,'constructor',$RegExp,2); %SetCode($RegExp,RegExpConstructor); InstallFunctions($RegExp.prototype,2,$Array( "exec",RegExpExec, "test",RegExpTest, "toString",RegExpToString, "compile",RegExpCompile )); %FunctionSetLength($RegExp.prototype.compile,1); var a=function(){ var b=((lastMatchInfo)[2]); return(typeof(b)==='undefined')?"":b; }; var c=function(d){ ((lastMatchInfo)[2])=ToString(d); }; %OptimizeObjectForAddingMultipleProperties($RegExp,22); %DefineOrRedefineAccessorProperty($RegExp,'input',a, c,4); %DefineOrRedefineAccessorProperty($RegExp,'$_',a, c,2|4); %DefineOrRedefineAccessorProperty($RegExp,'$input',a, c,2|4); var g=false; var h=function(){return g;}; var i=function(j){g=j?true:false;}; %DefineOrRedefineAccessorProperty($RegExp,'multiline',h, i,4); %DefineOrRedefineAccessorProperty($RegExp,'$*',h, i, 2|4); var k=function(l){}; %DefineOrRedefineAccessorProperty($RegExp,'lastMatch',RegExpGetLastMatch, k,4); %DefineOrRedefineAccessorProperty($RegExp,'$&',RegExpGetLastMatch, k,2|4); %DefineOrRedefineAccessorProperty($RegExp,'lastParen',RegExpGetLastParen, k,4); %DefineOrRedefineAccessorProperty($RegExp,'$+',RegExpGetLastParen, k,2|4); %DefineOrRedefineAccessorProperty($RegExp,'leftContext', RegExpGetLeftContext,k, 4); %DefineOrRedefineAccessorProperty($RegExp,'$`',RegExpGetLeftContext, k,2|4); %DefineOrRedefineAccessorProperty($RegExp,'rightContext', RegExpGetRightContext,k, 4); %DefineOrRedefineAccessorProperty($RegExp,"$'",RegExpGetRightContext, k,2|4); for(var m=1;m<10;++m){ %DefineOrRedefineAccessorProperty($RegExp,'$'+m, RegExpMakeCaptureGetter(m),k, 4); } %ToFastProperties($RegExp); } SetUpRegExp(); GCC: (GNU) 4.2.1 20070831 patched [FreeBSD].symtab.strtab.shstrtab.text.data.bss.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetBuiltinsCountEv.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetDebuggerCountEv.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE17GetRawScriptsSizeEv.rel.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE19SetRawScriptsSourceENS0_6VectorIKcEE.rel.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetScriptsSourceEv.rodata.str1.1.rel.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE8GetIndexEPKc.rel.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE13GetScriptNameEi.rel.text._ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE18GetRawScriptSourceEi.rel.data._ZN2v88internal11raw_sourcesE.rodata._ZN2v88internal7sourcesE.comment.note.GNU-stack4!4'4,@P`*p & 0  8 2S @p IE xp (x@ `Ŝ ;%-DRRT x ,Ŝ  E-    ilibraries.cc_ZN2v88internal11raw_sourcesE_ZN2v88internal7sourcesE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetBuiltinsCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetDebuggerCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE17GetRawScriptsSizeEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE19SetRawScriptsSourceENS0_6VectorIKcEE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE16GetScriptsSourceEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE8GetIndexEPKc_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE13GetScriptNameEi_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE0EE18GetRawScriptSourceEi + E _ y      ) G e   $ 4 D T ` l x         /CWk/0 1352506117 1001 1001 100644 10600 ` ELF x 4(1D$proxycollectionnative proxy.jsnative collection.js4$t$ |$18u 4$ȋ|$Ët$ (Ƀt$t$ $t!t60ɉ؋t$ʋ$t$t$ $u ڋt$ȋ$Ít&1ۃ6u feڋt$$ "use strict"; global.Proxy=new $Object(); var $Proxy=global.Proxy $Proxy.create=function(a,b){ if(!(%_IsSpecObject(a))) throw MakeTypeError("handler_non_object",["create"]) if((typeof(b)==='undefined')) b=null else if(!((%_IsSpecObject(b))||b===null)) throw MakeTypeError("proto_non_object",["create"]) return %CreateJSProxy(a,b) } $Proxy.createFunction=function(a,b,c){ if(!(%_IsSpecObject(a))) throw MakeTypeError("handler_non_object",["create"]) if(!(%_ClassOf(b)==='Function')) throw MakeTypeError("trap_function_expected",["createFunction","call"]) if((typeof(c)==='undefined')){ c=DerivedConstructTrap(b) }else if((%_ClassOf(c)==='Function')){ var d=c c=function(){ return %Apply(d,void 0,arguments,0,%_ArgumentsLength()); } }else{ throw MakeTypeError("trap_function_expected", ["createFunction","construct"]) } return %CreateJSFunctionProxy( a,b,c,$Function.prototype) } function DerivedConstructTrap(a){ return function(){ var b=this.prototype if(!(%_IsSpecObject(b)))b=$Object.prototype var c=new $Object() c.__proto__=b var d=%Apply(a,c,arguments,0,%_ArgumentsLength()); return(%_IsSpecObject(d))?d:c } } function DelegateCallAndConstruct(a,b){ return function(){ return %Apply(%_IsConstructCall()?b:a, this,arguments,0,%_ArgumentsLength()) } } function DerivedGetTrap(a,b){ var c=this.getPropertyDescriptor(b) if((typeof(c)==='undefined')){return c} if('value'in c){ return c.value }else{ if((typeof(c.get)==='undefined')){return c.get} return %_CallFunction(a,c.get) } } function DerivedSetTrap(a,b,c){ var d=this.getOwnPropertyDescriptor(b) if(d){ if('writable'in d){ if(d.writable){ d.value=c this.defineProperty(b,d) return true }else{ return false } }else{ if(d.set){ %_CallFunction(a,c,d.set) return true }else{ return false } } } d=this.getPropertyDescriptor(b) if(d){ if('writable'in d){ if(d.writable){ }else{ return false } }else{ if(d.set){ %_CallFunction(a,c,d.set) return true }else{ return false } } } this.defineProperty(b,{ value:c, writable:true, enumerable:true, configurable:true}); return true; } function DerivedHasTrap(a){ return!!this.getPropertyDescriptor(a) } function DerivedHasOwnTrap(a){ return!!this.getOwnPropertyDescriptor(a) } function DerivedKeysTrap(){ var a=this.getOwnPropertyNames() var b=[] for(var c=0,count=0;cE 0)p[ H) `) ;-D##T$ H& 9  R:   Y ,>v[experimental-libraries.cc_ZN2v88internal11raw_sourcesE_ZN2v88internal7sourcesE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetBuiltinsCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetDebuggerCountEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE17GetRawScriptsSizeEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE19SetRawScriptsSourceENS0_6VectorIKcEE_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE16GetScriptsSourceEv_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE8GetIndexEPKc_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE13GetScriptNameEi_ZN2v88internal17NativesCollectionILNS0_10NativeTypeE1EE18GetRawScriptSourceEi ;   ) 6 >/26 1352506117 1001 1001 100644 3141 ` ELF 4(GCC: (GNU) 4.2.1 20070831 patched [FreeBSD].symtab.strtab.shstrtab.text.data.bss.rodata._ZN2v88internal8Snapshot5data_E.bss._ZN2v88internal8Snapshot9raw_data_E.rodata._ZN2v88internal8Snapshot5size_E.rodata._ZN2v88internal8Snapshot9raw_size_E.rodata._ZN2v88internal8Snapshot13context_data_E.bss._ZN2v88internal8Snapshot17context_raw_data_E.rodata._ZN2v88internal8Snapshot13context_size_E.rodata._ZN2v88internal8Snapshot17context_raw_size_E.rodata._ZN2v88internal8Snapshot15new_space_used_E.rodata._ZN2v88internal8Snapshot19pointer_space_used_E.rodata._ZN2v88internal8Snapshot16data_space_used_E.rodata._ZN2v88internal8Snapshot16code_space_used_E.rodata._ZN2v88internal8Snapshot15map_space_used_E.rodata._ZN2v88internal8Snapshot16cell_space_used_E.rodata._ZN2v88internal8Snapshot17large_space_used_E.comment.note.GNU-stack4!4'4,4T8}8<@D4DeHLPT8Xl\`dh-!xP  }     3Ww   G r $Psnapshot-empty.cc_ZN2v88internal8Snapshot5data_E_ZN2v88internal8Snapshot9raw_data_E_ZN2v88internal8Snapshot5size_E_ZN2v88internal8Snapshot9raw_size_E_ZN2v88internal8Snapshot13context_data_E_ZN2v88internal8Snapshot17context_raw_data_E_ZN2v88internal8Snapshot13context_size_E_ZN2v88internal8Snapshot17context_raw_size_E_ZN2v88internal8Snapshot15new_space_used_E_ZN2v88internal8Snapshot19pointer_space_used_E_ZN2v88internal8Snapshot16data_space_used_E_ZN2v88internal8Snapshot16code_space_used_E_ZN2v88internal8Snapshot15map_space_used_E_ZN2v88internal8Snapshot16cell_space_used_E_ZN2v88internal8Snapshot17large_space_used_E