debugÖ– "use strict"; var kDefaultBacktraceLength=10; var Debug={}; var sourceLineBeginningSkip=/^(?:\s*(?:\/\*.*?\*\/)*)*/; Debug.DebugEvent={Break:1, Exception:2, NewFunction:3, BeforeCompile:4, AfterCompile:5, CompileError:6, PromiseEvent:7, AsyncTaskEvent:8, BreakForCommand:9}; Debug.ExceptionBreak={Caught:0, Uncaught:1}; Debug.StepAction={StepOut:0, StepNext:1, StepIn:2, StepMin:3, StepInMin:4, StepFrame:5}; Debug.ScriptType={Native:0, Extension:1, Normal:2}; Debug.ScriptCompilationType={Host:0, Eval:1, JSON:2}; Debug.ScriptBreakPointType={ScriptId:0, ScriptName:1, ScriptRegExp:2}; Debug.BreakPositionAlignment={ Statement:0, BreakPosition:1 }; function ScriptTypeFlag(a){ return(1<0){ 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,opt_position_alignment){ 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.position_alignment_=(opt_position_alignment===(void 0)) ?Debug.BreakPositionAlignment.Statement:opt_position_alignment; 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_, this.position_alignment_); 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.frame_=new FrameMirror(a,0); this.break_points_hit_=b; } BreakEvent.prototype.eventType=function(){ return Debug.DebugEvent.Break; }; BreakEvent.prototype.func=function(){ return this.frame_.func(); }; BreakEvent.prototype.sourceLine=function(){ return this.frame_.sourceLine(); }; BreakEvent.prototype.sourceColumn=function(){ return this.frame_.sourceColumn(); }; BreakEvent.prototype.sourceLineText=function(){ return this.frame_.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.frame_.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){ return new CompileEvent(a,b); } function CompileEvent(a,b){ this.script_=MakeMirror(a); this.type_=b; } CompileEvent.prototype.eventType=function(){ return this.type_; }; CompileEvent.prototype.script=function(){ return this.script_; }; CompileEvent.prototype.toJSONProtocol=function(){ var a=new ProtocolMessage(); a.running=true; switch(this.type_){ case Debug.DebugEvent.BeforeCompile: a.event="beforeCompile"; break; case Debug.DebugEvent.AfterCompile: a.event="afterCompile"; break; case Debug.DebugEvent.CompileError: a.event="compileError"; break; } a.body={}; a.body.script=this.script_; 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(!(a.data()===(void 0))){ c.data=a.data(); } if(b){ c.source=a.source(); } return c; } function MakePromiseEvent(a){ return new PromiseEvent(a); } function PromiseEvent(a){ this.promise_=a.promise; this.parentPromise_=a.parentPromise; this.status_=a.status; this.value_=a.value; } PromiseEvent.prototype.promise=function(){ return MakeMirror(this.promise_); } PromiseEvent.prototype.parentPromise=function(){ return MakeMirror(this.parentPromise_); } PromiseEvent.prototype.status=function(){ return this.status_; } PromiseEvent.prototype.value=function(){ return MakeMirror(this.value_); } function MakeAsyncTaskEvent(a){ return new AsyncTaskEvent(a); } function AsyncTaskEvent(a){ this.type_=a.type; this.name_=a.name; this.id_=a.id; } AsyncTaskEvent.prototype.type=function(){ return this.type_; } AsyncTaskEvent.prototype.name=function(){ return this.name_; } AsyncTaskEvent.prototype.id=function(){ return this.id_; } 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,b){ this.success=false; this.message=a; if((%_IsObject(b))){ this.error_details=b; } }; 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(m).evaluate( c,Boolean(g),i); return; }else{ b.body=this.exec_state_.frame().evaluate( c,Boolean(g),i); return; } }; DebugCommandProcessor.prototype.lookupRequest_=function(a,b){ if(!a.arguments){ return b.failed('Missing arguments'); } var c=a.arguments.handles; if((c===(void 0))){ return b.failed('Argument "handles" missing'); } if(!(a.arguments.includeSource===(void 0))){ var d=%ToBoolean(a.arguments.includeSource); b.setOption('includeSource',d); } var e={}; for(var g=0;g=this.exec_state_.frameCount()){ return b.failed('Invalid frame "'+e+'"'); } e=this.exec_state_.frame(g); } } var h=e.func().script(); if(!h){ return b.failed('No source'); } var i=h.sourceSlice(c,d); if(!i){ return b.failed('Invalid line interval'); } b.body={}; b.body.source=i.sourceText(); b.body.fromLine=i.from_line; b.body.toLine=i.to_line; b.body.fromPosition=i.from_position; b.body.toPosition=i.to_position; b.body.totalLines=h.lineCount(); }; DebugCommandProcessor.prototype.scriptsRequest_=function(a,b){ var c=ScriptTypeFlag(Debug.ScriptType.Normal); var d=false; var e=null; if(a.arguments){ if(!(a.arguments.types===(void 0))){ c=%ToNumber(a.arguments.types); if(isNaN(c)||c<0){ return b.failed('Invalid types "'+ a.arguments.types+'"'); } } if(!(a.arguments.includeSource===(void 0))){ d=%ToBoolean(a.arguments.includeSource); b.setOption('includeSource',d); } if((%_IsArray(a.arguments.ids))){ e={}; var g=a.arguments.ids; for(var h=0;h=0){ n=true; } } if(!n)continue; } if(c&ScriptTypeFlag(l[h].type)){ b.body.push(MakeMirror(l[h])); } } }; DebugCommandProcessor.prototype.threadsRequest_=function(a,b){ var c=this.exec_state_.threadCount(); var d=[]; for(var e=0;e=this.exec_state_.frameCount()){ return response.failed('Invalid frame "'+a+'"'); } b=this.exec_state_.frame(c); }else{ b=this.exec_state_.frame(); } var d=Debug.LiveEdit.RestartFrame(b); response.body={result:d}; }; DebugCommandProcessor.prototype.debuggerFlagsRequest_=function(request, response){ if(!request.arguments){ response.failed('Missing arguments'); return; } var a=request.arguments.flags; response.body={flags:[]}; if(!(a===(void 0))){ for(var b=0;b"; }; 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'|| a==='symbol'; }; 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 SymbolMirror(a){ %_CallFunction(this,SYMBOL_TYPE,a,ValueMirror); } inherits(SymbolMirror,ValueMirror); SymbolMirror.prototype.description=function(){ return %SymbolDescription(%_ValueOf(this.value_)); } SymbolMirror.prototype.toText=function(){ return %_CallFunction(this.value_,builtins.$symbolToString); } 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.hasNamedInterceptor=function(){ var a=%GetInterceptorInfo(this.value_); return(a&2)!=0; }; ObjectMirror.prototype.hasIndexedInterceptor=function(){ var a=%GetInterceptorInfo(this.value_); return(a&1)!=0; }; function TryGetPropertyNames(a){ try{ return %GetOwnPropertyNames(a,32); }catch(e){ return[]; } } ObjectMirror.prototype.propertyNames=function(a,b){ a=a||PropertyKind.Named|PropertyKind.Indexed; var c; var d; var e=0; if(a&PropertyKind.Named){ c=TryGetPropertyNames(this.value_); e+=c.length; if(this.hasNamedInterceptor()&&(a&PropertyKind.Named)){ var g= %GetNamedInterceptorPropertyNames(this.value_); if(g){ c=c.concat(g); e+=g.length; } } } if(a&PropertyKind.Indexed){ d=%GetOwnElementNames(this.value_); e+=d.length; if(this.hasIndexedInterceptor()&&(a&PropertyKind.Indexed)){ var h= %GetIndexedInterceptorElementNames(this.value_); if(h){ d=d.concat(h); e+=h.length; } } } b=Math.min(b||e,e); var i=new Array(b); var j=0; if(a&PropertyKind.Named){ for(var k=0;j'; }; ObjectMirror.GetInternalProperties=function(a){ if((%_ClassOf(a)==='String')||(%_ClassOf(a)==='Number')|| (%_ClassOf(a)==='Boolean')){ var b=%_ValueOf(a); return[new InternalPropertyMirror("[[PrimitiveValue]]",b)]; }else if((%_IsFunction(a))){ var c=%BoundFunctionGetBindings(a); var d=[]; if(c&&(%_IsArray(c))){ d.push(new InternalPropertyMirror("[[TargetFunction]]", c[0])); d.push(new InternalPropertyMirror("[[BoundThis]]",c[1])); var e=[]; for(var g=2;gb)return new Array(); var c=new Array(b-a+1); for(var d=a;d<=b;d++){ var e=%DebugGetPropertyDetails(this.value_,%ToString(d)); var g; if(e){ g=new PropertyMirror(this,d,e); }else{ g=GetUndefinedMirror(); } c[d-a]=g; } 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.sticky=function(){ return this.value_.sticky; }; RegExpMirror.prototype.unicode=function(){ return this.value_.unicode; }; 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{ a=%_CallFunction(this.value_,builtins.ErrorToString); }catch(e){ a='#'; } return a; }; function PromiseMirror(a){ %_CallFunction(this,a,PROMISE_TYPE,ObjectMirror); } inherits(PromiseMirror,ObjectMirror); function PromiseGetStatus_(a){ var b=%DebugGetProperty(a,builtins.promiseStatus); if(b==0)return"pending"; if(b==1)return"resolved"; return"rejected"; } function PromiseGetValue_(a){ return %DebugGetProperty(a,builtins.promiseValue); } PromiseMirror.prototype.status=function(){ return PromiseGetStatus_(this.value_); }; PromiseMirror.prototype.promiseValue=function(){ return MakeMirror(PromiseGetValue_(this.value_)); }; function MapMirror(a){ %_CallFunction(this,a,MAP_TYPE,ObjectMirror); } inherits(MapMirror,ObjectMirror); MapMirror.prototype.entries=function(a){ var b=[]; if((%_ClassOf(this.value_)==='WeakMap')){ var c=%GetWeakMapEntries(this.value_,a||0); for(var d=0;d3){ this.exception_=c[3]; this.getter_=c[4]; this.setter_=c[5]; } } 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 SYMBOL_TYPE: a.description=mirror.description(); break; case OBJECT_TYPE: case FUNCTION_TYPE: case ERROR_TYPE: case REGEXP_TYPE: case PROMISE_TYPE: case GENERATOR_TYPE: this.serializeObject_(mirror,a,details); break; case PROPERTY_TYPE: case INTERNAL_PROPERTY_TYPE: throw new Error('PropertyMirror cannot be serialized independently'); 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()); if(mirror.hasNamedInterceptor()){ content.namedInterceptor=true; } if(mirror.hasIndexedInterceptor()){ content.indexedInterceptor=true; } if(mirror.isFunction()){ content.name=mirror.name(); if(!(mirror.inferredName()===(void 0))){ 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 a=0;a0){ var i=[]; for(var a=0;a0){ return'Infinity'; }else{ return'-Infinity'; } } return a; } liveeditÁř "use strict"; Debug.LiveEdit=new function(){ var a; var b="stack_update_needs_step_in"; function ApplyPatchMultiChunk(script,diff_array,new_source,preview_only, change_log){ var c=script.source; var d=GatherCompileInfo(c,script); var e=BuildCodeInfoTree(d); var g=new PosTranslator(diff_array); MarkChangedFunctions(e,g.GetChunks()); FindLiveSharedInfos(e,script); var h; try{ h=GatherCompileInfo(new_source,script); }catch(e){ var i= new Failure("Failed to compile new version of script: "+e); if(e instanceof SyntaxError){ var j={ type:"liveedit_compile_error", syntaxErrorMessage:e.message }; CopyErrorPositionToDetails(e,j); i.details=j; } throw i; } var k=BuildCodeInfoTree(h); FindCorrespondingFunctions(e,k); var l=new Array(); var m=new Array(); var n=new Array(); var o=new Array(); function HarvestTodo(p){ function CollectDamaged(q){ m.push(q); for(var r=0;rI[x].start_position){ K=x; } } if(K!=r){ var L=I[K]; var M=J[K]; I[K]=I[r]; J[K]=J[r]; I[r]=L; J[r]=M; } } var N=0; function ResetIndexes(O,P){ var Q=-1; while(N=aE.pos1+aE.len1){ return ay+aE.pos2+aE.len2-aE.pos1-aE.len1; } if(!az){ az=PosTranslator.DefaultInsideChunkHandler; } return az(ay,aE); }; PosTranslator.DefaultInsideChunkHandler=function(ay,aF){ Assert(false,"Cannot translate position in changed area"); }; PosTranslator.ShiftWithTopInsideChunkHandler= function(ay,aF){ return ay-aF.pos1+aF.pos2; }; var a={ UNCHANGED:"unchanged", SOURCE_CHANGED:"source changed", CHANGED:"changed", DAMAGED:"damaged" }; function CodeInfoTreeNode(aG,aH,aI){ this.info=aG; this.children=aH; this.array_index=aI; 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(aJ){ var aK=0; function BuildNode(){ var aL=aK; aK++; var aM=new Array(); while(aK=as.length;}; this.TranslatePos=function(ay){return ay+aR;}; }; function ProcessInternals(aS){ aS.new_start_pos=aP.TranslatePos( aS.info.start_position); var aT=0; var aU=false; var aV=false; while(!aP.done()&& aP.current().pos1= aP.current().pos1+aP.current().len1){ aU=true; aP.next(); continue; }else if(aW.info.start_position<=aP.current().pos1&& aW.info.end_position>=aP.current().pos1+ aP.current().len1){ ProcessInternals(aW); aV=aV|| (aW.status!=a.UNCHANGED); aU=aU|| (aW.status==a.DAMAGED); aT++; continue; }else{ aU=true; aW.status=a.DAMAGED; aW.status_explanation= "Text diff overlaps with function boundary"; aT++; continue; } }else{ if(aP.current().pos1+aP.current().len1<= aS.info.end_position){ aS.status=a.CHANGED; aP.next(); continue; }else{ aS.status=a.DAMAGED; aS.status_explanation= "Text diff overlaps with function boundary"; return; } } Assert("Unreachable",false); } while(aT0){ return bj; } } function TraverseTree(q){ q.live_shared_function_infos=FindFunctionInfos(q.info); for(var r=0;r ["+br+"]"; } return; } var bs; function CheckStackActivations(bt,S){ var bu=new Array(); for(var r=0;r0){ S.push({dropped_from_stack:bx}); } if(bw.length>0){ S.push({functions_on_stack:bw}); throw new Failure("Blocked by functions on stack"); } return bx.length; } var bs={ AVAILABLE_FOR_PATCH:1, BLOCKED_ON_ACTIVE_STACK:2, BLOCKED_ON_OTHER_STACK:3, BLOCKED_UNDER_NATIVE_CODE:4, REPLACED_ON_ACTIVE_STACK:5, BLOCKED_UNDER_GENERATOR:6, BLOCKED_ACTIVE_GENERATOR:7 }; bs.SymbolName=function(bA){ var bB=bs; for(var bC in bB){ if(bB[bC]==bA){ return bC; } } }; function Failure(am){ this.message=am; } this.Failure=Failure; Failure.prototype.toString=function(){ return"LiveEdit Failure: "+this.message; }; function CopyErrorPositionToDetails(bD,j){ function createPositionStruct(G,bE){ if(bE==-1)return; var bF=G.locationFromPosition(bE,true); if(bF==null)return; return{ line:bF.line+1, column:bF.column+1, position:bE }; } if(!("scriptObject"in bD)||!("startPosition"in bD)){ return; } var G=bD.scriptObject; var bG={ start:createPositionStruct(G,bD.startPosition), end:createPositionStruct(G,bD.endPosition) }; j.position=bG; } function GetPcFromSourcePos(bH,bI){ return %GetFunctionCodePositionFromSource(bH,bI); } this.GetPcFromSourcePos=GetPcFromSourcePos; function SetScriptSource(G,bJ,bK,S){ var c=G.source; var bL=CompareStrings(c,bJ); return ApplyPatchMultiChunk(G,bL,bJ,bK, S); } this.SetScriptSource=SetScriptSource; function CompareStrings(bM,bN){ return %LiveEditCompareStrings(bM,bN); } function ApplySingleChunkPatch(G,change_pos,change_len,new_str, S){ var c=G.source; var bJ=c.substring(0,change_pos)+ new_str+c.substring(change_pos+change_len); return ApplyPatchMultiChunk(G, [change_pos,change_pos+change_len,change_pos+new_str.length], bJ,false,S); } function DescribeChangeTree(aX){ function ProcessOldNode(q){ var bO=[]; for(var r=0;r=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 REFLECT_APPLY_PREPARE(a){ var b; if((%_IsArray(a))){ b=a.length; if(%_IsSmi(b)&&b>=0&&b<0x800000&& (%_ClassOf(this)==='Function')){ return b; } } if(!(%_ClassOf(this)==='Function')){ throw %MakeTypeError('called_non_callable',[%ToString(this)]); } if(!(%_IsSpecObject(a))){ throw %MakeTypeError('reflect_apply_wrong_args',[]); } b=%ToLength(a.length); if(b>0x800000){ throw %MakeRangeError('stack_overflow',[]); } return b; } function REFLECT_CONSTRUCT_PREPARE(a,b){ var c; var d=(%_ClassOf(this)==='Function')&&%IsConstructor(this); var e=(%_ClassOf(b)==='Function')&&%IsConstructor(b); if((%_IsArray(a))){ c=a.length; if(%_IsSmi(c)&&c>=0&&c<0x800000&& d&&e){ return c; } } if(!d){ if(!(%_ClassOf(this)==='Function')){ throw %MakeTypeError('called_non_callable',[%ToString(this)]); }else{ throw %MakeTypeError('not_constructor',[%ToString(this)]); } } if(!e){ if(!(%_ClassOf(b)==='Function')){ throw %MakeTypeError('called_non_callable',[%ToString(b)]); }else{ throw %MakeTypeError('not_constructor',[%ToString(b)]); } } if(!(%_IsSpecObject(a))){ throw %MakeTypeError('reflect_construct_wrong_args',[]); } c=%ToLength(a.length); if(c>0x800000){ throw %MakeRangeError('stack_overflow',[]); } return c; } function STACK_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 TO_NAME(){ return %ToName(this); } function ToPrimitive(a,b){ if((typeof(a)==='string'))return a; if(!(%_IsSpecObject(a)))return a; if((%_ClassOf(a)==='Symbol'))throw MakeTypeError('symbol_to_primitive',[]); 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((a===(void 0)))return $NaN; if((typeof(a)==='symbol'))throw MakeTypeError('symbol_to_number',[]); 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((a===(void 0)))return $NaN; if((typeof(a)==='symbol'))throw MakeTypeError('symbol_to_number',[]); 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((a===(void 0)))return'undefined'; if((typeof(a)==='symbol'))throw %MakeTypeError('symbol_to_string',[]); 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((a===(void 0)))return'undefined'; if((typeof(a)==='symbol'))throw %MakeTypeError('symbol_to_string',[]); return((a===null))?'null':%ToString(%DefaultString(a)); } function ToName(a){ return(typeof(a)==='symbol')?a:%ToString(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((typeof(a)==='symbol'))return %NewSymbolWrapper(a); if((a==null)&&!(%_IsUndetectableObject(a))){ throw %MakeTypeError('undefined_or_null_to_object',[]); } return a; } function ToInteger(a){ if(%_IsSmi(a))return a; return %NumberToInteger(ToNumber(a)); } function ToLength(a){ a=ToInteger(a); if(a<0)return 0; return a<$Number.MAX_SAFE_INTEGER?a:$Number.MAX_SAFE_INTEGER; } 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&&%_IsMinusZero(a)!=%_IsMinusZero(b)){ return false; } } return a===b; } function SameValueZero(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; } return a===b; } function IsPrimitive(a){ return!(%_IsSpecObject(a)); } function IsConcatSpreadable(a){ if(!(%_IsSpecObject(a)))return false; var b=a[symbolIsConcatSpreadable]; if((b===(void 0)))return(%_IsArray(a)); return ToBoolean(b); } function DefaultNumber(a){ if(!(%_ClassOf(a)==='Symbol')){ 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){ if(!(%_ClassOf(a)==='Symbol')){ 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',[]); } function ToPositiveInteger(a,b){ var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToIntegerMapMinusZero(ToNumber(a))); if(c<0)throw MakeRangeError(b); return c; } %FunctionSetPrototype($Array,new $Array(0)); function STRING_LENGTH_STUB(a){ var b=this; return %_StringGetLength(%_JSValueGetValue(b)); } $v8natives’ř 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=4){ %OptimizeObjectForAddingMultipleProperties(a,b.length>>1); } var c=2|4|1; for(var d=0;d>1)+(b?b.length:0); if(e>=4){ %OptimizeObjectForAddingMultipleProperties(d,e); } if(b){ for(var g=0;g>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=%GlobalProxy(global); var c=%CompileString(a,false,0); if(!(%_IsFunction(c)))return c; return %_CallFunction(b,c); } function SetUpGlobal(){ %CheckIsBootstrapping(); var a=2|4|1; %AddNamedProperty(global,"NaN",$NaN,a); %AddNamedProperty(global,"Infinity",(1/0),a); %AddNamedProperty(global,"undefined",(void 0),a); InstallFunctions(global,2,$Array( "isNaN",GlobalIsNaN, "isFinite",GlobalIsFinite, "parseInt",GlobalParseInt, "parseFloat",GlobalParseFloat, "eval",GlobalEval )); } SetUpGlobal(); var DefaultObjectToString=NoSideEffectsObjectToString; function NoSideEffectsObjectToString(){ if((this===(void 0))&&!(%_IsUndetectableObject(this)))return"[object Undefined]"; if((this===null))return"[object Null]"; return"[object "+%_ClassOf(((%_IsSpecObject(%IS_VAR(this)))?this: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((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); } function ObjectHasOwnProperty(a){ if(%_IsJSProxy(this)){ if((typeof(a)==='symbol'))return false; var b=%GetHandler(this); return CallTrap1(b,"hasOwn",DerivedHasOwnTrap,ToName(a)); } return %HasOwnProperty(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)),ToName(a)); } function ObjectIsPrototypeOf(a){ if(!(%_IsSpecObject(a)))return false; if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Object.prototype.isPrototypeOf"]); return %IsInPrototypeChain(this,a); } function ObjectPropertyIsEnumerable(a){ var b=ToName(a); if(%_IsJSProxy(this)){ if((typeof(a)==='symbol'))return false; var c=GetOwnPropertyJS(this,b); return(c===(void 0))?false:c.isEnumerable(); } return %IsPropertyEnumerable(((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)),b); } function ObjectDefineGetter(a,b){ var c=this; if(c==null&&!(%_IsUndetectableObject(c))){ c=%GlobalProxy(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(((%_IsSpecObject(%IS_VAR(c)))?c:ToObject(c)),ToName(a),d,false); } function ObjectLookupGetter(a){ var b=this; if(b==null&&!(%_IsUndetectableObject(b))){ b=%GlobalProxy(global); } return %LookupAccessor(((%_IsSpecObject(%IS_VAR(b)))?b:ToObject(b)),ToName(a),0); } function ObjectDefineSetter(a,b){ var c=this; if(c==null&&!(%_IsUndetectableObject(c))){ c=%GlobalProxy(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(((%_IsSpecObject(%IS_VAR(c)))?c:ToObject(c)),ToName(a),d,false); } function ObjectLookupSetter(a){ var b=this; if(b==null&&!(%_IsUndetectableObject(b))){ b=%GlobalProxy(global); } return %LookupAccessor(((%_IsSpecObject(%IS_VAR(b)))?b:ToObject(b)),ToName(a),1); } function ObjectKeys(a){ a=((%_IsSpecObject(%IS_VAR(a)))?a:ToObject(a)); if(%_IsJSProxy(a)){ var b=%GetHandler(a); var c=CallTrap0(b,"keys",DerivedKeysTrap); return ToNameArray(c,"keys",false); } return %OwnKeys(a); } function IsAccessorDescriptor(a){ if((a===(void 0)))return false; return a.hasGetter()||a.hasSetter(); } function IsDataDescriptor(a){ if((a===(void 0)))return false; return a.hasValue()||a.hasWritable(); } function IsGenericDescriptor(a){ if((a===(void 0)))return false; return!(IsAccessorDescriptor(a)||IsDataDescriptor(a)); } function IsInconsistentDescriptor(a){ return IsAccessorDescriptor(a)&&IsDataDescriptor(a); } function FromPropertyDescriptor(a){ if((a===(void 0)))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((a===(void 0)))return a; var b=new $Object(); if(a.hasValue()){ %AddNamedProperty(b,"value",a.getValue(),0); } if(a.hasWritable()){ %AddNamedProperty(b,"writable",a.isWritable(),0); } if(a.hasGetter()){ %AddNamedProperty(b,"get",a.getGet(),0); } if(a.hasSetter()){ %AddNamedProperty(b,"set",a.getSet(),0); } if(a.hasEnumerable()){ %AddNamedProperty(b,"enumerable",a.isEnumerable(),0); } if(a.hasConfigurable()){ %AddNamedProperty(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(!(c===(void 0))&&!(%_ClassOf(c)==='Function')){ throw MakeTypeError("getter_must_be_callable",[c]); } b.setGet(c); } if("set"in a){ var d=a.set; if(!(d===(void 0))&&!(%_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 PropertyDescriptor_ToString(){ return"[object PropertyDescriptor]"; }, "setValue",function PropertyDescriptor_SetValue(a){ this.value_=a; this.hasValue_=true; }, "getValue",function PropertyDescriptor_GetValue(){ return this.value_; }, "hasValue",function PropertyDescriptor_HasValue(){ return this.hasValue_; }, "setEnumerable",function PropertyDescriptor_SetEnumerable(a){ this.enumerable_=a; this.hasEnumerable_=true; }, "isEnumerable",function PropertyDescriptor_IsEnumerable(){ return this.enumerable_; }, "hasEnumerable",function PropertyDescriptor_HasEnumerable(){ return this.hasEnumerable_; }, "setWritable",function PropertyDescriptor_SetWritable(a){ this.writable_=a; this.hasWritable_=true; }, "isWritable",function PropertyDescriptor_IsWritable(){ return this.writable_; }, "hasWritable",function PropertyDescriptor_HasWritable(){ return this.hasWritable_; }, "setConfigurable", function PropertyDescriptor_SetConfigurable(a){ this.configurable_=a; this.hasConfigurable_=true; }, "hasConfigurable",function PropertyDescriptor_HasConfigurable(){ return this.hasConfigurable_; }, "isConfigurable",function PropertyDescriptor_IsConfigurable(){ return this.configurable_; }, "setGet",function PropertyDescriptor_SetGetter(a){ this.get_=a; this.hasGetter_=true; }, "getGet",function PropertyDescriptor_GetGetter(){ return this.get_; }, "hasGetter",function PropertyDescriptor_HasGetter(){ return this.hasGetter_; }, "setSet",function PropertyDescriptor_SetSetter(a){ this.set_=a; this.hasSetter_=true; }, "getSet",function PropertyDescriptor_GetSetter(){ return this.set_; }, "hasSetter",function PropertyDescriptor_HasSetter(){ return this.hasSetter_; })); function ConvertDescriptorArrayToDescriptor(a){ if((a===(void 0))){ 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((d===(void 0))){ if((c===(void 0))){ 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 GetOwnPropertyJS(a,b){ var c=ToName(b); if(%_IsJSProxy(a)){ if((typeof(b)==='symbol'))return(void 0); var d=%GetHandler(a); var e=CallTrap1( d,"getOwnPropertyDescriptor",(void 0),c); if((e===(void 0)))return e; var g=ToCompletePropertyDescriptor(e); if(!g.isConfigurable()){ throw MakeTypeError("proxy_prop_not_configurable", [d,"getOwnPropertyDescriptor",c,e]); } return g; } var h=%GetOwnProperty(((%_IsSpecObject(%IS_VAR(a)))?a:ToObject(a)),c); return ConvertDescriptorArrayToDescriptor(h); } function Delete(a,b,c){ var d=GetOwnPropertyJS(a,b); if((d===(void 0)))return true; if(d.isConfigurable()){ %DeleteProperty(a,b,0); return true; }else if(c){ throw MakeTypeError("define_disallowed",[b]); }else{ return; } } function GetMethod(a,b){ var c=a[b]; if((c==null))return(void 0); if((%_ClassOf(c)==='Function'))return c; throw MakeTypeError('called_non_callable',[typeof c]); } function DefineProxyProperty(a,b,c,d){ if((typeof(b)==='symbol'))return false; var e=%GetHandler(a); var g=CallTrap2(e,"defineProperty",(void 0),b,c); if(!ToBoolean(g)){ if(d){ throw MakeTypeError("handler_returned_false", [e,"defineProperty"]); }else{ return false; } } return true; } function DefineObjectProperty(a,b,c,d){ var e=%GetOwnProperty(a,ToName(b)); var g=ConvertDescriptorArrayToDescriptor(e); var h=%IsExtensible(a); if((g===(void 0))&&!h){ if(d){ throw MakeTypeError("define_disallowed",[b]); }else{ return false; } } if(!(g===(void 0))){ if((IsGenericDescriptor(c)|| IsDataDescriptor(c)==IsDataDescriptor(g))&& (!c.hasEnumerable()|| SameValue(c.isEnumerable(),g.isEnumerable()))&& (!c.hasConfigurable()|| SameValue(c.isConfigurable(),g.isConfigurable()))&& (!c.hasWritable()|| SameValue(c.isWritable(),g.isWritable()))&& (!c.hasValue()|| SameValue(c.getValue(),g.getValue()))&& (!c.hasGetter()|| SameValue(c.getGet(),g.getGet()))&& (!c.hasSetter()|| SameValue(c.getSet(),g.getSet()))){ return true; } if(!g.isConfigurable()){ if(c.isConfigurable()|| (c.hasEnumerable()&& c.isEnumerable()!=g.isEnumerable())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(!IsGenericDescriptor(c)){ if(IsDataDescriptor(g)!=IsDataDescriptor(c)){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(IsDataDescriptor(g)&&IsDataDescriptor(c)){ if(!g.isWritable()&&c.isWritable()){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(!g.isWritable()&&c.hasValue()&& !SameValue(c.getValue(),g.getValue())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } } if(IsAccessorDescriptor(c)&&IsAccessorDescriptor(g)){ if(c.hasSetter()&&!SameValue(c.getSet(),g.getSet())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } if(c.hasGetter()&&!SameValue(c.getGet(),g.getGet())){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } } } } } var i=0; if(c.hasEnumerable()){ i|=c.isEnumerable()?0:2; }else if(!(g===(void 0))){ i|=g.isEnumerable()?0:2; }else{ i|=2; } if(c.hasConfigurable()){ i|=c.isConfigurable()?0:4; }else if(!(g===(void 0))){ i|=g.isConfigurable()?0:4; }else i|=4; if(IsDataDescriptor(c)|| (IsGenericDescriptor(c)&& ((g===(void 0))||IsDataDescriptor(g)))){ if(c.hasWritable()){ i|=c.isWritable()?0:1; }else if(!(g===(void 0))){ i|=g.isWritable()?0:1; }else{ i|=1; } var j=(void 0); if(c.hasValue()){ j=c.getValue(); }else if(!(g===(void 0))&&IsDataDescriptor(g)){ j=g.getValue(); } %DefineDataPropertyUnchecked(a,b,j,i); }else{ var k=null; if(c.hasGetter()){ k=c.getGet(); }else if(IsAccessorDescriptor(g)&&g.hasGetter()){ k=g.getGet(); } var l=null; if(c.hasSetter()){ l=c.getSet(); }else if(IsAccessorDescriptor(g)&&g.hasSetter()){ l=g.getSet(); } %DefineAccessorPropertyUnchecked(a,b,k,l,i); } return true; } function DefineArrayProperty(a,b,c,d){ if(b==="length"){ var e=a.length; var g=e; if(!c.hasValue()){ return DefineObjectProperty(a,"length",c,d); } var h=ToUint32(c.getValue()); if(h!=ToNumber(c.getValue())){ throw new $RangeError('defineProperty() array length out of range'); } var i=GetOwnPropertyJS(a,"length"); if(h!=e&&!i.isWritable()){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } var j=false; var k=%IsObserved(a)&&h!==g; var l; if(k){ BeginPerformSplice(a); l=[]; if(hg?h-g:0); } if(j){ if(d){ throw MakeTypeError("redefine_disallowed",[b]); }else{ return false; } } return true; } if(!(typeof(b)==='symbol')){ var m=ToUint32(b); var k=false; if(ToString(m)==b&&m!=4294967295){ var e=a.length; if(m>=e&&%IsObserved(a)){ k=true; BeginPerformSplice(a); } var i=GetOwnPropertyJS(a,"length"); if((m>=e&&!i.isWritable())|| !DefineObjectProperty(a,b,c,true)){ if(k) EndPerformSplice(a); if(d){ throw MakeTypeError("define_disallowed",[b]); }else{ return false; } } if(m>=e){ a.length=m+1; } if(k){ EndPerformSplice(a); EnqueueSpliceRecord(a,e,[],m+1-e); } return true; } } return DefineObjectProperty(a,b,c,d); } function DefineOwnProperty(a,b,c,d){ if(%_IsJSProxy(a)){ if((typeof(b)==='symbol'))return false; 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 ObjectSetPrototypeOf(a,b){ if((a==null)&&!(%_IsUndetectableObject(a)))throw MakeTypeError('called_on_null_or_undefined',["Object.setPrototypeOf"]); if(b!==null&&!(%_IsSpecObject(b))){ throw MakeTypeError("proto_object_or_null",[b]); } if((%_IsSpecObject(a))){ %SetPrototype(a,b); } return a; } function ObjectGetOwnPropertyDescriptor(a,b){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("called_on_non_object", ["Object.getOwnPropertyDescriptor"]); } var c=GetOwnPropertyJS(a,b); return FromPropertyDescriptor(c); } function ToNameArray(a,b,c){ if(!(%_IsSpecObject(a))){ throw MakeTypeError("proxy_non_object_prop_names",[a,b]); } var d=ToUint32(a.length); var e=new $Array(d); var g=0; var h={__proto__:null}; for(var i=0;i36){ throw new $RangeError('toString() radix argument must be between 2 and 36'); } return %NumberToRadixString(b,a); } function NumberToLocaleString(){ return %_CallFunction(this,NumberToStringJS); } function NumberValueOf(){ if(!(typeof(this)==='number')&&!(%_ClassOf(this)==='Number')){ throw new $TypeError('Number.prototype.valueOf is not generic'); } return %_ValueOf(this); } function NumberToFixedJS(a){ var b=this; if(!(typeof(this)==='number')){ if(!(%_ClassOf(this)==='Number')){ throw MakeTypeError("incompatible_method_receiver", ["Number.prototype.toFixed",this]); } b=%_ValueOf(this); } var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(c<0||c>20){ throw new $RangeError("toFixed() digits argument must be between 0 and 20"); } if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; if(b==(1/0))return"Infinity"; if(b==-(1/0))return"-Infinity"; return %NumberToFixed(b,c); } function NumberToExponentialJS(a){ var b=this; if(!(typeof(this)==='number')){ if(!(%_ClassOf(this)==='Number')){ throw MakeTypeError("incompatible_method_receiver", ["Number.prototype.toExponential",this]); } b=%_ValueOf(this); } var c=(a===(void 0))?(void 0):(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; if(b==(1/0))return"Infinity"; if(b==-(1/0))return"-Infinity"; if((c===(void 0))){ c=-1; }else if(c<0||c>20){ throw new $RangeError("toExponential() argument must be between 0 and 20"); } return %NumberToExponential(b,c); } function NumberToPrecisionJS(a){ var b=this; if(!(typeof(this)==='number')){ if(!(%_ClassOf(this)==='Number')){ throw MakeTypeError("incompatible_method_receiver", ["Number.prototype.toPrecision",this]); } b=%_ValueOf(this); } if((a===(void 0)))return ToString(%_ValueOf(this)); var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if((!%_IsSmi(%IS_VAR(b))&&!(b==b)))return"NaN"; if(b==(1/0))return"Infinity"; if(b==-(1/0))return"-Infinity"; if(c<1||c>21){ throw new $RangeError("toPrecision() argument must be between 1 and 21"); } return %NumberToPrecision(b,c); } function NumberIsFinite(a){ return(typeof(a)==='number')&&(%_IsSmi(%IS_VAR(a))||((a==a)&&(a!=1/0)&&(a!=-1/0))); } function NumberIsInteger(a){ return NumberIsFinite(a)&&(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a)))==a; } function NumberIsNaN(a){ return(typeof(a)==='number')&&(!%_IsSmi(%IS_VAR(a))&&!(a==a)); } function NumberIsSafeInteger(a){ if(NumberIsFinite(a)){ var b=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(b==a)return $abs(b)<=$Number.MAX_SAFE_INTEGER; } return false; } function SetUpNumber(){ %CheckIsBootstrapping(); %SetCode($Number,NumberConstructor); %FunctionSetPrototype($Number,new $Number(0)); %OptimizeObjectForAddingMultipleProperties($Number.prototype,8); %AddNamedProperty($Number.prototype,"constructor",$Number,2); InstallConstants($Number,$Array( "MAX_VALUE",1.7976931348623157e+308, "MIN_VALUE",5e-324, "NaN",$NaN, "NEGATIVE_INFINITY",-(1/0), "POSITIVE_INFINITY",(1/0), "MAX_SAFE_INTEGER",%_MathPow(2,53)-1, "MIN_SAFE_INTEGER",-%_MathPow(2,53)+1, "EPSILON",%_MathPow(2,-52) )); InstallFunctions($Number.prototype,2,$Array( "toString",NumberToStringJS, "toLocaleString",NumberToLocaleString, "valueOf",NumberValueOf, "toFixed",NumberToFixedJS, "toExponential",NumberToExponentialJS, "toPrecision",NumberToPrecisionJS )); InstallFunctions($Number,2,$Array( "isFinite",NumberIsFinite, "isInteger",NumberIsInteger, "isNaN",NumberIsNaN, "isSafeInteger",NumberIsSafeInteger, "parseInt",GlobalParseInt, "parseFloat",GlobalParseFloat )); } SetUpNumber(); function FunctionSourceString(a){ while(%IsJSFunctionProxy(a)){ a=%GetCallTrap(a); } if(!(%_IsFunction(a))){ throw new $TypeError('Function.prototype.toString is not generic'); } var b=%ClassGetSourceCode(a); if((typeof(b)==='string')){ return b; } var c=%FunctionGetSourceCode(a); if(!(typeof(c)==='string')||%FunctionIsBuiltin(a)){ var d=%FunctionGetName(a); if(d){ return'function '+d+'() { [native code] }'; }else{ return'function () { [native code] }'; } } if(%FunctionIsArrow(a)){ return c; } var d=%FunctionNameShouldPrintAsAnonymous(a) ?'anonymous' :%FunctionGetName(a); var e=%FunctionIsGenerator(a); var g=%FunctionIsConciseMethod(a) ?(e?'*':'') :(e?'function* ':'function '); return g+d+c; } 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 g=new InternalArray(e+d); for(var h=0;h>>0)===k)){ var d=%_ArgumentsLength(); if(d>0)d--; j=k-d; if(j<0)j=0; } var l=%FunctionBindArguments(b,this, a,j); return l; } function NewFunctionFromString(a,b){ var c=a.length; var d=''; if(c>1){ d=ToString(a[0]); for(var e=1;e0)?ToString(a[c-1]):''; var h='('+b+'('+d+') {\n'; var i=h+g+'\n})'; var j=%GlobalProxy(global); var k=%_CallFunction(j,%CompileString(i,true,h.length)); %FunctionMarkNameShouldPrintAsAnonymous(k); return k; } function FunctionConstructor(a){ return NewFunctionFromString(arguments,'function'); } function SetUpFunction(){ %CheckIsBootstrapping(); %SetCode($Function,FunctionConstructor); %AddNamedProperty($Function.prototype,"constructor",$Function,2); InstallFunctions($Function.prototype,2,$Array( "bind",FunctionBind, "toString",FunctionToString )); } SetUpFunction(); function GetIterator(a,b){ if((b===(void 0))){ b=a[symbolIterator]; } if(!(%_ClassOf(b)==='Function')){ throw MakeTypeError('not_iterable',[a]); } var c=%_CallFunction(a,b); if(!(%_IsSpecObject(c))){ throw MakeTypeError('not_an_iterator',[c]); } return c; } symbolY var $symbolToString; (function(){ "use strict"; %CheckIsBootstrapping(); var a=global.Array; var b=global.Object; var c=global.Symbol; function SymbolConstructor(d){ if(%_IsConstructCall()){ throw MakeTypeError('not_constructor',["Symbol"]); } return %CreateSymbol((d===(void 0))?d:ToString(d)); } function SymbolToString(){ if(!((typeof(this)==='symbol')||(%_ClassOf(this)==='Symbol'))){ throw MakeTypeError( 'incompatible_method_receiver',["Symbol.prototype.toString",this]); } var e=%SymbolDescription(%_ValueOf(this)); return"Symbol("+((e===(void 0))?"":e)+")"; } function SymbolValueOf(){ if(!((typeof(this)==='symbol')||(%_ClassOf(this)==='Symbol'))){ throw MakeTypeError( 'incompatible_method_receiver',["Symbol.prototype.valueOf",this]); } return %_ValueOf(this); } function SymbolFor(g){ g=((typeof(%IS_VAR(g))==='string')?g:NonStringToString(g)); var h=%SymbolRegistry(); if((h.for[g]===(void 0))){ var i=%CreateSymbol(g); h.for[g]=i; h.keyFor[i]=g; } return h.for[g]; } function SymbolKeyFor(i){ if(!(typeof(i)==='symbol'))throw MakeTypeError("not_a_symbol",[i]); return %SymbolRegistry().keyFor[i]; } function ObjectGetOwnPropertySymbols(j){ j=ToObject(j); return ObjectGetOwnPropertyKeys(j,8); } %SetCode(c,SymbolConstructor); %FunctionSetPrototype(c,new b()); InstallConstants(c,a( "iterator",symbolIterator, "unscopables",symbolUnscopables )); InstallFunctions(c,2,a( "for",SymbolFor, "keyFor",SymbolKeyFor )); %AddNamedProperty( c.prototype,"constructor",c,2); %AddNamedProperty( c.prototype,symbolToStringTag,"Symbol",2|1); InstallFunctions(c.prototype,2,a( "toString",SymbolToString, "valueOf",SymbolValueOf )); InstallFunctions(b,2,a( "getOwnPropertySymbols",ObjectGetOwnPropertySymbols )); $symbolToString=SymbolToString; })(); arrayćx "use strict"; var visited_arrays=new InternalArray(); function GetSortedArrayKeys(a,b){ var c=new InternalArray(); if((typeof(b)==='number')){ var d=b; for(var e=0;e>2; var g=%EstimateNumberOfElements(a); return(gg*4); } 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,b)){ %NormalizeElements(a); if(c.length==0){ return SparseJoin(a,b,d); }else{ return SparseJoinWithSeparatorJS(a,b,d,c); } } if(b==1){ var g=a[0]; if((typeof(g)==='string'))return g; return d(g); } var h=new InternalArray(b); if(c.length==0){ var i=0; for(var j=0;j=b){ var k=a[n]; if(!(k===(void 0))||n in a){ %AddElement(g,n-b,k,0); } } } } } } function SparseMove(a,b,c,d,g){ if(g===c)return; var h=new InternalArray( $min(d-c+g,0xffffffff)); var i; var j=%GetArrayKeys(a,d); if((typeof(j)==='number')){ var k=j; for(var l=0;l=b+c){ var m=a[q]; if(!(m===(void 0))||q in a){ var r=q-c+g; h[r]=m; if(r>0xffffffff){ i=i||new InternalArray(); i.push(r); } } } } } } %MoveArrayContents(h,a); if(!(i===(void 0))){ var n=i.length; for(var l=0;lc){ for(var i=d-c;i>b;i--){ var j=i+c-1; var k=i+g-1; if(((h&&%_HasFastPackedElements(%IS_VAR(a)))?(jd-c+g;i--){ delete a[i-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,DefaultObjectToString); } 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"]); var b=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); var c=(b.length>>>0); if((a===(void 0))){ a=','; }else if(!(typeof(a)==='string')){ a=NonStringToString(a); } var d=%_FastOneByteArrayJoin(b,a); if(!(d===(void 0)))return d; if(c===1){ var g=b[0]; if((typeof(g)==='string'))return g; if((g==null))return''; return NonStringToString(g); } return Join(b,c,a,ConvertToString); } function ObservedArrayPop(a){ a--; var b=this[a]; try{ BeginPerformSplice(this); delete this[a]; this.length=a; }finally{ EndPerformSplice(this); EnqueueSpliceRecord(this,a,[b],0); } return b; } function ArrayPop(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.pop"]); var a=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); var b=(a.length>>>0); if(b==0){ a.length=b; return; } if(%IsObserved(a)) return ObservedArrayPop.call(a,b); b--; var c=a[b]; Delete(a,ToName(b),true); a.length=b; return c; } function ObservedArrayPush(){ var a=(this.length>>>0); var b=%_ArgumentsLength(); try{ BeginPerformSplice(this); for(var c=0;c>>0); var c=%_ArgumentsLength(); for(var d=0;d=h){ k=h; while(c[++g]==h){} l=b-h-1; } var m=a[k]; if(!(m===(void 0))||k in a){ var o=a[l]; if(!(o===(void 0))||l in a){ a[k]=o; a[l]=m; }else{ a[l]=m; delete a[k]; } }else{ var o=a[l]; if(!(o===(void 0))||l in a){ a[k]=o; delete a[l]; } } } } function ArrayReverse(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.reverse"]); var a=((%_IsSpecObject(%IS_VAR(this)))?this:ToObject(this)); var b=(a.length>>>0); if(UseSparseVariant(a,b,(%_IsArray(a)),b)){ %NormalizeElements(a); SparseReverse(a,b); return a; } var c=b-1; for(var d=0;d>>0); if(b===0){ a.length=0; return; } if(ObjectIsSealed(a)){ throw MakeTypeError("array_functions_change_sealed", ["Array.prototype.shift"]); } if(%IsObserved(a)) return ObservedArrayShift.call(a,b); var c=a[0]; if(UseSparseVariant(a,b,(%_IsArray(a)),b)){ SparseMove(a,0,1,b,0); }else{ SimpleMove(a,0,1,b,0); } a.length=b-1; return c; } function ObservedArrayUnshift(){ var a=(this.length>>>0); var b=%_ArgumentsLength(); try{ BeginPerformSplice(this); SimpleMove(this,0,0,a,b); for(var c=0;c>>0); var d=%_ArgumentsLength(); if(c>0&&UseSparseVariant(b,c,(%_IsArray(b)),c)&& !ObjectIsSealed(b)){ SparseMove(b,0,0,c,d); }else{ SimpleMove(b,0,0,c,d); } for(var g=0;g>>0); var g=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); var h=d; if(!(b===(void 0)))h=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(g<0){ g+=d; if(g<0)g=0; }else{ if(g>d)g=d; } if(h<0){ h+=d; if(h<0)h=0; }else{ if(h>d)h=d; } var i=[]; if(hb?b:a; } function ComputeSpliceDeleteCount(a,b,c,d){ var g=0; if(b==1) return c-d; g=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(g<0) return 0; if(g>c-d) return c-d; return g; } function ObservedArraySplice(a,b){ var c=%_ArgumentsLength(); var d=(this.length>>>0); var g=ComputeSpliceStartIndex((%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))),d); var h=ComputeSpliceDeleteCount(b,c,d, g); var i=[]; i.length=h; var j=c>2?c-2:0; try{ BeginPerformSplice(this); SimpleSlice(this,g,h,d,i); SimpleMove(this,g,h,d,j); var k=g; var l=2; var m=%_ArgumentsLength(); while(l>>0); var h=ComputeSpliceStartIndex((%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))),g); var i=ComputeSpliceDeleteCount(b,c,g, h); var j=[]; j.length=i; var k=c>2?c-2:0; if(i!=k&&ObjectIsSealed(d)){ throw MakeTypeError("array_functions_change_sealed", ["Array.prototype.splice"]); }else if(i>0&&ObjectIsFrozen(d)){ throw MakeTypeError("array_functions_on_frozen", ["Array.prototype.splice"]); } var l=i; if(k!=i){ l+=g-h-i; } if(UseSparseVariant(d,g,(%_IsArray(d)),l)){ %NormalizeElements(d); %NormalizeElements(j); SparseSlice(d,h,i,g,j); SparseMove(d,h,i,g,k); }else{ SimpleSlice(d,h,i,g,j); SimpleMove(d,h,i,g,k); } var m=h; var o=2; var q=%_ArgumentsLength(); while(o=i;m--){ var o=h[m]; var q=%_CallFunction(d,o,l,a); if(q>0){ h[m+1]=o; }else{ break; } } h[m+1]=l; } }; var r=function(h,i,j){ var t=[]; var u=200+((j-i)&15); for(var k=i+1,m=0;k>1][0]; return z; } var A=function QuickSort(h,i,j){ var z=0; while(true){ if(j-i<=10){ g(h,i,j); return; } if(j-i>1000){ z=r(h,i,j); }else{ z=i+((j-i)>>1); } var B=h[i]; var C=h[j-1]; var D=h[z]; var E=%_CallFunction(d,B,C,a); if(E>0){ var o=B; B=C; C=o; } var G=%_CallFunction(d,B,D,a); if(G>=0){ var o=B; B=D; D=C; C=o; }else{ var H=%_CallFunction(d,C,D,a); if(H>0){ var o=C; C=D; D=o; } } h[i]=B; h[j-1]=D; var I=C; var J=i+1; var K=j-1; h[z]=h[J]; h[J]=I; partition:for(var k=J+1;k0){ do{ K--; if(K==k)break partition; var L=h[K]; q=%_CallFunction(d,L,I,a); }while(q>0); h[k]=h[K]; h[K]=l; if(q<0){ l=h[k]; h[k]=h[J]; h[J]=l; J++; } } } if(j-K=Q){Q=k+1;} } } }else{ for(var k=0;k=Q){Q=U+1;} } } } } return Q; }; var W=function(N,i,j){ for(var R=%_GetPrototype(N);R;R=%_GetPrototype(R)){ var S=%GetArrayKeys(R,j); if((typeof(S)==='number')){ var T=S; for(var k=i;k>>0); if(P<2)return this; var ab=(%_IsArray(this)); var ac; if(!ab){ ac=M(this,P); } var ad=%RemoveArrayHoles(this,P); if(ad==-1){ ad=X(this); } A(this,0,ad); if(!ab&&(ad+1>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var g=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var h=(%_IsArray(c)); var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var j=0;j>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var g=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var h=(%_IsArray(c)); var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var j=0;j>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var g=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var h=(%_IsArray(c)); var i=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var j=0;j>>0); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var g=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ g=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var h=new $Array(); var i=new InternalArray(d); var j=(%_IsArray(c)); var k=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var l=0;l>>0); if(c==0)return-1; if((b===(void 0))){ 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)),g-d)){ %NormalizeElements(this); var h=%GetArrayKeys(this,c); if((typeof(h)==='number')){ g=h; }else{ if(h.length==0)return-1; var i=GetSortedArrayKeys(this,h); var j=i.length; var k=0; while(k>>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)),b)){ %NormalizeElements(this); var h=%GetArrayKeys(this,b+1); if((typeof(h)==='number')){ g=h; }else{ if(h.length==0)return-1; var i=GetSortedArrayKeys(this,h); var j=i.length-1; while(j>=0){ var k=i[j]; if(!(k===(void 0))&&this[k]===a)return k; j--; } return-1; } } if(!(a===(void 0))){ for(var j=g;j>=d;j--){ if(this[j]===a)return j; } return-1; } for(var j=g;j>=d;j--){ if((this[j]===(void 0))&&j in this){ return j; } } 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=(%_IsArray(c)); var h=0; find_initial:if(%_ArgumentsLength()<2){ for(;h=0;h--){ if(((g&&%_HasFastPackedElements(%IS_VAR(c)))?(h=0;h--){ if(((g&&%_HasFastPackedElements(%IS_VAR(c)))?(h1){ t=%_Arguments(1); t=(%_IsSmi(%IS_VAR(t))?t:%NumberToInteger(ToNumber(t))); if(t<0)t=0; if(t>r.length)t=r.length; } return %StringIndexOf(r,q,t); } function StringLastIndexOfJS(u){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.lastIndexOf"]); var w=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var z=w.length; var u=((typeof(%IS_VAR(u))==='string')?u:NonStringToString(u)); var A=u.length; var t=z-A; if(%_ArgumentsLength()>1){ var B=ToNumber(%_Arguments(1)); if(!(!%_IsSmi(%IS_VAR(B))&&!(B==B))){ B=(%_IsSmi(%IS_VAR(B))?B:%NumberToInteger(ToNumber(B))); if(B<0){ B=0; } if(B+A0xFF&& (typeof(K)==='string')&& %StringIndexOf(K,'$',0)<0){ return %StringReplaceOneCharWithString(r,J,K); } var P=%StringIndexOf(r,J,0); if(P<0)return r; var Q=P+J.length; var h=%_SubString(r,0,P); if((%_ClassOf(K)==='Function')){ var R=%GetDefaultReceiver(K); h+=%_CallFunction(R,J,P,r,K); }else{ I[3]=P; I[4]=Q; h=ExpandReplacement(((typeof(%IS_VAR(K))==='string')?K:NonStringToString(K)), r, I, h); } return h+%_SubString(r,Q,r.length); } function ExpandReplacement(S,r,T,h){ var U=S.length; var W=%StringIndexOf(S,'$',0); if(W<0){ if(U>0)h+=S; return h; } if(W>0)h+=%_SubString(S,0,W); while(true){ var X='$'; var B=W+1; if(B=48&&Y<=57){ var Z=(Y-48)<<1; var aa=1; var ab=((T)[0]); if(B+1=48&&W<=57){ var ac=Z*10+((W-48)<<1); if(ac=0){ h+= %_SubString(r,P,T[(3+(Z+1))]); } B+=aa; }else{ h+='$'; } }else{ h+='$'; } }else{ h+='$'; } W=%StringIndexOf(S,'$',B); if(W<0){ if(BB){ h+=%_SubString(S,B,W); } } return h; } function CaptureString(S,ad,t){ var ae=t<<1; var P=ad[(3+(ae))]; if(P<0)return; var Q=ad[(3+(ae+1))]; return %_SubString(S,P,Q); } var af=new InternalArray(16); function StringReplaceGlobalRegExpWithFunction(r,C,K){ var ag=af; if(ag){ af=null; }else{ ag=new InternalArray(16); } var ah=%RegExpExecMultiple(C, r, $regexpLastMatchInfo, ag); C.lastIndex=0; if((ah===null)){ af=ag; return r; } var j=ah.length; if((($regexpLastMatchInfo)[0])==2){ var ai=0; var aj=new InternalPackedArray(null,0,r); var R=%GetDefaultReceiver(K); for(var m=0;m0){ ai=(ak>>11)+(ak&0x7ff); }else{ ai=ah[++m]-ak; } }else{ aj[0]=ak; aj[1]=ai; $regexpLastMatchInfoOverride=aj; var al= %_CallFunction(R,ak,ai,r,K); ah[m]=((typeof(%IS_VAR(al))==='string')?al:NonStringToString(al)); ai+=ak.length; } } }else{ var R=%GetDefaultReceiver(K); for(var m=0;m>1; var ao; var R=%GetDefaultReceiver(K); if(an==1){ var ap=%_SubString(r,t,am); ao=%_CallFunction(R,ap,t,r,K); }else{ var aq=new InternalArray(an+2); for(var ar=0;arat){ return''; } } if(av<0){ av+=at; if(av<0){ return''; } }else{ if(av>at){ av=at; } } if(av<=au){ return''; } return %_SubString(ap,au,av); } function StringSplitJS(aw,ax){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.split"]); var r=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); ax=((ax===(void 0)))?0xffffffff:(ax>>>0); var U=r.length; if(!(%_IsRegExp(aw))){ var ay=((typeof(%IS_VAR(aw))==='string')?aw:NonStringToString(aw)); if(ax===0)return[]; if((aw===(void 0)))return[r]; var az=ay.length; if(az===0)return %StringToArray(r,ax); var h=%StringSplit(r,ay,ax); return h; } if(ax===0)return[]; return StringSplitOnRegExp(r,aw,ax,U); } function StringSplitOnRegExp(r,aw,ax,U){ if(U===0){ if($regexpExec(aw,r,0,0)!=null){ return[]; } return[r]; } var aA=0; var aB=0; var aC=0; var h=new InternalArray(); outer_loop: while(true){ if(aB===U){ h[h.length]=%_SubString(r,aA,U); break; } var T=$regexpExec(aw,r,aB); if(T==null||U===(aC=T[3])){ h[h.length]=%_SubString(r,aA,U); break; } var aD=T[4]; if(aB===aD&&aD===aA){ aB++; continue; } h[h.length]=%_SubString(r,aA,aC); if(h.length===ax)break; var aE=((T)[0])+3; for(var m=3+2;mat){ au=at; } var av=at; if(!(Q===(void 0))){ av=(%_IsSmi(%IS_VAR(Q))?Q:%NumberToInteger(ToNumber(Q))); if(av>at){ av=at; }else{ if(av<0)av=0; if(au>av){ var aG=av; av=au; au=aG; } } } return %_SubString(ap,au,av); } function StringSubstr(P,aH){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.substr"]); var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var j; if((aH===(void 0))){ j=ap.length; }else{ j=(%_IsSmi(%IS_VAR(aH))?aH:%NumberToInteger(ToNumber(aH))); if(j<=0)return''; } if((P===(void 0))){ P=0; }else{ P=(%_IsSmi(%IS_VAR(P))?P:%NumberToInteger(ToNumber(P))); if(P>=ap.length)return''; if(P<0){ P+=ap.length; if(P<0)P=0; } } var Q=P+j; if(Q>ap.length)Q=ap.length; return %_SubString(ap,P,Q); } function StringToLowerCaseJS(){ 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 StringToUpperCaseJS(){ 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 StringTrimJS(){ 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); } function StringFromCharCode(aI){ var aH=%_ArgumentsLength(); if(aH==1){ if(!%_IsSmi(aI))aI=ToNumber(aI); return %_StringCharFromCode(aI&0xffff); } var aJ=%NewString(aH,true); var m; for(m=0;m0xff)break; %_OneByteSeqStringSetChar(m,aI,aJ); } if(m==aH)return aJ; aJ=%TruncateString(aJ,m); var aK=%NewString(aH-m,false); for(var ar=0;m"+this+""; } function StringBig(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.big"]); return""+this+""; } function StringBlink(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.blink"]); return""+this+""; } function StringBold(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.bold"]); return""+this+""; } function StringFixed(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fixed"]); return""+this+""; } function StringFontcolor(aN){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fontcolor"]); return""+this+""; } function StringFontsize(aO){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.fontsize"]); return""+this+""; } function StringItalics(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.italics"]); return""+this+""; } function StringLink(ap){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.link"]); return""+this+""; } function StringSmall(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.small"]); return""+this+""; } function StringStrike(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.strike"]); return""+this+""; } function StringSub(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.sub"]); return""+this+""; } function StringSup(){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.sup"]); return""+this+""; } function StringRepeat(aP){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.repeat"]); var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var aH=ToInteger(aP); if(aH<0||aH>%_MaxSmi()){ throw MakeRangeError("invalid_count_value",[]); } var aQ=""; while(true){ if(aH&1)aQ+=ap; aH>>=1; if(aH===0)return aQ; ap+=ap; } } function StringStartsWith(aR){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.startsWith"]); var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); if((%_IsRegExp(aR))){ throw MakeTypeError("first_argument_not_regexp", ["String.prototype.startsWith"]); } var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); var g=0; if(%_ArgumentsLength()>1){ g=%_Arguments(1); g=ToInteger(g); } var at=ap.length; var P=$min($max(g,0),at); var aT=aS.length; if(aT+P>at){ return false; } return %StringIndexOf(ap,aS,P)===P; } function StringEndsWith(aR){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.endsWith"]); var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); if((%_IsRegExp(aR))){ throw MakeTypeError("first_argument_not_regexp", ["String.prototype.endsWith"]); } var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); var at=ap.length; var g=at; if(%_ArgumentsLength()>1){ var aU=%_Arguments(1); if(!(aU===(void 0))){ g=ToInteger(aU); } } var Q=$min($max(g,0),at); var aT=aS.length; var P=Q-aT; if(P<0){ return false; } return %StringLastIndexOf(ap,aS,P)===P; } function StringIncludes(aR){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.includes"]); var ap=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); if((%_IsRegExp(aR))){ throw MakeTypeError("first_argument_not_regexp", ["String.prototype.includes"]); } var aS=((typeof(%IS_VAR(aR))==='string')?aR:NonStringToString(aR)); var g=0; if(%_ArgumentsLength()>1){ g=%_Arguments(1); g=ToInteger(g); } var at=ap.length; var P=$min($max(g,0),at); var aT=aS.length; if(aT+P>at){ return false; } return %StringIndexOf(ap,aS,P)!==-1; } function StringCodePointAt(g){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["String.prototype.codePointAt"]); var S=((typeof(%IS_VAR(this))==='string')?this:NonStringToString(this)); var aO=S.length; g=(%_IsSmi(%IS_VAR(g))?g:%NumberToInteger(ToNumber(g))); if(g<0||g>=aO){ return(void 0); } var aV=%_StringCharCodeAt(S,g); if(aV<0xD800||aV>0xDBFF||g+1==aO){ return aV; } var aW=%_StringCharCodeAt(S,g+1); if(aW<0xDC00||aW>0xDFFF){ return aV; } return(aV-0xD800)*0x400+aW+0x2400; } function StringFromCodePoint(aX){ var aI; var U=%_ArgumentsLength(); var t; var h=""; for(t=0;t0x10FFFF||aI!==(%_IsSmi(%IS_VAR(aI))?aI:%NumberToInteger(ToNumber(aI)))){ throw MakeRangeError("invalid_code_point",[aI]); } if(aI<=0xFFFF){ h+=%_StringCharFromCode(aI); }else{ aI-=0x10000; h+=%_StringCharFromCode((aI>>>10)&0x3FF|0xD800); h+=%_StringCharFromCode(aI&0x3FF|0xDC00); } } return h; } function StringRaw(aY){ var aZ=%_ArgumentsLength(); var ba=ToObject(aY); var bb=ToObject(ba.raw); var bc=ToLength(bb.length); if(bc<=0)return""; var h=ToString(bb[0]); 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 isAlphaNumeric(b){ if(97<=b&&b<=122)return true; if(65<=b&&b<=90)return true; if(48<=b&&b<=57)return true; return false; } var c=0; function URIAddEncodedOctetToBuffer(d,g,h){ g[h++]=37; g[h++]=c[d>>4]; g[h++]=c[d&0x0F]; return h; } function URIEncodeOctets(i,g,h){ if(c===0){ c=[48,49,50,51,52,53,54,55,56,57, 65,66,67,68,69,70]; } h=URIAddEncodedOctetToBuffer(i[0],g,h); if(i[1])h=URIAddEncodedOctetToBuffer(i[1],g,h); if(i[2])h=URIAddEncodedOctetToBuffer(i[2],g,h); if(i[3])h=URIAddEncodedOctetToBuffer(i[3],g,h); return h; } function URIEncodeSingle(b,g,h){ var j=(b>>12)&0xF; var k=(b>>6)&63; var l=b&63; var i=new InternalArray(3); if(b<=0x007F){ i[0]=b; }else if(b<=0x07FF){ i[0]=k+192; i[1]=l+128; }else{ i[0]=j+224; i[1]=k+128; i[2]=l+128; } return URIEncodeOctets(i,g,h); } function URIEncodePair(m,o,g,h){ var q=((m>>6)&0xF)+1; var r=(m>>2)&0xF; var j=m&3; var k=(o>>6)&0xF; var l=o&63; var i=new InternalArray(4); i[0]=(q>>2)+240; i[1]=(((q&3)<<4)|r)+128; i[2]=((j<<4)|k)+128; i[3]=l+128; return URIEncodeOctets(i,g,h); } function URIHexCharsToCharCode(t,u){ var w=HexValueOf(t); var z=HexValueOf(u); if(w==-1||z==-1){ throw new $URIError("URI malformed"); } return(w<<4)|z; } function URIDecodeOctets(i,g,h){ var A; var B=i[0]; if(B<0x80){ A=B; }else if(B<0xc2){ throw new $URIError("URI malformed"); }else{ var C=i[1]; if(B<0xe0){ var D=B&0x1f; if((C<0x80)||(C>0xbf)){ throw new $URIError("URI malformed"); } var E=C&0x3f; A=(D<<6)+E; if(A<0x80||A>0x7ff){ throw new $URIError("URI malformed"); } }else{ var G=i[2]; if(B<0xf0){ var D=B&0x0f; if((C<0x80)||(C>0xbf)){ throw new $URIError("URI malformed"); } var E=C&0x3f; if((G<0x80)||(G>0xbf)){ throw new $URIError("URI malformed"); } var H=G&0x3f; A=(D<<12)+(E<<6)+H; if((A<0x800)||(A>0xffff)){ throw new $URIError("URI malformed"); } }else{ var I=i[3]; if(B<0xf8){ var D=(B&0x07); if((C<0x80)||(C>0xbf)){ throw new $URIError("URI malformed"); } var E=(C&0x3f); if((G<0x80)||(G>0xbf)){ throw new $URIError("URI malformed"); } var H=(G&0x3f); if((I<0x80)||(I>0xbf)){ throw new $URIError("URI malformed"); } var J=(I&0x3f); A=(D<<18)+(E<<12)+(H<<6)+J; if((A<0x10000)||(A>0x10ffff)){ throw new $URIError("URI malformed"); } }else{ throw new $URIError("URI malformed"); } } } } if(0xD800<=A&&A<=0xDFFF){ throw new $URIError("URI malformed"); } if(A<0x10000){ %_TwoByteSeqStringSetChar(h++,A,g); }else{ %_TwoByteSeqStringSetChar(h++,(A>>10)+0xd7c0,g); %_TwoByteSeqStringSetChar(h++,(A&0x3ff)+0xdc00,g); } return h; } function Encode(K,L){ var M=K.length; var N=new InternalArray(M); var h=0; for(var P=0;P=0xDC00&&m<=0xDFFF)throw new $URIError("URI malformed"); if(m<0xD800||m>0xDBFF){ h=URIEncodeSingle(m,N,h); }else{ P++; if(P==M)throw new $URIError("URI malformed"); var o=K.charCodeAt(P); if(o<0xDC00||o>0xDFFF)throw new $URIError("URI malformed"); h=URIEncodePair(m,o,N,h); } } } var g=%NewString(N.length,true); for(var Q=0;Q=M)throw new $URIError("URI malformed"); var b=URIHexCharsToCharCode(K.charCodeAt(P+1),K.charCodeAt(P+2)); if(b>>7)break; if(R(b)){ %_OneByteSeqStringSetChar(h++,37,S); %_OneByteSeqStringSetChar(h++,K.charCodeAt(P+1),S); %_OneByteSeqStringSetChar(h++,K.charCodeAt(P+2),S); }else{ %_OneByteSeqStringSetChar(h++,b,S); } P+=2; }else{ if(a>0x7f)break; %_OneByteSeqStringSetChar(h++,a,S); } } S=%TruncateString(S,h); if(P==M)return S; var T=%NewString(M-P,false); h=0; for(;P=M)throw new $URIError("URI malformed"); var b=URIHexCharsToCharCode(K.charCodeAt(++P),K.charCodeAt(++P)); if(b>>7){ var U=0; while(((b<<++U)&0x80)!=0){} if(U==1||U>4)throw new $URIError("URI malformed"); var i=new InternalArray(U); i[0]=b; if(P+3*(U-1)>=M)throw new $URIError("URI malformed"); for(var Q=1;Q0)return c; return 0-c; } function MathAcosJS(c){ return %_MathAcos(+c); } function MathAsinJS(c){ return %_MathAsin(+c); } function MathAtanJS(c){ return %_MathAtan(+c); } function MathAtan2JS(d,c){ d=+d; c=+c; return %_MathAtan2(d,c); } function MathCeil(c){ return-%_MathFloor(-c); } function MathExp(c){ return %MathExpRT(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); } function MathFloorJS(c){ return %_MathFloor(+c); } function MathLog(c){ return %_MathLogRT(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); } function MathMax(g,h){ var i=%_ArgumentsLength(); if(i==2){ g=((typeof(%IS_VAR(g))==='number')?g:NonNumberToNumber(g)); h=((typeof(%IS_VAR(h))==='number')?h:NonNumberToNumber(h)); if(h>g)return h; if(g>h)return g; if(g==h){ return(g===0&&%_IsMinusZero(g))?h:g; } return $NaN; } var j=-(1/0); for(var k=0;kj||(j===0&&l===0&&%_IsMinusZero(j))){ j=l; } } return j; } function MathMin(g,h){ var i=%_ArgumentsLength(); if(i==2){ g=((typeof(%IS_VAR(g))==='number')?g:NonNumberToNumber(g)); h=((typeof(%IS_VAR(h))==='number')?h:NonNumberToNumber(h)); if(h>g)return g; if(g>h)return h; if(g==h){ return(g===0&&%_IsMinusZero(g))?g:h; } return $NaN; } var j=(1/0); for(var k=0;k>>16))|0; rngstate[0]=m; var o=(MathImul(36969,rngstate[1]&0xFFFF)+(rngstate[1]>>>16))|0; rngstate[1]=o; var c=((m<<16)+(o&0xFFFF))|0; return(c<0?(c+0x100000000):c)*2.3283064365386962890625e-10; } function MathRound(c){ return %RoundNumber(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c))); } function MathSqrtJS(c){ return %_MathSqrt(+c); } function MathImul(c,d){ return %NumberImul(((typeof(%IS_VAR(c))==='number')?c:NonNumberToNumber(c)),((typeof(%IS_VAR(d))==='number')?d:NonNumberToNumber(d))); } function MathSign(c){ c=+c; if(c>0)return 1; if(c<0)return-1; return c; } function MathTrunc(c){ c=+c; if(c>0)return %_MathFloor(c); if(c<0)return-%_MathFloor(-c); return c; } function MathTanh(c){ if(!(typeof(c)==='number'))c=NonNumberToNumber(c); if(c===0)return c; if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return MathSign(c); var q=MathExp(c); var r=MathExp(-c); return(q-r)/(q+r); } function MathAsinh(c){ if(!(typeof(c)==='number'))c=NonNumberToNumber(c); if(c===0||!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; if(c>0)return MathLog(c+%_MathSqrt(c*c+1)); return-MathLog(-c+%_MathSqrt(c*c+1)); } function MathAcosh(c){ if(!(typeof(c)==='number'))c=NonNumberToNumber(c); if(c<1)return $NaN; if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; return MathLog(c+%_MathSqrt(c+1)*%_MathSqrt(c-1)); } function MathAtanh(c){ if(!(typeof(c)==='number'))c=NonNumberToNumber(c); if(c===0)return c; if(!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return $NaN; return 0.5*MathLog((1+c)/(1-c)); } function MathHypot(c,d){ var i=%_ArgumentsLength(); var t=new InternalArray(i); var u=0; for(var k=0;ku)u=l; t[k]=l; } if(u===0)u=1; var w=0; var z=0; for(var k=0;k>>0); } function MathCbrt(c){ if(!(typeof(c)==='number'))c=NonNumberToNumber(c); if(c==0||!(%_IsSmi(%IS_VAR(c))||((c==c)&&(c!=1/0)&&(c!=-1/0))))return c; return c>=0?CubeRoot(c):-CubeRoot(-c); } function CubeRoot(c){ var C=MathFloorJS(%_DoubleHi(c)/3)+0x2A9F7893; var D=%_ConstructDouble(C,0); D=(1.0/3.0)*(c/(D*D)+2*D); ; D=(1.0/3.0)*(c/(D*D)+2*D); ; D=(1.0/3.0)*(c/(D*D)+2*D); ; return(1.0/3.0)*(c/(D*D)+2*D); ; } function MathConstructor(){} var E=new MathConstructor(); %InternalSetPrototype(E,a.prototype); %AddNamedProperty(global,"Math",E,2); %FunctionSetInstanceClassName(MathConstructor,'Math'); %AddNamedProperty(E,symbolToStringTag,"Math",1|2); InstallConstants(E,b( "E",2.7182818284590452354, "LN10",2.302585092994046, "LN2",0.6931471805599453, "LOG2E",1.4426950408889634, "LOG10E",0.4342944819032518, "PI",3.1415926535897932, "SQRT1_2",0.7071067811865476, "SQRT2",1.4142135623730951 )); InstallFunctions(E,2,b( "random",MathRandom, "abs",MathAbs, "acos",MathAcosJS, "asin",MathAsinJS, "atan",MathAtanJS, "ceil",MathCeil, "exp",MathExp, "floor",MathFloorJS, "log",MathLog, "round",MathRound, "sqrt",MathSqrtJS, "atan2",MathAtan2JS, "pow",MathPowJS, "max",MathMax, "min",MathMin, "imul",MathImul, "sign",MathSign, "trunc",MathTrunc, "tanh",MathTanh, "asinh",MathAsinh, "acosh",MathAcosh, "atanh",MathAtanh, "hypot",MathHypot, "fround",MathFroundJS, "clz32",MathClz32JS, "cbrt",MathCbrt )); %SetInlineBuiltinFlag(MathAbs); %SetInlineBuiltinFlag(MathAcosJS); %SetInlineBuiltinFlag(MathAsinJS); %SetInlineBuiltinFlag(MathAtanJS); %SetInlineBuiltinFlag(MathAtan2JS); %SetInlineBuiltinFlag(MathCeil); %SetInlineBuiltinFlag(MathClz32JS); %SetInlineBuiltinFlag(MathFloorJS); %SetInlineBuiltinFlag(MathRandom); %SetInlineBuiltinFlag(MathSign); %SetInlineBuiltinFlag(MathSqrtJS); %SetInlineBuiltinFlag(MathTrunc); $abs=MathAbs; $exp=MathExp; $floor=MathFloorJS; $max=MathMax; $min=MathMin; })(); fdlibmą¨ var kMath; var rempio2result; (function(){ "use strict"; %CheckIsBootstrapping(); var a=global.Math; var b=global.Array; function KernelTan(c,d,g){ var h; var i; var j=%_DoubleHi(c); var k=j&0x7fffffff; if(k<0x3e300000){ if(((k|%_DoubleLo(c))|(g+1))==0){ return 1/$abs(c); }else{ if(g==1){ return c; }else{ var i=c+d; var h=%_ConstructDouble(%_DoubleHi(i),0); var l=d-(h-c); var m=-1/i; var o=%_ConstructDouble(%_DoubleHi(m),0); var q=1+o*h; return o+m*(q+o*l); } } } if(k>=0x3fe59428){ if(c<0){ c=-c; d=-d; } h=kMath[32]-c; i=kMath[33]-d; c=h+i; d=0; } h=c*c; i=h*h; var r=kMath[19+1] +i*(kMath[19+3] +i*(kMath[19+5] + i*(kMath[19+7] +i*(kMath[19+9] +i*kMath[19+11] )))); var l=h*(kMath[19+2] +i*(kMath[19+4] +i*(kMath[19+6] + i*(kMath[19+8] +i*(kMath[19+10] +i*kMath[19+12] ))))); var q=h*c; r=d+h*(q*(r+l)+d); r=r+kMath[19+0] *q; i=c+r; if(k>=0x3fe59428){ return(1-((j>>30)&2))* (g-2.0*(c-(i*i/(i+g)-r))); } if(g==1){ return i; }else{ h=%_ConstructDouble(%_DoubleHi(i),0); l=r-(h-c); var m=-1/i; var o=%_ConstructDouble(%_DoubleHi(m),0); q=1+o*h; return o+m*(q+o*l); } } function MathSinSlow(c){ var t,u,w; var j=%_DoubleHi(c); var k=j&0x7fffffff; if(k<0x4002d97c){ if(j>0){ var h=c-kMath[1]; if(k!=0x3ff921fb){ u=h-kMath[2]; w=(h-u)-kMath[2]; }else{ h-=kMath[3]; u=h-kMath[4]; w=(h-u)-kMath[4]; } t=1; }else{ var h=c+kMath[1]; if(k!=0x3ff921fb){ u=h+kMath[2]; w=(h-u)+kMath[2]; }else{ h+=kMath[3]; u=h+kMath[4]; w=(h-u)+kMath[4]; } t=-1; } }else if(k<=0x413921fb){ var o=$abs(c); t=(o*kMath[0]+0.5)|0; var r=o-t*kMath[1]; var i=t*kMath[2]; u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ o=r; i=t*kMath[3]; r=o-i; i=t*kMath[4]-((o-r)-i); u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ o=r; i=t*kMath[5]; r=o-i; i=t*kMath[6]-((o-r)-i); u=r-i; } } w=(r-u)-i; if(j<0){ t=-t; u=-u; w=-w; } }else{ t=%RemPiO2(c,rempio2result); u=rempio2result[0]; w=rempio2result[1]; } ; var z=1-(t&2); if(t&1){ var k=%_DoubleHi(u)&0x7fffffff; var h=u*u; var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); if(k<0x3fd33333){ return(1-(0.5*h-(h*r-u*w)))*z; }else{ var A; if(k>0x3fe90000){ A=0.28125; }else{ A=%_ConstructDouble(%_DoubleHi(0.25*u),0); } var B=0.5*h-A; return(1-A-(B-(h*r-u*w)))*z; } ; }else{ var h=u*u; var l=h*u; var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); return(u-((h*(0.5*w-l*r)-w)-l*-1.66666666666666324348e-01))*z; ; } } function MathCosSlow(c){ var t,u,w; var j=%_DoubleHi(c); var k=j&0x7fffffff; if(k<0x4002d97c){ if(j>0){ var h=c-kMath[1]; if(k!=0x3ff921fb){ u=h-kMath[2]; w=(h-u)-kMath[2]; }else{ h-=kMath[3]; u=h-kMath[4]; w=(h-u)-kMath[4]; } t=1; }else{ var h=c+kMath[1]; if(k!=0x3ff921fb){ u=h+kMath[2]; w=(h-u)+kMath[2]; }else{ h+=kMath[3]; u=h+kMath[4]; w=(h-u)+kMath[4]; } t=-1; } }else if(k<=0x413921fb){ var o=$abs(c); t=(o*kMath[0]+0.5)|0; var r=o-t*kMath[1]; var i=t*kMath[2]; u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ o=r; i=t*kMath[3]; r=o-i; i=t*kMath[4]-((o-r)-i); u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ o=r; i=t*kMath[5]; r=o-i; i=t*kMath[6]-((o-r)-i); u=r-i; } } w=(r-u)-i; if(j<0){ t=-t; u=-u; w=-w; } }else{ t=%RemPiO2(c,rempio2result); u=rempio2result[0]; w=rempio2result[1]; } ; if(t&1){ var z=(t&2)-1; var h=u*u; var l=h*u; var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); return(u-((h*(0.5*w-l*r)-w)-l*-1.66666666666666324348e-01))*z; ; }else{ var z=1-(t&2); var k=%_DoubleHi(u)&0x7fffffff; var h=u*u; var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); if(k<0x3fd33333){ return(1-(0.5*h-(h*r-u*w)))*z; }else{ var A; if(k>0x3fe90000){ A=0.28125; }else{ A=%_ConstructDouble(%_DoubleHi(0.25*u),0); } var B=0.5*h-A; return(1-A-(B-(h*r-u*w)))*z; } ; } } function MathSin(c){ c=+c; if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ var h=c*c; var l=h*c; var r=8.33333333332248946124e-03+h*(-1.98412698298579493134e-04+h*(2.75573137070700676789e-06+h*(-2.50507602534068634195e-08+h*1.58969099521155010221e-10))); return(c-((h*(0.5*0-l*r)-0)-l*-1.66666666666666324348e-01)); ; } return+MathSinSlow(c); } function MathCos(c){ c=+c; if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ var k=%_DoubleHi(c)&0x7fffffff; var h=c*c; var r=h*(4.16666666666666019037e-02+h*(-1.38888888888741095749e-03+h*(2.48015872894767294178e-05+h*(-2.75573143513906633035e-07+h*(2.08757232129817482790e-09+h*-1.13596475577881948265e-11))))); if(k<0x3fd33333){ return(1-(0.5*h-(h*r-c*0))); }else{ var A; if(k>0x3fe90000){ A=0.28125; }else{ A=%_ConstructDouble(%_DoubleHi(0.25*c),0); } var B=0.5*h-A; return(1-A-(B-(h*r-c*0))); } ; } return+MathCosSlow(c); } function MathTan(c){ c=c*1; if((%_DoubleHi(c)&0x7fffffff)<=0x3fe921fb){ return KernelTan(c,0,1); } var t,u,w; var j=%_DoubleHi(c); var k=j&0x7fffffff; if(k<0x4002d97c){ if(j>0){ var h=c-kMath[1]; if(k!=0x3ff921fb){ u=h-kMath[2]; w=(h-u)-kMath[2]; }else{ h-=kMath[3]; u=h-kMath[4]; w=(h-u)-kMath[4]; } t=1; }else{ var h=c+kMath[1]; if(k!=0x3ff921fb){ u=h+kMath[2]; w=(h-u)+kMath[2]; }else{ h+=kMath[3]; u=h+kMath[4]; w=(h-u)+kMath[4]; } t=-1; } }else if(k<=0x413921fb){ var o=$abs(c); t=(o*kMath[0]+0.5)|0; var r=o-t*kMath[1]; var i=t*kMath[2]; u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x1000000){ o=r; i=t*kMath[3]; r=o-i; i=t*kMath[4]-((o-r)-i); u=r-i; if(k-(%_DoubleHi(u)&0x7ff00000)>0x3100000){ o=r; i=t*kMath[5]; r=o-i; i=t*kMath[6]-((o-r)-i); u=r-i; } } w=(r-u)-i; if(j<0){ t=-t; u=-u; w=-w; } }else{ t=%RemPiO2(c,rempio2result); u=rempio2result[0]; w=rempio2result[1]; } ; return KernelTan(u,w,(t&1)?-1:1); } function MathLog1p(c){ c=c*1; var j=%_DoubleHi(c); var C=j&0x7fffffff; var D=1; var E=c; var G=1; var H=0; var I=c; if(j<0x3fda827a){ if(C>=0x3ff00000){ if(c===-1){ return-(1/0); }else{ return $NaN; } }else if(C<0x3c900000){ return c; }else if(C<0x3e200000){ return c-c*c*0.5; } if((j>0)||(j<=-0x402D413D)){ D=0; } } if(j>=0x7ff00000)return c; if(D!==0){ if(j<0x43400000){ I=1+c; G=%_DoubleHi(I); D=(G>>20)-1023; H=(D>0)?1-(I-c):c-(I-1); H=H/I; }else{ G=%_DoubleHi(I); D=(G>>20)-1023; } G=G&0xfffff; if(G<0x6a09e){ I=%_ConstructDouble(G|0x3ff00000,%_DoubleLo(I)); }else{ ++D; I=%_ConstructDouble(G|0x3fe00000,%_DoubleLo(I)); G=(0x00100000-G)>>2; } E=I-1; } var J=0.5*E*E; if(G===0){ if(E===0){ if(D===0){ return 0.0; }else{ return D*kMath[34]+(H+D*kMath[35]); } } var K=J*(1-kMath[36]*E); if(D===0){ return E-K; }else{ return D*kMath[34]-((K-(D*kMath[35]+H))-E); } } var q=E/(2+E); var h=q*q; var K=h*((kMath[37+0]) +h*((kMath[37+1]) +h* ((kMath[37+2]) +h*((kMath[37+3]) +h* ((kMath[37+4]) +h*((kMath[37+5]) +h*(kMath[37+6]) )))))); if(D===0){ return E-(J-q*(J+K)); }else{ return D*kMath[34]-((J-(q*(J+K)+(D*kMath[35]+H)))-E); } } function MathExpm1(c){ c=c*1; var d; var L; var M; var D; var o; var H; var j=%_DoubleHi(c); var N=j&0x80000000; var d=(N===0)?c:-c; j&=0x7fffffff; if(j>=0x4043687a){ if(j>=0x40862e42){ if(j>=0x7ff00000){ return(c===-(1/0))?-1:c; } if(c>kMath[44])return(1/0); } if(N!=0)return-1; } if(j>0x3fd62e42){ if(j<0x3ff0a2b2){ if(N===0){ L=c-kMath[34]; M=kMath[35]; D=1; }else{ L=c+kMath[34]; M=-kMath[35]; D=-1; } }else{ D=(kMath[45]*c+((N===0)?0.5:-0.5))|0; o=D; L=c-o*kMath[34]; M=o*kMath[35]; } c=L-M; H=(L-c)-M; }else if(j<0x3c900000){ return c; }else{ D=0; } var P=0.5*c; var Q=c*P; var R=1+Q*((kMath[46+0]) +Q*((kMath[46+1]) +Q* ((kMath[46+2]) +Q*((kMath[46+3]) +Q*(kMath[46+4]) )))); o=3-R*P; var S=Q*((R-o)/(6-c*o)); if(D===0){ return c-(c*S-Q); }else{ S=(c*(S-H)-H); S-=Q; if(D===-1)return 0.5*(c-S)-0.5; if(D===1){ if(c<-0.25)return-2*(S-(c+0.5)); return 1+2*(c-S); } if(D<=-2||D>56){ d=1-(S-c); d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); return d-1; } if(D<20){ o=%_ConstructDouble(0x3ff00000-(0x200000>>D),0); d=o-(S-c); d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); }else{ o=%_ConstructDouble((0x3ff-D)<<20,0); d=c-(S+o); d+=1; d=%_ConstructDouble(%_DoubleHi(d)+(D<<20),%_DoubleLo(d)); } } return d; } function MathSinh(c){ c=c*1; var T=(c<0)?-0.5:0.5; var C=$abs(c); if(C<22){ if(C<3.725290298461914e-9)return c; var o=MathExpm1(C); if(C<1)return T*(2*o-o*o/(o+1)); return T*(o+o/(o+1)); } if(C<709.7822265625)return T*$exp(C); if(C<=kMath[51]){ var i=$exp(0.5*C); var o=T*i; return o*i; } return c*(1/0); } function MathCosh(c){ c=c*1; var k=%_DoubleHi(c)&0x7fffffff; if(k<0x3fd62e43){ var o=MathExpm1($abs(c)); var i=1+o; if(k<0x3c800000)return i; return 1+(o*o)/(i+i); } if(k<0x40360000){ var o=$exp($abs(c)); return 0.5*o+0.5/o; } if(k<0x40862e42)return 0.5*$exp($abs(c)); if($abs(c)<=kMath[51]){ var i=$exp(0.5*$abs(c)); var o=0.5*i; return o*i; } if((!%_IsSmi(%IS_VAR(c))&&!(c==c)))return c; return(1/0); } function MathLog10(c){ c=c*1; var j=%_DoubleHi(c); var U=%_DoubleLo(c); var D=0; if(j<0x00100000){ if(((j&0x7fffffff)|U)===0)return-(1/0); if(j<0)return $NaN; D-=54; c*=18014398509481984; j=%_DoubleHi(c); U=%_DoubleLo(c); } if(j>=0x7ff00000)return c; D+=(j>>20)-1023; i=(D&0x80000000)>>31; j=(j&0x000fffff)|((0x3ff-i)<<20); d=D+i; c=%_ConstructDouble(j,U); h=d*kMath[54]+kMath[52]*%_MathLogRT(c); return h+d*kMath[53]; } function MathLog2(c){ c=c*1; var C=$abs(c); var j=%_DoubleHi(c); var U=%_DoubleLo(c); var k=j&0x7fffffff; if((k|U)==0)return-(1/0); if(j<0)return $NaN; if(k>=0x7ff00000)return c; var t=0; if(k<0x00100000){ C*=9007199254740992; t-=53; k=%_DoubleHi(C); } t+=(k>>20)-0x3ff; var W=k&0x000fffff; k=W|0x3ff00000; var X=1; var Y=0; var Z=0; if(W>0x3988e){ if(W<0xbb67a){ X=1.5; Y=kMath[64]; Z=kMath[65]; }else{ t+=1; k-=0x00100000; } } C=%_ConstructDouble(k,%_DoubleLo(C)); var I=C-X; var l=1/(C+X); var aa=I*l; var ab=%_ConstructDouble(%_DoubleHi(aa),0); var ac=%_ConstructDouble(%_DoubleHi(C+X),0) var ad=C-(ac-X); var ae=l*((I-ab*ac)-ab*ad); var af=aa*aa; var r=af*af*((kMath[55+0]) +af*((kMath[55+1]) +af*((kMath[55+2]) +af*( (kMath[55+3]) +af*((kMath[55+4]) +af*(kMath[55+5]) ))))); r+=ae*(ab+aa); af=ab*ab; ac=%_ConstructDouble(%_DoubleHi(3.0+af+r),0); ad=r-((ac-3.0)-af); I=ab*ac; l=ae*ac+ad*aa; p_h=%_ConstructDouble(%_DoubleHi(I+l),0); p_l=l-(p_h-I); z_h=kMath[62]*p_h; z_l=kMath[63]*p_h+p_l*kMath[61]+Z; var o=t; var ag=%_ConstructDouble(%_DoubleHi(((z_h+z_l)+Y)+o),0); var ah=z_l-(((ag-o)-Y)-z_h); return ag+ah; } InstallFunctions(a,2,b( "cos",MathCos, "sin",MathSin, "tan",MathTan, "sinh",MathSinh, "cosh",MathCosh, "log10",MathLog10, "log2",MathLog2, "log1p",MathLog1p, "expm1",MathExpm1 )); %SetInlineBuiltinFlag(MathSin); %SetInlineBuiltinFlag(MathCos); })(); dateEĺ var $createDate; (function(){ "use strict"; %CheckIsBootstrapping(); var a=global.Date; function ThrowDateTypeError(){ throw new $TypeError('this is not a Date object.'); } var b=$NaN; var c; function LocalTimezone(d){ if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return""; CheckDateCacheCurrent(); if(d==b){ return c; } var g=%DateLocalTimezone(d); b=d; c=g; return g; } function UTC(h){ if((!%_IsSmi(%IS_VAR(h))&&!(h==h)))return h; return %DateToUTC(h); } function MakeTime(i,j,k,l){ if(!$isFinite(i))return $NaN; if(!$isFinite(j))return $NaN; if(!$isFinite(k))return $NaN; if(!$isFinite(l))return $NaN; return(%_IsSmi(%IS_VAR(i))?i:%NumberToInteger(ToNumber(i)))*3600000 +(%_IsSmi(%IS_VAR(j))?j:%NumberToInteger(ToNumber(j)))*60000 +(%_IsSmi(%IS_VAR(k))?k:%NumberToInteger(ToNumber(k)))*1000 +(%_IsSmi(%IS_VAR(l))?l:%NumberToInteger(ToNumber(l))); } function TimeInYear(m){ return DaysInYear(m)*86400000; } function MakeDay(m,o,q){ if(!$isFinite(m)||!$isFinite(o)||!$isFinite(q))return $NaN; m=(%_IsSmi(%IS_VAR(m))?m:%NumberToIntegerMapMinusZero(ToNumber(m))); o=(%_IsSmi(%IS_VAR(o))?o:%NumberToIntegerMapMinusZero(ToNumber(o))); q=(%_IsSmi(%IS_VAR(q))?q:%NumberToIntegerMapMinusZero(ToNumber(q))); if(m<-1000000||m>1000000|| o<-10000000||o>10000000){ return $NaN; } return %DateMakeDay(m|0,o|0)+q-1; } function MakeDate(r,h){ var h=r*86400000+h; if($abs(h)>8640002592000000)return $NaN; return h; } function TimeClip(h){ if(!$isFinite(h))return $NaN; if($abs(h)>8640000000000000)return $NaN; return(%_IsSmi(%IS_VAR(h))?h:%NumberToInteger(ToNumber(h))); } var t={ time:0, string:null }; function DateConstructor(m,o,q,u,w,z,l){ if(!%_IsConstructCall()){ return(new a()).toString(); } var A=%_ArgumentsLength(); var B; if(A==0){ B=%DateCurrentTime(); (%DateSetValue(this,B,1)); }else if(A==1){ if((typeof(m)==='number')){ B=m; }else if((typeof(m)==='string')){ CheckDateCacheCurrent(); var C=t; if(C.string===m){ B=C.time; }else{ B=DateParse(m); if(!(!%_IsSmi(%IS_VAR(B))&&!(B==B))){ C.time=B; C.string=m; } } }else{ var h=ToPrimitive(m,1); B=(typeof(h)==='string')?DateParse(h):ToNumber(h); } (%DateSetValue(this,B,1)); }else{ m=ToNumber(m); o=ToNumber(o); q=A>2?ToNumber(q):1; u=A>3?ToNumber(u):0; w=A>4?ToNumber(w):0; z=A>5?ToNumber(z):0; l=A>6?ToNumber(l):0; m=(!(!%_IsSmi(%IS_VAR(m))&&!(m==m))&& 0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&& (%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99)?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; var r=MakeDay(m,o,q); var h=MakeTime(u,w,z,l); B=MakeDate(r,h); (%DateSetValue(this,B,0)); } } var D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var E=['Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec']; function TwoDigitString(B){ return B<10?"0"+B:""+B; } function DateString(q){ return D[(%_DateField(q,4))]+' ' +E[(%_DateField(q,2))]+' ' +TwoDigitString((%_DateField(q,3)))+' ' +(%_DateField(q,1)); } var G=['Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday']; var H=['January','February','March','April','May','June', 'July','August','September','October','November','December']; function LongDateString(q){ return G[(%_DateField(q,4))]+', ' +H[(%_DateField(q,2))]+' ' +TwoDigitString((%_DateField(q,3)))+', ' +(%_DateField(q,1)); } function TimeString(q){ return TwoDigitString((%_DateField(q,5)))+':' +TwoDigitString((%_DateField(q,6)))+':' +TwoDigitString((%_DateField(q,7))); } function TimeStringUTC(q){ return TwoDigitString((%_DateField(q,15)))+':' +TwoDigitString((%_DateField(q,16)))+':' +TwoDigitString((%_DateField(q,17))); } function LocalTimezoneString(q){ var g=LocalTimezone((%_DateField(q,0))); var I=-(%_DateField(q,21)); var J=(I>=0)?1:-1; var u=$floor((J*I)/60); var j=$floor((J*I)%60); var K=' GMT'+((J==1)?'+':'-')+ TwoDigitString(u)+TwoDigitString(j); return K+' ('+g+')'; } function DatePrintString(q){ return DateString(q)+' '+TimeString(q); } var L=$Array(8); function DateParse(M){ var N=%DateParseString(ToString(M),L); if((N===null))return $NaN; var r=MakeDay(N[0],N[1],N[2]); var h=MakeTime(N[3],N[4],N[5],N[6]); var q=MakeDate(r,h); if((N[7]===null)){ return TimeClip(UTC(q)); }else{ return TimeClip(q-N[7]*1000); } } function DateUTC(m,o,q,u,w,z,l){ m=ToNumber(m); o=ToNumber(o); var A=%_ArgumentsLength(); q=A>2?ToNumber(q):1; u=A>3?ToNumber(u):0; w=A>4?ToNumber(w):0; z=A>5?ToNumber(z):0; l=A>6?ToNumber(l):0; m=(!(!%_IsSmi(%IS_VAR(m))&&!(m==m))&& 0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&& (%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99)?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; var r=MakeDay(m,o,q); var h=MakeTime(u,w,z,l); return TimeClip(MakeDate(r,h)); } function DateNow(){ return %DateCurrentTime(); } function DateToString(){ var d=(%_DateField(this,0)) if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; var P=LocalTimezoneString(this) return DatePrintString(this)+P; } function DateToDateString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; return DateString(this); } function DateToTimeString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; var P=LocalTimezoneString(this); return TimeString(this)+P; } function DateToLocaleString(){ return %_CallFunction(this,DateToString); } function DateToLocaleDateString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; return LongDateString(this); } function DateToLocaleTimeString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; return TimeString(this); } function DateValueOf(){ return(%_DateField(this,0)); } function DateGetTime(){ return(%_DateField(this,0)); } function DateGetFullYear(){ return(%_DateField(this,1)); } function DateGetUTCFullYear(){ return(%_DateField(this,11)); } function DateGetMonth(){ return(%_DateField(this,2)); } function DateGetUTCMonth(){ return(%_DateField(this,12)); } function DateGetDate(){ return(%_DateField(this,3)); } function DateGetUTCDate(){ return(%_DateField(this,13)); } function DateGetDay(){ return(%_DateField(this,4)); } function DateGetUTCDay(){ return(%_DateField(this,14)); } function DateGetHours(){ return(%_DateField(this,5)); } function DateGetUTCHours(){ return(%_DateField(this,15)); } function DateGetMinutes(){ return(%_DateField(this,6)); } function DateGetUTCMinutes(){ return(%_DateField(this,16)); } function DateGetSeconds(){ return(%_DateField(this,7)); } function DateGetUTCSeconds(){ return(%_DateField(this,17)) } function DateGetMilliseconds(){ return(%_DateField(this,8)); } function DateGetUTCMilliseconds(){ return(%_DateField(this,18)); } function DateGetTimezoneOffset(){ return(%_DateField(this,21)); } function DateSetTime(l){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); (%DateSetValue(this,ToNumber(l),1)); return(%_DateField(this,0)); } function DateSetMilliseconds(l){ var d=(%_DateField(this,0)+%_DateField(this,21)); l=ToNumber(l); var h=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),(%_DateField(this,7)),l); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); } function DateSetUTCMilliseconds(l){ var d=(%_DateField(this,0)); l=ToNumber(l); var h=MakeTime((%_DateField(this,15)), (%_DateField(this,16)), (%_DateField(this,17)), l); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); } function DateSetSeconds(k,l){ var d=(%_DateField(this,0)+%_DateField(this,21)); k=ToNumber(k); l=%_ArgumentsLength()<2?(%_DateField(this,8)):ToNumber(l); var h=MakeTime((%_DateField(this,5)),(%_DateField(this,6)),k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); } function DateSetUTCSeconds(k,l){ var d=(%_DateField(this,0)); k=ToNumber(k); l=%_ArgumentsLength()<2?(%_DateField(this,18)):ToNumber(l); var h=MakeTime((%_DateField(this,15)),(%_DateField(this,16)),k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); } function DateSetMinutes(j,k,l){ var d=(%_DateField(this,0)+%_DateField(this,21)); j=ToNumber(j); var A=%_ArgumentsLength(); k=A<2?(%_DateField(this,7)):ToNumber(k); l=A<3?(%_DateField(this,8)):ToNumber(l); var h=MakeTime((%_DateField(this,5)),j,k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); } function DateSetUTCMinutes(j,k,l){ var d=(%_DateField(this,0)); j=ToNumber(j); var A=%_ArgumentsLength(); k=A<2?(%_DateField(this,17)):ToNumber(k); l=A<3?(%_DateField(this,18)):ToNumber(l); var h=MakeTime((%_DateField(this,15)),j,k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); } function DateSetHours(i,j,k,l){ var d=(%_DateField(this,0)+%_DateField(this,21)); i=ToNumber(i); var A=%_ArgumentsLength(); j=A<2?(%_DateField(this,6)):ToNumber(j); k=A<3?(%_DateField(this,7)):ToNumber(k); l=A<4?(%_DateField(this,8)):ToNumber(l); var h=MakeTime(i,j,k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,9)),h),0)); } function DateSetUTCHours(i,j,k,l){ var d=(%_DateField(this,0)); i=ToNumber(i); var A=%_ArgumentsLength(); j=A<2?(%_DateField(this,16)):ToNumber(j); k=A<3?(%_DateField(this,17)):ToNumber(k); l=A<4?(%_DateField(this,18)):ToNumber(l); var h=MakeTime(i,j,k,l); return(%DateSetValue(this,MakeDate((%_DateField(this,19)),h),1)); } function DateSetDate(q){ var d=(%_DateField(this,0)+%_DateField(this,21)); q=ToNumber(q); var r=MakeDay((%_DateField(this,1)),(%_DateField(this,2)),q); return(%DateSetValue(this,MakeDate(r,(%_DateField(this,10))),0)); } function DateSetUTCDate(q){ var d=(%_DateField(this,0)); q=ToNumber(q); var r=MakeDay((%_DateField(this,11)),(%_DateField(this,12)),q); return(%DateSetValue(this,MakeDate(r,(%_DateField(this,20))),1)); } function DateSetMonth(o,q){ var d=(%_DateField(this,0)+%_DateField(this,21)); o=ToNumber(o); q=%_ArgumentsLength()<2?(%_DateField(this,3)):ToNumber(q); var r=MakeDay((%_DateField(this,1)),o,q); return(%DateSetValue(this,MakeDate(r,(%_DateField(this,10))),0)); } function DateSetUTCMonth(o,q){ var d=(%_DateField(this,0)); o=ToNumber(o); q=%_ArgumentsLength()<2?(%_DateField(this,13)):ToNumber(q); var r=MakeDay((%_DateField(this,11)),o,q); return(%DateSetValue(this,MakeDate(r,(%_DateField(this,20))),1)); } function DateSetFullYear(m,o,q){ var d=(%_DateField(this,0)+%_DateField(this,21)); m=ToNumber(m); var A=%_ArgumentsLength(); var h; if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ o=A<2?0:ToNumber(o); q=A<3?1:ToNumber(q); h=0; }else{ o=A<2?(%_DateField(this,2)):ToNumber(o); q=A<3?(%_DateField(this,3)):ToNumber(q); h=(%_DateField(this,10)); } var r=MakeDay(m,o,q); return(%DateSetValue(this,MakeDate(r,h),0)); } function DateSetUTCFullYear(m,o,q){ var d=(%_DateField(this,0)); m=ToNumber(m); var A=%_ArgumentsLength(); var h; if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ o=A<2?0:ToNumber(o); q=A<3?1:ToNumber(q); h=0; }else{ o=A<2?(%_DateField(this,12)):ToNumber(o); q=A<3?(%_DateField(this,13)):ToNumber(q); h=(%_DateField(this,20)); } var r=MakeDay(m,o,q); return(%DateSetValue(this,MakeDate(r,h),1)); } function DateToUTCString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))return'Invalid Date'; return D[(%_DateField(this,14))]+', ' +TwoDigitString((%_DateField(this,13)))+' ' +E[(%_DateField(this,12))]+' ' +(%_DateField(this,11))+' ' +TimeStringUTC(this)+' GMT'; } function DateGetYear(){ return(%_DateField(this,1))-1900; } function DateSetYear(m){ if(%_ClassOf(this)!=='Date')ThrowDateTypeError(); m=ToNumber(m); if((!%_IsSmi(%IS_VAR(m))&&!(m==m)))return(%DateSetValue(this,$NaN,1)); m=(0<=(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))&&(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m)))<=99) ?1900+(%_IsSmi(%IS_VAR(m))?m:%NumberToInteger(ToNumber(m))):m; var d=(%_DateField(this,0)+%_DateField(this,21)); var o,q,h; if((!%_IsSmi(%IS_VAR(d))&&!(d==d))){ o=0; q=1; h=0; }else{ o=(%_DateField(this,2)); q=(%_DateField(this,3)); h=(%_DateField(this,10)); } var r=MakeDay(m,o,q); return(%DateSetValue(this,MakeDate(r,h),0)); } function DateToGMTString(){ return %_CallFunction(this,DateToUTCString); } function PadInt(Q,R){ if(R==1)return Q; return Q<%_MathPow(10,R-1)?'0'+PadInt(Q,R-1):Q; } function DateToISOString(){ var d=(%_DateField(this,0)); if((!%_IsSmi(%IS_VAR(d))&&!(d==d)))throw MakeRangeError("invalid_time_value",[]); var m=this.getUTCFullYear(); var S; if(m>=0&&m<=9999){ S=PadInt(m,4); }else{ if(m<0){ S="-"+PadInt(-m,6); }else{ S="+"+PadInt(m,6); } } return S+ '-'+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(T){ var U=ToObject(this); var W=DefaultNumber(U); if((typeof(W)==='number')&&!(%_IsSmi(%IS_VAR(W))||((W==W)&&(W!=1/0)&&(W!=-1/0)))){ return null; } return U.toISOString(); } var X; var Y=$NaN; function CheckDateCacheCurrent(){ if(!X){ X=%DateCacheVersion(); if(!X)return; } if(X[0]==Y){ return; } Y=X[0]; b=$NaN; c=(void 0); t.time=$NaN; t.string=null; } function CreateDate(h){ var q=new a(); q.setTime(h); return q; } %SetCode(a,DateConstructor); %FunctionSetPrototype(a,new a($NaN)); InstallFunctions(a,2,$Array( "UTC",DateUTC, "parse",DateParse, "now",DateNow )); %AddNamedProperty(a.prototype,"constructor",a,2); InstallFunctions(a.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 )); $createDate=CreateDate; })(); regexp}o var $regexpExec; var $regexpExecNoTests; var $regexpLastMatchInfo; var $regexpLastMatchInfoOverride; var harmony_regexps=false; var harmony_unicode_regexps=false; (function(){ %CheckIsBootstrapping(); var a=global.RegExp; var b=global.Array; $regexpLastMatchInfo=new InternalPackedArray( 2, "", (void 0), 0, 0 ); $regexpLastMatchInfoOverride=null; function DoConstructRegExp(c,d,g){ if((%_IsRegExp(d))){ if(!(g===(void 0))){ throw MakeTypeError('regexp_flags',[]); } g=(d.global?'g':'') +(d.ignoreCase?'i':'') +(d.multiline?'m':''); if(harmony_unicode_regexps) g+=(d.unicode?'u':''); if(harmony_regexps) g+=(d.sticky?'y':''); d=d.source; } d=(d===(void 0))?'':ToString(d); g=(g===(void 0))?'':ToString(g); %RegExpInitializeAndCompile(c,d,g); } function RegExpConstructor(d,g){ if(%_IsConstructCall()){ DoConstructRegExp(this,d,g); }else{ if((%_IsRegExp(d))&&(g===(void 0))){ return d; } return new a(d,g); } } function RegExpCompileJS(d,g){ if(this==a.prototype){ throw MakeTypeError('incompatible_method_receiver', ['RegExp.prototype.compile',this]); } if((d===(void 0))&&%_ArgumentsLength()!=0){ DoConstructRegExp(this,'undefined',g); }else{ DoConstructRegExp(this,d,g); } } function DoRegExpExec(h,i,j){ var k=%_RegExpExec(h,i,j,$regexpLastMatchInfo); if(k!==null)$regexpLastMatchInfoOverride=null; return k; } function RegExpExecNoTests(h,i,l){ var m=%_RegExpExec(h,i,l,$regexpLastMatchInfo); if(m!==null){ $regexpLastMatchInfoOverride=null; var o=((m)[0])>>1; var l=m[3]; var q=m[4]; var r=%_SubString(i,l,q); var k=%_RegExpConstructResult(o,l,i); k[0]=r; if(o==1)return k; var t=3+2; for(var u=1;ui.length){ this.lastIndex=0; return null; } }else{ u=0; } var A=%_RegExpExec(this,i,u,$regexpLastMatchInfo); if((A===null)){ this.lastIndex=0; return null; } $regexpLastMatchInfoOverride=null; if(z){ this.lastIndex=$regexpLastMatchInfo[4]; } var o=((A)[0])>>1; var l=A[3]; var q=A[4]; var r=%_SubString(i,l,q); var k=%_RegExpConstructResult(o,l,i); k[0]=r; if(o==1)return k; var t=3+2; for(var u=1;ui.length){ this.lastIndex=0; return false; } var A=%_RegExpExec(this,i,u,$regexpLastMatchInfo); if((A===null)){ this.lastIndex=0; return false; } $regexpLastMatchInfoOverride=null; this.lastIndex=$regexpLastMatchInfo[4]; return true; }else{ var h=this; if(h.source.length>=3&& %_StringCharCodeAt(h.source,0)==46&& %_StringCharCodeAt(h.source,1)==42&& %_StringCharCodeAt(h.source,2)!=63){ h=TrimRegExp(h); } var A=%_RegExpExec(h,i,0,$regexpLastMatchInfo); if((A===null)){ this.lastIndex=0; return false; } $regexpLastMatchInfoOverride=null; return true; } } function TrimRegExp(h){ if(!%_ObjectEquals(B,h)){ B=h; C= new a(%_SubString(h.source,2,h.source.length), (h.ignoreCase?h.multiline?"im":"i" :h.multiline?"m":"")); } return C; } function RegExpToString(){ if(!(%_IsRegExp(this))){ throw MakeTypeError('incompatible_method_receiver', ['RegExp.prototype.toString',this]); } var k='/'+this.source+'/'; if(this.global)k+='g'; if(this.ignoreCase)k+='i'; if(this.multiline)k+='m'; if(harmony_unicode_regexps&&this.unicode)k+='u'; if(harmony_regexps&&this.sticky)k+='y'; return k; } function RegExpGetLastMatch(){ if($regexpLastMatchInfoOverride!==null){ return(($regexpLastMatchInfoOverride)[0]); } var D=(($regexpLastMatchInfo)[1]); return %_SubString(D, $regexpLastMatchInfo[3], $regexpLastMatchInfo[4]); } function RegExpGetLastParen(){ if($regexpLastMatchInfoOverride){ var E=$regexpLastMatchInfoOverride; if(E.length<=3)return''; return E[E.length-3]; } var G=(($regexpLastMatchInfo)[0]); if(G<=2)return''; var D=(($regexpLastMatchInfo)[1]); var l=$regexpLastMatchInfo[(3+(G-2))]; var q=$regexpLastMatchInfo[(3+(G-1))]; if(l!=-1&&q!=-1){ return %_SubString(D,l,q); } return""; } function RegExpGetLeftContext(){ var H; var I; if(!$regexpLastMatchInfoOverride){ H=$regexpLastMatchInfo[3]; I=(($regexpLastMatchInfo)[1]); }else{ var E=$regexpLastMatchInfoOverride; H=((E)[(E).length-2]); I=((E)[(E).length-1]); } return %_SubString(I,0,H); } function RegExpGetRightContext(){ var H; var I; if(!$regexpLastMatchInfoOverride){ H=$regexpLastMatchInfo[4]; I=(($regexpLastMatchInfo)[1]); }else{ var E=$regexpLastMatchInfoOverride; I=((E)[(E).length-1]); var J=((E)[0]); H=((E)[(E).length-2])+J.length; } return %_SubString(I,H,I.length); } function RegExpMakeCaptureGetter(K){ return function foo(){ if($regexpLastMatchInfoOverride){ if(K<$regexpLastMatchInfoOverride.length-2){ return(($regexpLastMatchInfoOverride)[(K)]); } return''; } var j=K*2; if(j>=(($regexpLastMatchInfo)[0]))return''; var L=$regexpLastMatchInfo[(3+(j))]; var M=$regexpLastMatchInfo[(3+(j+1))]; if(L==-1||M==-1)return''; return %_SubString((($regexpLastMatchInfo)[1]),L,M); }; } %FunctionSetInstanceClassName(a,'RegExp'); %AddNamedProperty( a.prototype,'constructor',a,2); %SetCode(a,RegExpConstructor); InstallFunctions(a.prototype,2,b( "exec",RegExpExecJS, "test",RegExpTest, "toString",RegExpToString, "compile",RegExpCompileJS )); %FunctionSetLength(a.prototype.compile,1); var N=function(){ var P=(($regexpLastMatchInfo)[2]); return(P===(void 0))?"":P; }; var Q=function(i){ (($regexpLastMatchInfo)[2])=ToString(i); }; %OptimizeObjectForAddingMultipleProperties(a,22); %DefineAccessorPropertyUnchecked(a,'input',N, Q,4); %DefineAccessorPropertyUnchecked(a,'$_',N, Q,2|4); var R=false; var S=function(){return R;}; var T=function(U){R=U?true:false;}; %DefineAccessorPropertyUnchecked(a,'multiline',S, T,4); %DefineAccessorPropertyUnchecked(a,'$*',S, T, 2|4); var W=function(X){}; %DefineAccessorPropertyUnchecked(a,'lastMatch',RegExpGetLastMatch, W,4); %DefineAccessorPropertyUnchecked(a,'$&',RegExpGetLastMatch, W,2|4); %DefineAccessorPropertyUnchecked(a,'lastParen',RegExpGetLastParen, W,4); %DefineAccessorPropertyUnchecked(a,'$+',RegExpGetLastParen, W,2|4); %DefineAccessorPropertyUnchecked(a,'leftContext', RegExpGetLeftContext,W, 4); %DefineAccessorPropertyUnchecked(a,'$`',RegExpGetLeftContext, W,2|4); %DefineAccessorPropertyUnchecked(a,'rightContext', RegExpGetRightContext,W, 4); %DefineAccessorPropertyUnchecked(a,"$'",RegExpGetRightContext, W,2|4); for(var u=1;u<10;++u){ %DefineAccessorPropertyUnchecked(a,'$'+u, RegExpMakeCaptureGetter(u),W, 4); } %ToFastProperties(a); $regexpExecNoTests=RegExpExecNoTests; $regexpExec=DoRegExpExec; })(); ,arraybufferi "use strict"; var $ArrayBuffer=global.ArrayBuffer; function ArrayBufferConstructor(a){ if(%_IsConstructCall()){ var b=ToPositiveInteger(a,'invalid_array_buffer_length'); %ArrayBufferInitialize(this,b); }else{ throw MakeTypeError('constructor_not_function',["ArrayBuffer"]); } } function ArrayBufferGetByteLen(){ if(!(%_ClassOf(this)==='ArrayBuffer')){ throw MakeTypeError('incompatible_method_receiver', ['ArrayBuffer.prototype.byteLength',this]); } return %_ArrayBufferGetByteLength(this); } function ArrayBufferSlice(a,b){ if(!(%_ClassOf(this)==='ArrayBuffer')){ throw MakeTypeError('incompatible_method_receiver', ['ArrayBuffer.prototype.slice',this]); } var c=(%_IsSmi(%IS_VAR(a))?a:%NumberToInteger(ToNumber(a))); if(!(b===(void 0))){ b=(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); } var d; var g=%_ArrayBufferGetByteLength(this); if(c<0){ d=$max(g+c,0); }else{ d=$min(c,g); } var h=(b===(void 0))?g:b; var i; if(h<0){ i=$max(g+h,0); }else{ i=$min(h,g); } if(ig){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 1!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Uint8Array",1]); } i=g-h; j=i/1; }else{ var j=d; i=j*1; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,1,b,h,i); } function Uint8ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*1; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,1,g,0,d); }else{ %_TypedArrayInitialize(a,1,null,0,d); } } function Uint8ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,1,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 1!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Int8Array",1]); } i=g-h; j=i/1; }else{ var j=d; i=j*1; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,2,b,h,i); } function Int8ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*1; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,2,g,0,d); }else{ %_TypedArrayInitialize(a,2,null,0,d); } } function Int8ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,2,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 2!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Uint16Array",2]); } i=g-h; j=i/2; }else{ var j=d; i=j*2; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,3,b,h,i); } function Uint16ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*2; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,3,g,0,d); }else{ %_TypedArrayInitialize(a,3,null,0,d); } } function Uint16ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,3,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 2!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Int16Array",2]); } i=g-h; j=i/2; }else{ var j=d; i=j*2; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,4,b,h,i); } function Int16ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*2; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,4,g,0,d); }else{ %_TypedArrayInitialize(a,4,null,0,d); } } function Int16ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,4,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 4!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Uint32Array",4]); } i=g-h; j=i/4; }else{ var j=d; i=j*4; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,5,b,h,i); } function Uint32ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*4; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,5,g,0,d); }else{ %_TypedArrayInitialize(a,5,null,0,d); } } function Uint32ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,5,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 4!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Int32Array",4]); } i=g-h; j=i/4; }else{ var j=d; i=j*4; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,6,b,h,i); } function Int32ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*4; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,6,g,0,d); }else{ %_TypedArrayInitialize(a,6,null,0,d); } } function Int32ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,6,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 4!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Float32Array",4]); } i=g-h; j=i/4; }else{ var j=d; i=j*4; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,7,b,h,i); } function Float32ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*4; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,7,g,0,d); }else{ %_TypedArrayInitialize(a,7,null,0,d); } } function Float32ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,7,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 8!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Float64Array",8]); } i=g-h; j=i/8; }else{ var j=d; i=j*8; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,8,b,h,i); } function Float64ArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*8; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,8,g,0,d); }else{ %_TypedArrayInitialize(a,8,null,0,d); } } function Float64ArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,8,b,d)){ for(var g=0;gg){ throw MakeRangeError("invalid_typed_array_offset"); } } var i; var j; if((d===(void 0))){ if(g % 1!==0){ throw MakeRangeError("invalid_typed_array_alignment", ["byte length","Uint8ClampedArray",1]); } i=g-h; j=i/1; }else{ var j=d; i=j*1; } if((h+i>g) ||(j>%_MaxSmi())){ throw MakeRangeError("invalid_typed_array_length"); } %_TypedArrayInitialize(a,9,b,h,i); } function Uint8ClampedArrayConstructByLength(a,b){ var c=(b===(void 0))? 0:ToPositiveInteger(b,"invalid_typed_array_length"); if(c>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } var d=c*1; if(d>%_TypedArrayMaxSizeInHeap()){ var g=new $ArrayBuffer(d); %_TypedArrayInitialize(a,9,g,0,d); }else{ %_TypedArrayInitialize(a,9,null,0,d); } } function Uint8ClampedArrayConstructByArrayLike(a,b){ var c=b.length; var d=ToPositiveInteger(c,"invalid_typed_array_length"); if(d>%_MaxSmi()){ throw MakeRangeError("invalid_typed_array_length"); } if(!%TypedArrayInitializeFromArrayLike(a,9,b,d)){ for(var g=0;g0){ for(var g=0;g=k&&i>=j; l--){ a[c+l]=b[l]; i-=g; j-=d; } return l; } var l=CopyRightPart(); var m=new $Array(l+1-k); for(var o=k;o<=l;o++){ m[o-k]=b[o]; } for(o=k;o<=l;o++){ a[c+o]=m[o-k]; } } function TypedArraySet(a,b){ var c=(b===(void 0))?0:(%_IsSmi(%IS_VAR(b))?b:%NumberToInteger(ToNumber(b))); if(c<0){ throw MakeTypeError("typed_array_set_negative_offset"); } if(c>%_MaxSmi()){ throw MakeRangeError("typed_array_set_source_too_large"); } switch(%TypedArraySetFastCases(this,a,c)){ case 0: return; case 1: TypedArraySetFromOverlappingTypedArray(this,a,c); return; case 2: TypedArraySetFromArrayLike(this,a,a.length,c); return; case 3: var d=a.length; if((d===(void 0))){ if((typeof(a)==='number')){ throw MakeTypeError("invalid_argument"); } return; } if(c+d>this.length){ throw MakeRangeError("typed_array_set_source_too_large"); } TypedArraySetFromArrayLike(this,a,d,c); return; } } function TypedArrayGetToStringTag(){ if(!%IsTypedArray(this))return; var a=%_ClassOf(this); if((a===(void 0)))return; return a; } function SetupTypedArrays(){ %CheckIsBootstrapping(); %SetCode(global.Uint8Array,Uint8ArrayConstructor); %FunctionSetPrototype(global.Uint8Array,new $Object()); %AddNamedProperty(global.Uint8Array,"BYTES_PER_ELEMENT",1, 1|2|4); %AddNamedProperty(global.Uint8Array.prototype, "constructor",global.Uint8Array,2); %AddNamedProperty(global.Uint8Array.prototype, "BYTES_PER_ELEMENT",1, 1|2|4); InstallGetter(global.Uint8Array.prototype,"buffer",Uint8Array_GetBuffer); InstallGetter(global.Uint8Array.prototype,"byteOffset",Uint8Array_GetByteOffset); InstallGetter(global.Uint8Array.prototype,"byteLength",Uint8Array_GetByteLength); InstallGetter(global.Uint8Array.prototype,"length",Uint8Array_GetLength); InstallGetter(global.Uint8Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Uint8Array.prototype,2,$Array( "subarray",Uint8ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Int8Array,Int8ArrayConstructor); %FunctionSetPrototype(global.Int8Array,new $Object()); %AddNamedProperty(global.Int8Array,"BYTES_PER_ELEMENT",1, 1|2|4); %AddNamedProperty(global.Int8Array.prototype, "constructor",global.Int8Array,2); %AddNamedProperty(global.Int8Array.prototype, "BYTES_PER_ELEMENT",1, 1|2|4); InstallGetter(global.Int8Array.prototype,"buffer",Int8Array_GetBuffer); InstallGetter(global.Int8Array.prototype,"byteOffset",Int8Array_GetByteOffset); InstallGetter(global.Int8Array.prototype,"byteLength",Int8Array_GetByteLength); InstallGetter(global.Int8Array.prototype,"length",Int8Array_GetLength); InstallGetter(global.Int8Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Int8Array.prototype,2,$Array( "subarray",Int8ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Uint16Array,Uint16ArrayConstructor); %FunctionSetPrototype(global.Uint16Array,new $Object()); %AddNamedProperty(global.Uint16Array,"BYTES_PER_ELEMENT",2, 1|2|4); %AddNamedProperty(global.Uint16Array.prototype, "constructor",global.Uint16Array,2); %AddNamedProperty(global.Uint16Array.prototype, "BYTES_PER_ELEMENT",2, 1|2|4); InstallGetter(global.Uint16Array.prototype,"buffer",Uint16Array_GetBuffer); InstallGetter(global.Uint16Array.prototype,"byteOffset",Uint16Array_GetByteOffset); InstallGetter(global.Uint16Array.prototype,"byteLength",Uint16Array_GetByteLength); InstallGetter(global.Uint16Array.prototype,"length",Uint16Array_GetLength); InstallGetter(global.Uint16Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Uint16Array.prototype,2,$Array( "subarray",Uint16ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Int16Array,Int16ArrayConstructor); %FunctionSetPrototype(global.Int16Array,new $Object()); %AddNamedProperty(global.Int16Array,"BYTES_PER_ELEMENT",2, 1|2|4); %AddNamedProperty(global.Int16Array.prototype, "constructor",global.Int16Array,2); %AddNamedProperty(global.Int16Array.prototype, "BYTES_PER_ELEMENT",2, 1|2|4); InstallGetter(global.Int16Array.prototype,"buffer",Int16Array_GetBuffer); InstallGetter(global.Int16Array.prototype,"byteOffset",Int16Array_GetByteOffset); InstallGetter(global.Int16Array.prototype,"byteLength",Int16Array_GetByteLength); InstallGetter(global.Int16Array.prototype,"length",Int16Array_GetLength); InstallGetter(global.Int16Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Int16Array.prototype,2,$Array( "subarray",Int16ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Uint32Array,Uint32ArrayConstructor); %FunctionSetPrototype(global.Uint32Array,new $Object()); %AddNamedProperty(global.Uint32Array,"BYTES_PER_ELEMENT",4, 1|2|4); %AddNamedProperty(global.Uint32Array.prototype, "constructor",global.Uint32Array,2); %AddNamedProperty(global.Uint32Array.prototype, "BYTES_PER_ELEMENT",4, 1|2|4); InstallGetter(global.Uint32Array.prototype,"buffer",Uint32Array_GetBuffer); InstallGetter(global.Uint32Array.prototype,"byteOffset",Uint32Array_GetByteOffset); InstallGetter(global.Uint32Array.prototype,"byteLength",Uint32Array_GetByteLength); InstallGetter(global.Uint32Array.prototype,"length",Uint32Array_GetLength); InstallGetter(global.Uint32Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Uint32Array.prototype,2,$Array( "subarray",Uint32ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Int32Array,Int32ArrayConstructor); %FunctionSetPrototype(global.Int32Array,new $Object()); %AddNamedProperty(global.Int32Array,"BYTES_PER_ELEMENT",4, 1|2|4); %AddNamedProperty(global.Int32Array.prototype, "constructor",global.Int32Array,2); %AddNamedProperty(global.Int32Array.prototype, "BYTES_PER_ELEMENT",4, 1|2|4); InstallGetter(global.Int32Array.prototype,"buffer",Int32Array_GetBuffer); InstallGetter(global.Int32Array.prototype,"byteOffset",Int32Array_GetByteOffset); InstallGetter(global.Int32Array.prototype,"byteLength",Int32Array_GetByteLength); InstallGetter(global.Int32Array.prototype,"length",Int32Array_GetLength); InstallGetter(global.Int32Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Int32Array.prototype,2,$Array( "subarray",Int32ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Float32Array,Float32ArrayConstructor); %FunctionSetPrototype(global.Float32Array,new $Object()); %AddNamedProperty(global.Float32Array,"BYTES_PER_ELEMENT",4, 1|2|4); %AddNamedProperty(global.Float32Array.prototype, "constructor",global.Float32Array,2); %AddNamedProperty(global.Float32Array.prototype, "BYTES_PER_ELEMENT",4, 1|2|4); InstallGetter(global.Float32Array.prototype,"buffer",Float32Array_GetBuffer); InstallGetter(global.Float32Array.prototype,"byteOffset",Float32Array_GetByteOffset); InstallGetter(global.Float32Array.prototype,"byteLength",Float32Array_GetByteLength); InstallGetter(global.Float32Array.prototype,"length",Float32Array_GetLength); InstallGetter(global.Float32Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Float32Array.prototype,2,$Array( "subarray",Float32ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Float64Array,Float64ArrayConstructor); %FunctionSetPrototype(global.Float64Array,new $Object()); %AddNamedProperty(global.Float64Array,"BYTES_PER_ELEMENT",8, 1|2|4); %AddNamedProperty(global.Float64Array.prototype, "constructor",global.Float64Array,2); %AddNamedProperty(global.Float64Array.prototype, "BYTES_PER_ELEMENT",8, 1|2|4); InstallGetter(global.Float64Array.prototype,"buffer",Float64Array_GetBuffer); InstallGetter(global.Float64Array.prototype,"byteOffset",Float64Array_GetByteOffset); InstallGetter(global.Float64Array.prototype,"byteLength",Float64Array_GetByteLength); InstallGetter(global.Float64Array.prototype,"length",Float64Array_GetLength); InstallGetter(global.Float64Array.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Float64Array.prototype,2,$Array( "subarray",Float64ArraySubArray, "set",TypedArraySet )); %CheckIsBootstrapping(); %SetCode(global.Uint8ClampedArray,Uint8ClampedArrayConstructor); %FunctionSetPrototype(global.Uint8ClampedArray,new $Object()); %AddNamedProperty(global.Uint8ClampedArray,"BYTES_PER_ELEMENT",1, 1|2|4); %AddNamedProperty(global.Uint8ClampedArray.prototype, "constructor",global.Uint8ClampedArray,2); %AddNamedProperty(global.Uint8ClampedArray.prototype, "BYTES_PER_ELEMENT",1, 1|2|4); InstallGetter(global.Uint8ClampedArray.prototype,"buffer",Uint8ClampedArray_GetBuffer); InstallGetter(global.Uint8ClampedArray.prototype,"byteOffset",Uint8ClampedArray_GetByteOffset); InstallGetter(global.Uint8ClampedArray.prototype,"byteLength",Uint8ClampedArray_GetByteLength); InstallGetter(global.Uint8ClampedArray.prototype,"length",Uint8ClampedArray_GetLength); InstallGetter(global.Uint8ClampedArray.prototype,symbolToStringTag, TypedArrayGetToStringTag); InstallFunctions(global.Uint8ClampedArray.prototype,2,$Array( "subarray",Uint8ClampedArraySubArray, "set",TypedArraySet )); } SetupTypedArrays(); var $DataView=global.DataView; function DataViewConstructor(a,b,c){ if(%_IsConstructCall()){ if(!(%_ClassOf(a)==='ArrayBuffer')){ throw MakeTypeError('data_view_not_array_buffer',[]); } if(!(b===(void 0))){ b=ToPositiveInteger(b,'invalid_data_view_offset'); } if(!(c===(void 0))){ c=(%_IsSmi(%IS_VAR(c))?c:%NumberToInteger(ToNumber(c))); } var d=%_ArrayBufferGetByteLength(a); var g=(b===(void 0))?0:b; if(g>d){ throw MakeRangeError('invalid_data_view_offset'); } var h=(c===(void 0)) ?d-g :c; if(h<0||g+h>d){ throw new MakeRangeError('invalid_data_view_length'); } %_DataViewInitialize(this,a,g,h); }else{ throw MakeTypeError('constructor_not_function',["DataView"]); } } function DataViewGetBufferJS(){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.buffer',this]); } return %DataViewGetBuffer(this); } function DataViewGetByteOffset(){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.byteOffset',this]); } return %_ArrayBufferViewGetByteOffset(this); } function DataViewGetByteLength(){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.byteLength',this]); } return %_ArrayBufferViewGetByteLength(this); } function ToPositiveDataViewOffset(a){ return ToPositiveInteger(a,'invalid_data_view_accessor_offset'); } function DataViewGetInt8JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getInt8',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetInt8(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetInt8JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setInt8',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetInt8(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetUint8JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getUint8',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetUint8(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetUint8JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setUint8',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetUint8(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetInt16JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getInt16',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetInt16(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetInt16JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setInt16',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetInt16(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetUint16JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getUint16',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetUint16(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetUint16JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setUint16',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetUint16(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetInt32JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getInt32',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetInt32(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetInt32JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setInt32',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetInt32(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetUint32JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getUint32',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetUint32(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetUint32JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setUint32',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetUint32(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetFloat32JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getFloat32',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetFloat32(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetFloat32JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setFloat32',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetFloat32(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function DataViewGetFloat64JS(a,b){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.getFloat64',this]); } if(%_ArgumentsLength()<1){ throw MakeTypeError('invalid_argument'); } return %DataViewGetFloat64(this, ToPositiveDataViewOffset(a), !!b); } function DataViewSetFloat64JS(a,b,c){ if(!(%_ClassOf(this)==='DataView')){ throw MakeTypeError('incompatible_method_receiver', ['DataView.setFloat64',this]); } if(%_ArgumentsLength()<2){ throw MakeTypeError('invalid_argument'); } %DataViewSetFloat64(this, ToPositiveDataViewOffset(a), ((typeof(%IS_VAR(b))==='number')?b:NonNumberToNumber(b)), !!c); } function SetupDataView(){ %CheckIsBootstrapping(); %SetCode($DataView,DataViewConstructor); %FunctionSetPrototype($DataView,new $Object); %AddNamedProperty($DataView.prototype,"constructor",$DataView,2); %AddNamedProperty( $DataView.prototype,symbolToStringTag,"DataView",1|2); InstallGetter($DataView.prototype,"buffer",DataViewGetBufferJS); InstallGetter($DataView.prototype,"byteOffset",DataViewGetByteOffset); InstallGetter($DataView.prototype,"byteLength",DataViewGetByteLength); InstallFunctions($DataView.prototype,2,$Array( "getInt8",DataViewGetInt8JS, "setInt8",DataViewSetInt8JS, "getUint8",DataViewGetUint8JS, "setUint8",DataViewSetUint8JS, "getInt16",DataViewGetInt16JS, "setInt16",DataViewSetInt16JS, "getUint16",DataViewGetUint16JS, "setUint16",DataViewSetUint16JS, "getInt32",DataViewGetInt32JS, "setInt32",DataViewSetInt32JS, "getUint32",DataViewGetUint32JS, "setUint32",DataViewSetUint32JS, "getFloat32",DataViewGetFloat32JS, "setFloat32",DataViewSetFloat32JS, "getFloat64",DataViewGetFloat64JS, "setFloat64",DataViewSetFloat64JS )); } SetupDataView(); $generatora! "use strict"; function GeneratorObjectNext(a){ if(!(%_ClassOf(this)==='Generator')){ throw MakeTypeError('incompatible_method_receiver', ['[Generator].prototype.next',this]); } var b=%GeneratorGetContinuation(this); if(b>0){ if((%_DebugIsActive()!=0))%DebugPrepareStepInIfStepping(this); try{ return %_GeneratorNext(this,a); }catch(e){ %GeneratorClose(this); throw e; } }else if(b==0){ return{value:void 0,done:true}; }else{ throw MakeTypeError('generator_running',[]); } } function GeneratorObjectThrow(a){ if(!(%_ClassOf(this)==='Generator')){ throw MakeTypeError('incompatible_method_receiver', ['[Generator].prototype.throw',this]); } var b=%GeneratorGetContinuation(this); if(b>0){ try{ return %_GeneratorThrow(this,a); }catch(e){ %GeneratorClose(this); throw e; } }else if(b==0){ throw a; }else{ throw MakeTypeError('generator_running',[]); } } function GeneratorObjectIterator(){ return this; } function GeneratorFunctionPrototypeConstructor(a){ if(%_IsConstructCall()){ throw MakeTypeError('not_constructor',['GeneratorFunctionPrototype']); } } function GeneratorFunctionConstructor(a){ return NewFunctionFromString(arguments,'function*'); } function SetUpGenerators(){ %CheckIsBootstrapping(); %NeverOptimizeFunction(GeneratorObjectNext); %NeverOptimizeFunction(GeneratorObjectThrow); var a=GeneratorFunctionPrototype.prototype; InstallFunctions(a, 2|4|1, ["next",GeneratorObjectNext, "throw",GeneratorObjectThrow]); %FunctionSetName(GeneratorObjectIterator,'[Symbol.iterator]'); %AddNamedProperty(a,symbolIterator, GeneratorObjectIterator,2|4|1); %AddNamedProperty(a,"constructor", GeneratorFunctionPrototype,2|1); %AddNamedProperty(a, symbolToStringTag,"Generator",2|1); %InternalSetPrototype(GeneratorFunctionPrototype,$Function.prototype); %AddNamedProperty(GeneratorFunctionPrototype, symbolToStringTag,"GeneratorFunction",2|1); %SetCode(GeneratorFunctionPrototype,GeneratorFunctionPrototypeConstructor); %AddNamedProperty(GeneratorFunctionPrototype,"constructor", GeneratorFunction,2|1); %InternalSetPrototype(GeneratorFunction,$Function); %SetCode(GeneratorFunction,GeneratorFunctionConstructor); } SetUpGenerators(); 8object-observeő­ "use strict"; var observationState; function GetObservationStateJS(){ if((observationState===(void 0))){ observationState=%GetObservationState(); } if((observationState.callbackInfoMap===(void 0))){ observationState.callbackInfoMap=%ObservationWeakMapCreate(); observationState.objectInfoMap=%ObservationWeakMapCreate(); observationState.notifierObjectInfoMap=%ObservationWeakMapCreate(); observationState.pendingObservers=null; observationState.nextCallbackPriority=0; observationState.lastMicrotaskId=0; } return observationState; } function GetPendingObservers(){ return GetObservationStateJS().pendingObservers; } function SetPendingObservers(a){ GetObservationStateJS().pendingObservers=a; } function GetNextCallbackPriority(){ return GetObservationStateJS().nextCallbackPriority++; } function nullProtoObject(){ return{__proto__:null}; } function TypeMapCreate(){ return nullProtoObject(); } function TypeMapAddType(a,b,c){ a[b]=c?1:(a[b]||0)+1; } function TypeMapRemoveType(a,b){ a[b]--; } function TypeMapCreateFromList(a,b){ var c=TypeMapCreate(); for(var d=0;d0?a.performing:null; } function ConvertAcceptListToTypeMap(a){ if((a===(void 0))) return a; if(!(%_IsSpecObject(a))) throw MakeTypeError("observe_invalid_accept"); var b=ToInteger(a.length); if(b<0)b=0; return TypeMapCreateFromList(a,b); } function CallbackInfoGet(a){ return %WeakCollectionGet(GetObservationStateJS().callbackInfoMap,a); } function CallbackInfoSet(a,b){ %WeakCollectionSet(GetObservationStateJS().callbackInfoMap, a,b); } function CallbackInfoGetOrCreate(a){ var b=CallbackInfoGet(a); if(!(b===(void 0))) return b; var c=GetNextCallbackPriority(); CallbackInfoSet(a,c); return c; } function CallbackInfoGetPriority(a){ if((typeof(a)==='number')) return a; else return a.priority; } function CallbackInfoNormalize(a){ var b=CallbackInfoGet(a); if((typeof(b)==='number')){ var c=b; b=new InternalArray; b.priority=c; CallbackInfoSet(a,b); } return b; } function ObjectObserve(a,b,c){ if(!(%_IsSpecObject(a))) throw MakeTypeError("observe_non_object",["observe"]); if(%IsJSGlobalProxy(a)) throw MakeTypeError("observe_global_proxy",["observe"]); if(!(%_ClassOf(b)==='Function')) throw MakeTypeError("observe_non_function",["observe"]); if(ObjectIsFrozen(b)) throw MakeTypeError("observe_callback_frozen"); var d=%GetObjectContextObjectObserve(a); return d(a,b,c); } function NativeObjectObserve(a,b,c){ var d=ObjectInfoGetOrCreate(a); var g=ConvertAcceptListToTypeMap(c); ObjectInfoAddObserver(d,b,g); return a; } function ObjectUnobserve(a,b){ if(!(%_IsSpecObject(a))) throw MakeTypeError("observe_non_object",["unobserve"]); if(%IsJSGlobalProxy(a)) throw MakeTypeError("observe_global_proxy",["unobserve"]); if(!(%_ClassOf(b)==='Function')) throw MakeTypeError("observe_non_function",["unobserve"]); var c=ObjectInfoGet(a); if((c===(void 0))) return a; ObjectInfoRemoveObserver(c,b); return a; } function ArrayObserve(a,b){ return ObjectObserve(a,b,['add', 'update', 'delete', 'splice']); } function ArrayUnobserve(a,b){ return ObjectUnobserve(a,b); } function ObserverEnqueueIfActive(a,b,c){ if(!ObserverIsActive(a,b)|| !TypeMapHasType(ObserverGetAcceptTypes(a),c.type)){ return; } var d=ObserverGetCallback(a); if(!%ObserverObjectAndRecordHaveSameOrigin(d,c.object, c)){ return; } var g=CallbackInfoNormalize(d); if((GetPendingObservers()===null)){ SetPendingObservers(nullProtoObject()); if((%_DebugIsActive()!=0)){ var h=++GetObservationStateJS().lastMicrotaskId; var i="Object.observe"; %EnqueueMicrotask(function(){ %DebugAsyncTaskEvent({type:"willHandle",id:h,name:i}); ObserveMicrotaskRunner(); %DebugAsyncTaskEvent({type:"didHandle",id:h,name:i}); }); %DebugAsyncTaskEvent({type:"enqueue",id:h,name:i}); }else{ %EnqueueMicrotask(ObserveMicrotaskRunner); } } GetPendingObservers()[g.priority]=d; g.push(c); } function ObjectInfoEnqueueExternalChangeRecord(a,b,c){ if(!ObjectInfoHasActiveObservers(a)) return; var d=!(c===(void 0)); var g=d? {object:a.object,type:c}: {object:a.object}; for(var h in b){ if(h==='object'||(d&&h==='type'))continue; %DefineDataPropertyUnchecked( g,h,b[h],1+4); } ObjectFreezeJS(g); ObjectInfoEnqueueInternalChangeRecord(a,g); } function ObjectInfoEnqueueInternalChangeRecord(a,b){ if((typeof(b.name)==='symbol'))return; if(ChangeObserversIsOptimized(a.changeObservers)){ var c=a.changeObservers; ObserverEnqueueIfActive(c,a,b); return; } for(var d in a.changeObservers){ var c=a.changeObservers[d]; if((c===null)) continue; ObserverEnqueueIfActive(c,a,b); } } function BeginPerformSplice(a){ var b=ObjectInfoGet(a); if(!(b===(void 0))) ObjectInfoAddPerformingType(b,'splice'); } function EndPerformSplice(a){ var b=ObjectInfoGet(a); if(!(b===(void 0))) ObjectInfoRemovePerformingType(b,'splice'); } function EnqueueSpliceRecord(a,b,c,d){ var g=ObjectInfoGet(a); if(!ObjectInfoHasActiveObservers(g)) return; var h={ type:'splice', object:a, index:b, removed:c, addedCount:d }; ObjectFreezeJS(h); ObjectFreezeJS(h.removed); ObjectInfoEnqueueInternalChangeRecord(g,h); } function NotifyChange(a,b,c,d){ var g=ObjectInfoGet(b); if(!ObjectInfoHasActiveObservers(g)) return; var h; if(arguments.length==2){ h={type:a,object:b}; }else if(arguments.length==3){ h={type:a,object:b,name:c}; }else{ h={ type:a, object:b, name:c, oldValue:d }; } ObjectFreezeJS(h); ObjectInfoEnqueueInternalChangeRecord(g,h); } var notifierPrototype={}; function ObjectNotifierNotify(a){ if(!(%_IsSpecObject(this))) throw MakeTypeError("called_on_non_object",["notify"]); var b=ObjectInfoGetFromNotifier(this); if((b===(void 0))) throw MakeTypeError("observe_notify_non_notifier"); if(!(typeof(a.type)==='string')) throw MakeTypeError("observe_type_non_string"); ObjectInfoEnqueueExternalChangeRecord(b,a); } function ObjectNotifierPerformChange(a,b){ if(!(%_IsSpecObject(this))) throw MakeTypeError("called_on_non_object",["performChange"]); var c=ObjectInfoGetFromNotifier(this); if((c===(void 0))) throw MakeTypeError("observe_notify_non_notifier"); if(!(typeof(a)==='string')) throw MakeTypeError("observe_perform_non_string"); if(!(%_ClassOf(b)==='Function')) throw MakeTypeError("observe_perform_non_function"); var d=%GetObjectContextNotifierPerformChange(c); d(c,a,b); } function NativeObjectNotifierPerformChange(a,b,c){ ObjectInfoAddPerformingType(a,b); var d; try{ d=%_CallFunction((void 0),c); }finally{ ObjectInfoRemovePerformingType(a,b); } if((%_IsSpecObject(d))) ObjectInfoEnqueueExternalChangeRecord(a,d,b); } function ObjectGetNotifier(a){ if(!(%_IsSpecObject(a))) throw MakeTypeError("observe_non_object",["getNotifier"]); if(%IsJSGlobalProxy(a)) throw MakeTypeError("observe_global_proxy",["getNotifier"]); if(ObjectIsFrozen(a))return null; if(!%ObjectWasCreatedInCurrentOrigin(a))return null; var b=%GetObjectContextObjectGetNotifier(a); return b(a); } function NativeObjectGetNotifier(a){ var b=ObjectInfoGetOrCreate(a); return ObjectInfoGetNotifier(b); } function CallbackDeliverPending(a){ var b=CallbackInfoGet(a); if((b===(void 0))||(typeof(b)==='number')) return false; var c=b.priority; CallbackInfoSet(a,c); var d=GetPendingObservers(); if(!(d===null)) delete d[c]; var g=[]; %MoveArrayContents(b,g); %DeliverObservationChangeRecords(a,g); return true; } function ObjectDeliverChangeRecords(a){ if(!(%_ClassOf(a)==='Function')) throw MakeTypeError("observe_non_function",["deliverChangeRecords"]); while(CallbackDeliverPending(a)){} } function ObserveMicrotaskRunner(){ var a=GetPendingObservers(); if(!(a===null)){ SetPendingObservers(null); for(var b in a){ CallbackDeliverPending(a[b]); } } } function SetupObjectObserve(){ %CheckIsBootstrapping(); InstallFunctions($Object,2,$Array( "deliverChangeRecords",ObjectDeliverChangeRecords, "getNotifier",ObjectGetNotifier, "observe",ObjectObserve, "unobserve",ObjectUnobserve )); InstallFunctions($Array,2,$Array( "observe",ArrayObserve, "unobserve",ArrayUnobserve )); InstallFunctions(notifierPrototype,2,$Array( "notify",ObjectNotifierNotify, "performChange",ObjectNotifierPerformChange )); } SetupObjectObserve(); (collectionUK "use strict"; var $Set=global.Set; var $Map=global.Map; function SetConstructor(a){ if(!%_IsConstructCall()){ throw MakeTypeError('constructor_not_function',['Set']); } %_SetInitialize(this); if(!(a==null)){ var b=this.add; if(!(%_ClassOf(b)==='Function')){ throw MakeTypeError('property_not_function',['add',this]); } for(var c of a){ %_CallFunction(this,c,b); } } } function SetAddJS(a){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.add',this]); } if(a===0){ a=0; } return %_SetAdd(this,a); } function SetHasJS(a){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.has',this]); } return %_SetHas(this,a); } function SetDeleteJS(a){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.delete',this]); } return %_SetDelete(this,a); } function SetGetSizeJS(){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.size',this]); } return %_SetGetSize(this); } function SetClearJS(){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.clear',this]); } %_SetClear(this); } function SetForEach(a,b){ if(!(%_ClassOf(this)==='Set')){ throw MakeTypeError('incompatible_method_receiver', ['Set.prototype.forEach',this]); } if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var c=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ c=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var d=new SetIterator(this,2); var g; var h=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); var i=[(void 0)]; while(%SetIteratorNext(d,i)){ if(h)%DebugPrepareStepInIfStepping(a); g=i[0]; var j=c?ToObject(b):b; %_CallFunction(j,g,g,this,a); } } function SetUpSet(){ %CheckIsBootstrapping(); %SetCode($Set,SetConstructor); %FunctionSetPrototype($Set,new $Object()); %AddNamedProperty($Set.prototype,"constructor",$Set,2); %AddNamedProperty( $Set.prototype,symbolToStringTag,"Set",2|1); %FunctionSetLength(SetForEach,1); InstallGetter($Set.prototype,"size",SetGetSizeJS); InstallFunctions($Set.prototype,2,$Array( "add",SetAddJS, "has",SetHasJS, "delete",SetDeleteJS, "clear",SetClearJS, "forEach",SetForEach )); } SetUpSet(); function MapConstructor(a){ if(!%_IsConstructCall()){ throw MakeTypeError('constructor_not_function',['Map']); } %_MapInitialize(this); if(!(a==null)){ var b=this.set; if(!(%_ClassOf(b)==='Function')){ throw MakeTypeError('property_not_function',['set',this]); } for(var c of a){ if(!(%_IsSpecObject(c))){ throw MakeTypeError('iterator_value_not_an_object',[c]); } %_CallFunction(this,c[0],c[1],b); } } } function MapGetJS(a){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.get',this]); } return %_MapGet(this,a); } function MapSetJS(a,b){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.set',this]); } if(a===0){ a=0; } return %_MapSet(this,a,b); } function MapHasJS(a){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.has',this]); } return %_MapHas(this,a); } function MapDeleteJS(a){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.delete',this]); } return %_MapDelete(this,a); } function MapGetSizeJS(){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.size',this]); } return %_MapGetSize(this); } function MapClearJS(){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.clear',this]); } %_MapClear(this); } function MapForEach(a,b){ if(!(%_ClassOf(this)==='Map')){ throw MakeTypeError('incompatible_method_receiver', ['Map.prototype.forEach',this]); } if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var c=false; if((b==null)){ b=%GetDefaultReceiver(a)||b; }else{ c=(!(%_IsSpecObject(b))&&%IsSloppyModeFunction(a)); } var d=new MapIterator(this,3); var g=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); var h=[(void 0),(void 0)]; while(%MapIteratorNext(d,h)){ if(g)%DebugPrepareStepInIfStepping(a); var i=c?ToObject(b):b; %_CallFunction(i,h[1],h[0],this,a); } } function SetUpMap(){ %CheckIsBootstrapping(); %SetCode($Map,MapConstructor); %FunctionSetPrototype($Map,new $Object()); %AddNamedProperty($Map.prototype,"constructor",$Map,2); %AddNamedProperty( $Map.prototype,symbolToStringTag,"Map",2|1); %FunctionSetLength(MapForEach,1); InstallGetter($Map.prototype,"size",MapGetSizeJS); InstallFunctions($Map.prototype,2,$Array( "get",MapGetJS, "set",MapSetJS, "has",MapHasJS, "delete",MapDeleteJS, "clear",MapClearJS, "forEach",MapForEach )); } SetUpMap(); 0?"Promise.resolve":"Promise.reject"; %DebugAsyncTaskEvent({type:"enqueue",id:w,name:z}); } } function PromiseIdResolveHandler(d){return d} function PromiseIdRejectHandler(g){throw g} function PromiseNopResolver(){} IsPromise=function IsPromise(d){ return(%_IsSpecObject(d))&&(!(d[promiseStatus]===(void 0))); } PromiseCreate=function PromiseCreate(){ return new a(PromiseNopResolver) } PromiseResolve=function PromiseResolve(c,d){ PromiseDone(c,+1,d,promiseOnResolve) } PromiseReject=function PromiseReject(c,g){ if((c[promiseStatus])==0){ var C=(%_DebugIsActive()!=0); if(C||!(!(c[promiseHasHandler]===(void 0)))){ %PromiseRejectEvent(c,g,C); } } PromiseDone(c,-1,g,promiseOnReject) } function PromiseDeferred(){ if(this===a){ var c=PromiseInit(new a(promiseRaw)); return{ promise:c, resolve:function(d){PromiseResolve(c,d)}, reject:function(g){PromiseReject(c,g)} }; }else{ var u={}; u.promise=new this(function(D,E){ u.resolve=D; u.reject=E; }) return u; } } function PromiseResolved(d){ if(this===a){ return PromiseCreateAndSet(+1,d); }else{ return new this(function(D,E){D(d)}); } } function PromiseRejected(g){ var c; if(this===a){ c=PromiseCreateAndSet(-1,g); %PromiseRejectEvent(c,g,false); }else{ c=new this(function(D,E){E(g)}); } return c; } PromiseChain=function PromiseChain(j,k){ j=(j===(void 0))?PromiseIdResolveHandler:j; k=(k===(void 0))?PromiseIdRejectHandler:k; var r=%_CallFunction(this.constructor,PromiseDeferred); switch((this[promiseStatus])){ case(void 0): throw MakeTypeError('not_a_promise',[this]); case 0: (this[promiseOnResolve]).push(j,r); (this[promiseOnReject]).push(k,r); break; case+1: PromiseEnqueue((this[promiseValue]), [j,r], +1); break; case-1: if(!(!(this[promiseHasHandler]===(void 0)))){ %PromiseRevokeReject(this); } PromiseEnqueue((this[promiseValue]), [k,r], -1); break; } (this[promiseHasHandler]=true); if((%_DebugIsActive()!=0)){ %DebugPromiseEvent({promise:r.promise,parentPromise:this}); } return r.promise; } PromiseCatch=function PromiseCatch(k){ return this.then((void 0),k); } PromiseThen=function PromiseThen(j,k){ j=(%_ClassOf(j)==='Function')?j :PromiseIdResolveHandler; k=(%_ClassOf(k)==='Function')?k :PromiseIdRejectHandler; var G=this; var o=this.constructor; return %_CallFunction( this, function(d){ d=PromiseCoerce(o,d); if(d===G){ if((%_DebugIsActive()!=0&&%DebugCallbackSupportsStepping(k)))%DebugPrepareStepInIfStepping(k); return k(MakeTypeError('promise_cyclic',[d])); }else if(IsPromise(d)){ return d.then(j,k); }else{ if((%_DebugIsActive()!=0&&%DebugCallbackSupportsStepping(j)))%DebugPrepareStepInIfStepping(j); return j(d); } }, k, PromiseChain ); } function PromiseCast(d){ return IsPromise(d)?d:new this(function(D){D(d)}); } function PromiseAll(H){ var r=%_CallFunction(this,PromiseDeferred); var I=[]; try{ var J=0; var B=0; for(var i of H){ this.resolve(i).then( (function(B){ return function(d){ I[B]=d; if(--J===0)r.resolve(I); } })(B), function(g){r.reject(g);}); ++B; ++J; } if(J===0){ r.resolve(I); } }catch(e){ r.reject(e) } return r.promise; } function PromiseRace(H){ var r=%_CallFunction(this,PromiseDeferred); try{ for(var i of H){ this.resolve(i).then( function(d){r.resolve(d)}, function(g){r.reject(g)}); } }catch(e){ r.reject(e) } return r.promise; } function PromiseHasUserDefinedRejectHandlerRecursive(c){ var K=(c[promiseOnReject]); if((K===(void 0)))return false; for(var B=0;B>>0; if(d<4){ try{ h=NoSideEffectToString(b[d]); }catch(e){ if(%IsJSModule(b[d])) h="module"; else if((%_IsSpecObject(b[d]))) h="object"; else h="#"; } } } c+=h; } return c; } function NoSideEffectToString(a){ if((typeof(a)==='string'))return a; if((typeof(a)==='number'))return %_NumberToString(a); if((typeof(a)==='boolean'))return a?'true':'false'; if((a===(void 0)))return'undefined'; if((a===null))return'null'; if((%_IsFunction(a))){ var b=%_CallFunction(a,FunctionToString); if(b.length>128){ b=%_SubString(b,0,111)+"......"+ %_SubString(b,b.length-2,b.length); } return b; } if((typeof(a)==='symbol'))return %_CallFunction(a,$symbolToString); if((%_IsObject(a)) &&%GetDataProperty(a,"toString")===DefaultObjectToString){ var c=%GetDataProperty(a,"constructor"); if(typeof c=="function"){ var d=c.name; if((typeof(d)==='string')&&d!==""){ return"#<"+d+">"; } } } if(CanBeSafelyTreatedAsAnErrorObject(a)){ return %_CallFunction(a,ErrorToString); } return %_CallFunction(a,NoSideEffectsObjectToString); } function CanBeSafelyTreatedAsAnErrorObject(a){ switch(%_ClassOf(a)){ case'Error': case'EvalError': case'RangeError': case'ReferenceError': case'SyntaxError': case'TypeError': case'URIError': return true; } var b=%GetDataProperty(a,"toString"); return a instanceof $Error&&b===ErrorToString; } function ToStringCheckErrorObject(a){ if(CanBeSafelyTreatedAsAnErrorObject(a)){ return %_CallFunction(a,ErrorToString); }else{ return ToString(a); } } function ToDetailString(a){ if(a!=null&&(%_IsObject(a))&&a.toString===DefaultObjectToString){ 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((c===(void 0)))c=[]; return new a(FormatMessage(b,c)); } %FunctionSetInstanceClassName(Script,'Script'); %AddNamedProperty(Script.prototype,'constructor',Script, 2|4|1); %SetCode(Script,function(a){ throw new $Error("Not supported"); }); function FormatMessage(a,b){ var c=kMessages[a]; if(!c)return""; return FormatString(c,b); } 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""; 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 MakeTypeErrorEmbedded(a,b){ return MakeGenericError($TypeError,a,[b]); } function MakeSyntaxErrorEmbedded(a,b){ return MakeGenericError($SyntaxError,a,[b]); } function MakeReferenceErrorEmbedded(a,b){ return MakeGenericError($ReferenceError,a,[b]); } function ScriptLineFromPosition(a){ var b=this.line_ends; var c=b.length-1; if(c<0)return-1; if(a>b[c])return-1; if(a<=b[0])return 0; var d=1; while(true){ var g=(c+d)>>1; if(a<=b[g-1]){ c=g-1; }else if(a>b[g]){ d=g+1; }else{ return g; } } } 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(!(a===(void 0))){ 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=(a===(void 0))?this.line_offset :a; var d=(b===(void 0))?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(!(a===(void 0))){ 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.line_offset>0||this.column_offset>0){ return this.name; } if(this.source_url){ return this.source_url; } return this.name; } SetUpLockedPrototype(Script, $Array("source","name","source_url","source_mapping_url","line_ends", "line_offset","column_offset"), $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; } function SourceLocationSourceText(){ return %_CallFunction(this.script.source, this.start, this.end, $stringSubstring); } SetUpLockedPrototype(SourceLocation, $Array("script","position","line","column","start","end"), $Array( "sourceText",SourceLocationSourceText ) ); function SourceSlice(a,b,c,d,g){ this.script=a; this.from_line=b; this.to_line=c; this.from_position=d; this.to_position=g; } function SourceSliceSourceText(){ return %_CallFunction(this.script.source, this.from_position, this.to_position, $stringSubstring); } SetUpLockedPrototype(SourceSlice, $Array("script","from_line","to_line","from_position","to_position"), $Array("sourceText",SourceSliceSourceText) ); function GetPositionInLine(a){ var b=%MessageGetScript(a); var c=%MessageGetStartPosition(a); var d=b.locationFromPosition(c,false); if(d==null)return-1; return c-d.start; } function GetStackTraceLine(a,b,c,d){ return new CallSite(a,b,c,false).toString(); } var CallSiteReceiverKey=(%CreatePrivateOwnSymbol("CallSite#receiver")); var CallSiteFunctionKey=(%CreatePrivateOwnSymbol("CallSite#function")); var CallSitePositionKey=(%CreatePrivateOwnSymbol("CallSite#position")); var CallSiteStrictModeKey=(%CreatePrivateOwnSymbol("CallSite#strict_mode")); function CallSite(a,b,c,d){ (this[CallSiteReceiverKey]=a); (this[CallSiteFunctionKey]=b); (this[CallSitePositionKey]=c); (this[CallSiteStrictModeKey]=d); } function CallSiteGetThis(){ return(this[CallSiteStrictModeKey]) ?(void 0):(this[CallSiteReceiverKey]); } function CallSiteGetTypeName(){ return GetTypeName((this[CallSiteReceiverKey]),false); } function CallSiteIsToplevel(){ if((this[CallSiteReceiverKey])==null){ return true; } return(%_ClassOf((this[CallSiteReceiverKey]))==='global'); } function CallSiteIsEval(){ var a=%FunctionGetScript((this[CallSiteFunctionKey])); return a&&a.compilation_type==1; } function CallSiteGetEvalOrigin(){ var a=%FunctionGetScript((this[CallSiteFunctionKey])); return FormatEvalOrigin(a); } function CallSiteGetScriptNameOrSourceURL(){ var a=%FunctionGetScript((this[CallSiteFunctionKey])); return a?a.nameOrSourceURL():null; } function CallSiteGetFunction(){ return(this[CallSiteStrictModeKey]) ?(void 0):(this[CallSiteFunctionKey]); } function CallSiteGetFunctionName(){ var a=(this[CallSiteFunctionKey]); var b=%FunctionGetDebugName(a); if(b){ return b; } var c=%FunctionGetScript(a); if(c&&c.compilation_type==1){ return"eval"; } return null; } function CallSiteGetMethodName(){ var a=(this[CallSiteReceiverKey]); var b=(this[CallSiteFunctionKey]); var c=b.name; if(c&&a&& (%_CallFunction(a,c,ObjectLookupGetter)===b|| %_CallFunction(a,c,ObjectLookupSetter)===b|| ((%_IsObject(a))&&%GetDataProperty(a,c)===b))){ return c; } var d=null; for(var g in a){ if(%_CallFunction(a,g,ObjectLookupGetter)===b|| %_CallFunction(a,g,ObjectLookupSetter)===b|| ((%_IsObject(a))&&%GetDataProperty(a,g)===b)){ if(d){ return null; } d=g; } } if(d){ return d; } return null; } function CallSiteGetFileName(){ var a=%FunctionGetScript((this[CallSiteFunctionKey])); return a?a.name:null; } function CallSiteGetLineNumber(){ if((this[CallSitePositionKey])==-1){ return null; } var a=%FunctionGetScript((this[CallSiteFunctionKey])); var b=null; if(a){ b=a.locationFromPosition( (this[CallSitePositionKey]),true); } return b?b.line+1:null; } function CallSiteGetColumnNumber(){ if((this[CallSitePositionKey])==-1){ return null; } var a=%FunctionGetScript((this[CallSiteFunctionKey])); var b=null; if(a){ b=a.locationFromPosition( (this[CallSitePositionKey]),true); } return b?b.column+1:null; } function CallSiteIsNative(){ var a=%FunctionGetScript((this[CallSiteFunctionKey])); return a?(a.type==0):false; } function CallSiteGetPosition(){ return(this[CallSitePositionKey]); } function CallSiteIsConstructor(){ var a=(this[CallSiteReceiverKey]); var b=(a!=null&&(%_IsObject(a))) ?%GetDataProperty(a,"constructor"):null; if(!b)return false; return(this[CallSiteFunctionKey])===b; } function CallSiteToString(){ var a; var b=""; if(this.isNative()){ b="native"; }else{ a=this.getScriptNameOrSourceURL(); if(!a&&this.isEval()){ b=this.getEvalOrigin(); b+=", "; } if(a){ b+=a; }else{ b+=""; } var c=this.getLineNumber(); if(c!=null){ b+=":"+c; var d=this.getColumnNumber(); if(d){ b+=":"+d; } } } var g=""; var h=this.getFunctionName(); var i=true; var j=this.isConstructor(); var k=!(this.isToplevel()||j); if(k){ var l=GetTypeName((this[CallSiteReceiverKey]),true); var m=this.getMethodName(); if(h){ if(l&& %_CallFunction(h,l,$stringIndexOf)!=0){ g+=l+"."; } g+=h; if(m&& (%_CallFunction(h,"."+m,$stringIndexOf)!= h.length-m.length-1)){ g+=" [as "+m+"]"; } }else{ g+=l+"."+(m||""); } }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 FormatErrorString(a){ try{ return %_CallFunction(a,ErrorToString); }catch(e){ try{ return""; }catch(ee){ return""; } } } function GetStackFrames(a){ var b=new InternalArray(); var c=a[0]; for(var d=1;d"; }catch(ee){ k=""; } } h.push(" at "+k); } return %_CallFunction(h,"\n",ArrayJoin); } function GetTypeName(a,b){ var c=a.constructor; if(!c){ return b?null: %_CallFunction(a,NoSideEffectsObjectToString); } var d=c.name; if(!d){ return b?null: %_CallFunction(a,NoSideEffectsObjectToString); } return d; } var stack_trace_symbol; var formatted_stack_trace_symbol=(%CreatePrivateOwnSymbol("formatted stack trace")); var StackTraceGetter=function(){ var a=(void 0); var b=this; while(b){ var a= (b[formatted_stack_trace_symbol]); if((a===(void 0))){ var c=(b[stack_trace_symbol]); if((c===(void 0))){ b=%_GetPrototype(b); continue; } a=FormatStackTrace(b,c); (b[stack_trace_symbol]=(void 0)); (b[formatted_stack_trace_symbol]=a); } return a; } return(void 0); }; var StackTraceSetter=function(a){ if((%HasOwnProperty(this,stack_trace_symbol))){ (this[stack_trace_symbol]=(void 0)); (this[formatted_stack_trace_symbol]=a); } }; var captureStackTrace=function captureStackTrace(a,b){ ObjectDefineProperty(a,'stack',{get:StackTraceGetter, set:StackTraceSetter, configurable:true}); %CollectStackTrace(a,b?b:captureStackTrace); } function SetUpError(){ var a=function(b){ var c=b.name; %AddNamedProperty(global,c,b,2); %AddNamedProperty(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'); %AddNamedProperty(b.prototype,'constructor',b,2); %AddNamedProperty(b.prototype,"name",c,2); %SetCode(b,function(g){ if(%_IsConstructCall()){ try{captureStackTrace(this,b);}catch(e){} if(!(g===(void 0))){ %AddNamedProperty(this,'message',ToString(g),2); } }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; %AddNamedProperty($Error.prototype,'message','',2); var visited_errors=new InternalArray(); var cyclic_error_marker=new $Object(); function GetPropertyWithoutInvokingMonkeyGetters(a,b){ var c=a; while(c&&!%HasOwnProperty(c,b)){ c=%_GetPrototype(c); } if((c===null))return(void 0); if(!(%_IsObject(c)))return a[b]; var d=%GetOwnProperty(c,b); if(d&&d[0]){ var g=b==="name"; if(c===$ReferenceError.prototype) return g?"ReferenceError":(void 0); if(c===$SyntaxError.prototype) return g?"SyntaxError":(void 0); if(c===$TypeError.prototype) return g?"TypeError":(void 0); } return a[b]; } function ErrorToStringDetectCycle(a){ if(!%PushIfAbsent(visited_errors,a))throw cyclic_error_marker; try{ var b=GetPropertyWithoutInvokingMonkeyGetters(a,"name"); b=(b===(void 0))?"Error":((typeof(%IS_VAR(b))==='string')?b:NonStringToString(b)); var c=GetPropertyWithoutInvokingMonkeyGetters(a,"message"); c=(c===(void 0))?"":((typeof(%IS_VAR(c))==='string')?c:NonStringToString(c)); if(b==="")return c; if(c==="")return b; return b+": "+c; }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]); function SetUpStackOverflowBoilerplate(){ var a=MakeRangeError('stack_overflow',[]); %DefineAccessorPropertyUnchecked( a,'stack',StackTraceGetter,StackTraceSetter,2); return a; } var kStackOverflowBoilerplate=SetUpStackOverflowBoilerplate(); json=; "use strict"; 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 JSONStringify(a,b,c){ if(%_ArgumentsLength()==1){ return %BasicJSONStringify(a); } if((%_IsObject(c))){ if((%_ClassOf(c)==='Number')){ c=ToNumber(c); }else if((%_ClassOf(c)==='String')){ c=ToString(c); } } var d; if((typeof(c)==='number')){ c=$max(0,$min(ToInteger(c),10)); d=%_SubString(" ",0,c); }else if((typeof(c)==='string')){ if(c.length>10){ d=%_SubString(c,0,10); }else{ d=c; } }else{ d=""; } if((%_IsArray(b))){ var g=new InternalArray(); var h={__proto__:null}; var i={}; var j=b.length; for(var k=0;k>>0); if(c>=g){ (a[arrayIteratorObjectSymbol]=(void 0)); return CreateIteratorResultObject((void 0),true); } (a[arrayIteratorNextIndexSymbol]=c+1); if(d==2){ return CreateIteratorResultObject(b[c],false); } if(d==3){ return CreateIteratorResultObject([c,b[c]],false); } return CreateIteratorResultObject(c,false); } function ArrayEntries(){ return CreateArrayIterator(this,3); } function ArrayValues(){ return CreateArrayIterator(this,2); } function ArrayKeys(){ return CreateArrayIterator(this,1); } function SetUpArrayIterator(){ %CheckIsBootstrapping(); %FunctionSetPrototype(ArrayIterator,new $Object()); %FunctionSetInstanceClassName(ArrayIterator,'Array Iterator'); InstallFunctions(ArrayIterator.prototype,2,$Array( 'next',ArrayIteratorNext )); %FunctionSetName(ArrayIteratorIterator,'[Symbol.iterator]'); %AddNamedProperty(ArrayIterator.prototype,symbolIterator, ArrayIteratorIterator,2); %AddNamedProperty(ArrayIterator.prototype,symbolToStringTag, "Array Iterator",1|2); } SetUpArrayIterator(); function ExtendArrayPrototype(){ %CheckIsBootstrapping(); InstallFunctions($Array.prototype,2,$Array( 'entries',ArrayEntries, 'keys',ArrayKeys )); %AddNamedProperty($Array.prototype,symbolIterator,ArrayValues,2); } ExtendArrayPrototype(); function ExtendTypedArrayPrototypes(){ %CheckIsBootstrapping(); %AddNamedProperty($Uint8Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Uint8Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Uint8Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Uint8Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Int8Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Int8Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Int8Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Int8Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Uint16Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Uint16Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Uint16Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Uint16Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Int16Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Int16Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Int16Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Int16Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Uint32Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Uint32Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Uint32Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Uint32Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Int32Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Int32Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Int32Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Int32Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Float32Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Float32Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Float32Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Float32Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Float64Array.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Float64Array.prototype,'values',ArrayValues,2); %AddNamedProperty($Float64Array.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Float64Array.prototype,symbolIterator,ArrayValues,2); %AddNamedProperty($Uint8ClampedArray.prototype,'entries',ArrayEntries,2); %AddNamedProperty($Uint8ClampedArray.prototype,'values',ArrayValues,2); %AddNamedProperty($Uint8ClampedArray.prototype,'keys',ArrayKeys,2); %AddNamedProperty($Uint8ClampedArray.prototype,symbolIterator,ArrayValues,2); } ExtendTypedArrayPrototypes(); >>0); if(k>=l){ (j[d]=(void 0)); return CreateIteratorResultObject((void 0),true); } var m=%_StringCharCodeAt(i,k); var o=%_StringCharFromCode(m); k++; if(m>=0xD800&&m<=0xDBFF&&k=0xDC00&&q<=0xDFFF){ o+=%_StringCharFromCode(q); k++; } } (j[g]=k); return CreateIteratorResultObject(o,false); } function StringPrototypeIterator(){ return CreateStringIterator(this); } %FunctionSetPrototype(StringIterator,new b()); %FunctionSetInstanceClassName(StringIterator,'String Iterator'); InstallFunctions(StringIterator.prototype,2,a( 'next',StringIteratorNext )); %FunctionSetName(StringIteratorIterator,'[Symbol.iterator]'); %AddNamedProperty(StringIterator.prototype,symbolIterator, StringIteratorIterator,2); %AddNamedProperty(StringIterator.prototype,symbolToStringTag, "String Iterator",1|2); %FunctionSetName(StringPrototypeIterator,'[Symbol.iterator]'); %AddNamedProperty(c.prototype,symbolIterator, StringPrototypeIterator,2); })(); $templateső "use strict"; var callSiteCache=new $Map; function SameCallSiteElements(a,b){ var c=a.length; var b=b.raw; if(c!==b.length)return false; for(var d=0;d0){ return I(L,%_Arguments(0)); }else{ return I(L); } } } %FunctionSetName(M,K); %FunctionRemovePrototype(M); %SetNativeFlag(M); this[K]=M; } return this[K]; } %FunctionSetName(getter,H); %FunctionRemovePrototype(getter); %SetNativeFlag(getter); ObjectDefineProperty(G.prototype,H,{ get:getter, enumerable:false, configurable:true }); } function supportedLocalesOf(Q,R,S){ if((Q.match(GetServiceRE())===null)){ throw new $Error('Internal error, wrong service type: '+Q); } if(S===d){ S={}; }else{ S=ToObject(S); } var T=S.localeMatcher; if(T!==d){ T=c(T); if(T!=='lookup'&&T!=='best fit'){ throw new $RangeError('Illegal value for localeMatcher:'+T); } }else{ T='best fit'; } var U=initializeLocaleList(R); if(j[Q]===d){ j[Q]=getAvailableLocalesOf(Q); } if(T==='best fit'){ return initializeLocaleList(bestFitSupportedLocalesOf( U,j[Q])); } return initializeLocaleList(lookupSupportedLocalesOf( U,j[Q])); } function lookupSupportedLocalesOf(U,W){ var X=[]; for(var Y=0;Y=3&&J<=8&&an!==d){ am[an]=ao; an=d; }else{ return{}; } } return am; } function setOptions(ap,am,aq,ac,ar){ var ak=''; var as=function updateExtension(at,ah){ return'-'+at+'-'+c(ah); } var au=function updateProperty(ad,ae,ah){ if(ae==='boolean'&&(typeof ah==='string')){ ah=(ah==='true')?true:false; } if(ad!==d){ defineWEProperty(ar,ad,ah); } } for(var at in aq){ if(aq.hasOwnProperty(at)){ var ah=d; var av=aq[at]; if(av.property!==d){ ah=ac(av.property,av.type,av.values); } if(ah!==d){ au(av.property,av.type,ah); ak+=as(at,ah); continue; } if(am.hasOwnProperty(at)){ ah=am[at]; if(ah!==d){ au(av.property,av.type,ah); ak+=as(at,ah); }else if(av.type==='boolean'){ au(av.property,av.type,true); ak+=as(at,true); } } } } return ak===''?'':'-u'+ak; } function freezeArray(aw){ aw.forEach(function(ao,ax){ ObjectDefineProperty(aw,ax,{value:ao, configurable:false, writable:false, enumerable:true}); }); ObjectDefineProperty(aw,'length',{value:aw.length, writable:false}); return aw; } function getOptimalLanguageTag(ay,ai){ if(ay===ai){ return ay; } var R=%GetLanguageTagVariants([ay,ai]); if(R[0].maximized!==R[1].maximized){ return ai; } var az=new b('^'+R[1].base); return ai.replace(az,R[0].base); } function getAvailableLocalesOf(Q){ var aA=%AvailableLocalesOf(Q); for(var Y in aA){ if(aA.hasOwnProperty(Y)){ var aB=Y.match(/^([a-z]{2,3})-([A-Z][a-z]{3})-([A-Z]{2})$/); if(aB!==null){ aA[aB[1]+'-'+aB[3]]=null; } } } return aA; } function defineWEProperty(aC,ad,ah){ ObjectDefineProperty(aC,ad, {value:ah,writable:true,enumerable:true}); } function addWEPropertyIfDefined(aC,ad,ah){ if(ah!==d){ defineWEProperty(aC,ad,ah); } } function defineWECProperty(aC,ad,ah){ ObjectDefineProperty(aC,ad, {value:ah, writable:true, enumerable:true, configurable:true}); } function addWECPropertyIfDefined(aC,ad,ah){ if(ah!==d){ defineWECProperty(aC,ad,ah); } } function toTitleCaseWord(aD){ return aD.substr(0,1).toUpperCase()+aD.substr(1).toLowerCase(); } function canonicalizeLanguageTag(aE){ if(typeof aE!=='string'&&typeof aE!=='object'|| (aE===null)){ throw new $TypeError('Language ID should be string or object.'); } var aF=c(aE); if(isValidLanguageTag(aF)===false){ throw new $RangeError('Invalid language tag: '+aF); } var aG=%CanonicalizeLanguageTag(aF); if(aG==='invalid-tag'){ throw new $RangeError('Invalid language tag: '+aF); } return aG; } function initializeLocaleList(R){ var aH=[]; if(R===d){ aH=[]; }else{ if(typeof R==='string'){ aH.push(canonicalizeLanguageTag(R)); return freezeArray(aH); } var aI=ToObject(R); var aJ=aI.length>>>0; for(var aK=0;aKbl){ throw new $RangeError(ad+' value is out of range.'); } return $floor(ah); } return bm; } function initializeNumberFormat(bn,R,S){ if(%IsInitializedIntlObject(bn)){ throw new $TypeError('Trying to re-initialize NumberFormat object.'); } if(S===d){ S={}; } var ac=getGetOption(S,'numberformat'); var Z=resolveLocale('numberformat',R,S); var bd={}; defineWEProperty(bd,'style',ac( 'style','string',['decimal','percent','currency'],'decimal')); var bj=ac('currency','string'); if(bj!==d&&!isWellFormedCurrencyCode(bj)){ throw new $RangeError('Invalid currency code: '+bj); } if(bd.style==='currency'&&bj===d){ throw new $TypeError('Currency code is required with currency style.'); } var bo=ac( 'currencyDisplay','string',['code','symbol','name'],'symbol'); if(bd.style==='currency'){ defineWEProperty(bd,'currency',bj.toUpperCase()); defineWEProperty(bd,'currencyDisplay',bo); } var bp=getNumberOption(S,'minimumIntegerDigits',1,21,1); defineWEProperty(bd,'minimumIntegerDigits',bp); var bq=getNumberOption(S,'minimumFractionDigits',0,20,0); defineWEProperty(bd,'minimumFractionDigits',bq); var br=getNumberOption(S,'maximumFractionDigits',bq,20,3); defineWEProperty(bd,'maximumFractionDigits',br); var bs=S['minimumSignificantDigits']; var bt=S['maximumSignificantDigits']; if(bs!==d||bt!==d){ bs=getNumberOption(S,'minimumSignificantDigits',1,21,0); defineWEProperty(bd,'minimumSignificantDigits',bs); bt=getNumberOption(S,'maximumSignificantDigits',bs,21,21); defineWEProperty(bd,'maximumSignificantDigits',bt); } defineWEProperty(bd,'useGrouping',ac( 'useGrouping','boolean',d,true)); var am=parseExtension(Z.extension); var ak=setOptions(S,am,B, ac,bd); var bg=Z.locale+ak; var ai=ObjectDefineProperties({},{ currency:{writable:true}, currencyDisplay:{writable:true}, locale:{writable:true}, maximumFractionDigits:{writable:true}, minimumFractionDigits:{writable:true}, minimumIntegerDigits:{writable:true}, numberingSystem:{writable:true}, requestedLocale:{value:bg,writable:true}, style:{value:bd.style,writable:true}, useGrouping:{writable:true} }); if(bd.hasOwnProperty('minimumSignificantDigits')){ defineWEProperty(ai,'minimumSignificantDigits',d); } if(bd.hasOwnProperty('maximumSignificantDigits')){ defineWEProperty(ai,'maximumSignificantDigits',d); } var bu=%CreateNumberFormat(bg, bd, ai); if(bd.style==='currency'){ ObjectDefineProperty(ai,'currencyDisplay',{value:bo, writable:true}); } %MarkAsInitializedIntlObjectOfType(bn,'numberformat',bu); ObjectDefineProperty(bn,'resolved',{value:ai}); return bn; } %AddNamedProperty(g,'NumberFormat',function(){ var R=%_Arguments(0); var S=%_Arguments(1); if(!this||this===g){ return new g.NumberFormat(R,S); } return initializeNumberFormat(ToObject(this),R,S); }, 2 ); %AddNamedProperty(g.NumberFormat.prototype,'resolvedOptions',function(){ if(%_IsConstructCall()){ throw new $TypeError(E); } if(!%IsInitializedIntlObjectOfType(this,'numberformat')){ throw new $TypeError('resolvedOptions method called on a non-object'+ ' or on a object that is not Intl.NumberFormat.'); } var bv=this; var Z=getOptimalLanguageTag(bv.resolved.requestedLocale, bv.resolved.locale); var bw={ locale:Z, numberingSystem:bv.resolved.numberingSystem, style:bv.resolved.style, useGrouping:bv.resolved.useGrouping, minimumIntegerDigits:bv.resolved.minimumIntegerDigits, minimumFractionDigits:bv.resolved.minimumFractionDigits, maximumFractionDigits:bv.resolved.maximumFractionDigits, }; if(bw.style==='currency'){ defineWECProperty(bw,'currency',bv.resolved.currency); defineWECProperty(bw,'currencyDisplay', bv.resolved.currencyDisplay); } if(bv.resolved.hasOwnProperty('minimumSignificantDigits')){ defineWECProperty(bw,'minimumSignificantDigits', bv.resolved.minimumSignificantDigits); } if(bv.resolved.hasOwnProperty('maximumSignificantDigits')){ defineWECProperty(bw,'maximumSignificantDigits', bv.resolved.maximumSignificantDigits); } return bw; }, 2 ); %FunctionSetName(g.NumberFormat.prototype.resolvedOptions, 'resolvedOptions'); %FunctionRemovePrototype(g.NumberFormat.prototype.resolvedOptions); %SetNativeFlag(g.NumberFormat.prototype.resolvedOptions); %AddNamedProperty(g.NumberFormat,'supportedLocalesOf',function(R){ if(%_IsConstructCall()){ throw new $TypeError(E); } return supportedLocalesOf('numberformat',R,%_Arguments(1)); }, 2 ); %FunctionSetName(g.NumberFormat.supportedLocalesOf,'supportedLocalesOf'); %FunctionRemovePrototype(g.NumberFormat.supportedLocalesOf); %SetNativeFlag(g.NumberFormat.supportedLocalesOf); function formatNumber(bu,ah){ var bx=$Number(ah)+0; return %InternalNumberFormat(%GetImplFromInitializedIntlObject(bu), bx); } function parseNumber(bu,ah){ return %InternalNumberParse(%GetImplFromInitializedIntlObject(bu), c(ah)); } addBoundMethod(g.NumberFormat,'format',formatNumber,1); addBoundMethod(g.NumberFormat,'v8Parse',parseNumber,1); function toLDMLString(S){ var ac=getGetOption(S,'dateformat'); var by=''; var bz=ac('weekday','string',['narrow','short','long']); by+=appendToLDMLString( bz,{narrow:'EEEEE',short:'EEE',long:'EEEE'}); bz=ac('era','string',['narrow','short','long']); by+=appendToLDMLString( bz,{narrow:'GGGGG',short:'GGG',long:'GGGG'}); bz=ac('year','string',['2-digit','numeric']); by+=appendToLDMLString(bz,{'2-digit':'yy','numeric':'y'}); bz=ac('month','string', ['2-digit','numeric','narrow','short','long']); by+=appendToLDMLString(bz,{'2-digit':'MM','numeric':'M', 'narrow':'MMMMM','short':'MMM','long':'MMMM'}); bz=ac('day','string',['2-digit','numeric']); by+=appendToLDMLString( bz,{'2-digit':'dd','numeric':'d'}); var bA=ac('hour12','boolean'); bz=ac('hour','string',['2-digit','numeric']); if(bA===d){ by+=appendToLDMLString(bz,{'2-digit':'jj','numeric':'j'}); }else if(bA===true){ by+=appendToLDMLString(bz,{'2-digit':'hh','numeric':'h'}); }else{ by+=appendToLDMLString(bz,{'2-digit':'HH','numeric':'H'}); } bz=ac('minute','string',['2-digit','numeric']); by+=appendToLDMLString(bz,{'2-digit':'mm','numeric':'m'}); bz=ac('second','string',['2-digit','numeric']); by+=appendToLDMLString(bz,{'2-digit':'ss','numeric':'s'}); bz=ac('timeZoneName','string',['short','long']); by+=appendToLDMLString(bz,{short:'z',long:'zzzz'}); return by; } function appendToLDMLString(bz,bB){ if(bz!==d){ return bB[bz]; }else{ return''; } } function fromLDMLString(by){ by=by.replace(GetQuotedStringRE(),''); var S={}; var bC=by.match(/E{3,5}/g); S=appendToDateTimeObject( S,'weekday',bC,{EEEEE:'narrow',EEE:'short',EEEE:'long'}); bC=by.match(/G{3,5}/g); S=appendToDateTimeObject( S,'era',bC,{GGGGG:'narrow',GGG:'short',GGGG:'long'}); bC=by.match(/y{1,2}/g); S=appendToDateTimeObject( S,'year',bC,{y:'numeric',yy:'2-digit'}); bC=by.match(/M{1,5}/g); S=appendToDateTimeObject(S,'month',bC,{MM:'2-digit', M:'numeric',MMMMM:'narrow',MMM:'short',MMMM:'long'}); bC=by.match(/L{1,5}/g); S=appendToDateTimeObject(S,'month',bC,{LL:'2-digit', L:'numeric',LLLLL:'narrow',LLL:'short',LLLL:'long'}); bC=by.match(/d{1,2}/g); S=appendToDateTimeObject( S,'day',bC,{d:'numeric',dd:'2-digit'}); bC=by.match(/h{1,2}/g); if(bC!==null){ S['hour12']=true; } S=appendToDateTimeObject( S,'hour',bC,{h:'numeric',hh:'2-digit'}); bC=by.match(/H{1,2}/g); if(bC!==null){ S['hour12']=false; } S=appendToDateTimeObject( S,'hour',bC,{H:'numeric',HH:'2-digit'}); bC=by.match(/m{1,2}/g); S=appendToDateTimeObject( S,'minute',bC,{m:'numeric',mm:'2-digit'}); bC=by.match(/s{1,2}/g); S=appendToDateTimeObject( S,'second',bC,{s:'numeric',ss:'2-digit'}); bC=by.match(/z|zzzz/g); S=appendToDateTimeObject( S,'timeZoneName',bC,{z:'short',zzzz:'long'}); return S; } function appendToDateTimeObject(S,bz,bC,bB){ if((bC===null)){ if(!S.hasOwnProperty(bz)){ defineWEProperty(S,bz,d); } return S; } var ad=bC[0]; defineWEProperty(S,bz,bB[ad]); return S; } function toDateTimeOptions(S,bD,bE){ if(S===d){ S={}; }else{ S=((%_IsSpecObject(%IS_VAR(S)))?S:ToObject(S)); } var bF=true; if((bD==='date'||bD==='any')&& (S.weekday!==d||S.year!==d|| S.month!==d||S.day!==d)){ bF=false; } if((bD==='time'||bD==='any')&& (S.hour!==d||S.minute!==d|| S.second!==d)){ bF=false; } if(bF&&(bE==='date'||bE==='all')){ ObjectDefineProperty(S,'year',{value:'numeric', writable:true, enumerable:true, configurable:true}); ObjectDefineProperty(S,'month',{value:'numeric', writable:true, enumerable:true, configurable:true}); ObjectDefineProperty(S,'day',{value:'numeric', writable:true, enumerable:true, configurable:true}); } if(bF&&(bE==='time'||bE==='all')){ ObjectDefineProperty(S,'hour',{value:'numeric', writable:true, enumerable:true, configurable:true}); ObjectDefineProperty(S,'minute',{value:'numeric', writable:true, enumerable:true, configurable:true}); ObjectDefineProperty(S,'second',{value:'numeric', writable:true, enumerable:true, configurable:true}); } return S; } function initializeDateTimeFormat(bG,R,S){ if(%IsInitializedIntlObject(bG)){ throw new $TypeError('Trying to re-initialize DateTimeFormat object.'); } if(S===d){ S={}; } var Z=resolveLocale('dateformat',R,S); S=toDateTimeOptions(S,'any','date'); var ac=getGetOption(S,'dateformat'); var T=ac('formatMatcher','string', ['basic','best fit'],'best fit'); var by=toLDMLString(S); var bH=canonicalizeTimeZoneID(S.timeZone); var bd={}; var am=parseExtension(Z.extension); var ak=setOptions(S,am,C, ac,bd); var bg=Z.locale+ak; var ai=ObjectDefineProperties({},{ calendar:{writable:true}, day:{writable:true}, era:{writable:true}, hour12:{writable:true}, hour:{writable:true}, locale:{writable:true}, minute:{writable:true}, month:{writable:true}, numberingSystem:{writable:true}, pattern:{writable:true}, requestedLocale:{value:bg,writable:true}, second:{writable:true}, timeZone:{writable:true}, timeZoneName:{writable:true}, tz:{value:bH,writable:true}, weekday:{writable:true}, year:{writable:true} }); var bu=%CreateDateTimeFormat( bg,{skeleton:by,timeZone:bH},ai); if(bH!==d&&bH!==ai.timeZone){ throw new $RangeError('Unsupported time zone specified '+bH); } %MarkAsInitializedIntlObjectOfType(bG,'dateformat',bu); ObjectDefineProperty(bG,'resolved',{value:ai}); return bG; } %AddNamedProperty(g,'DateTimeFormat',function(){ var R=%_Arguments(0); var S=%_Arguments(1); if(!this||this===g){ return new g.DateTimeFormat(R,S); } return initializeDateTimeFormat(ToObject(this),R,S); }, 2 ); %AddNamedProperty(g.DateTimeFormat.prototype,'resolvedOptions',function(){ if(%_IsConstructCall()){ throw new $TypeError(E); } if(!%IsInitializedIntlObjectOfType(this,'dateformat')){ throw new $TypeError('resolvedOptions method called on a non-object or '+ 'on a object that is not Intl.DateTimeFormat.'); } var bv=this; var bI=fromLDMLString(bv.resolved.pattern); var bJ=z[bv.resolved.calendar]; if(bJ===d){ bJ=bv.resolved.calendar; } var Z=getOptimalLanguageTag(bv.resolved.requestedLocale, bv.resolved.locale); var bw={ locale:Z, numberingSystem:bv.resolved.numberingSystem, calendar:bJ, timeZone:bv.resolved.timeZone }; addWECPropertyIfDefined(bw,'timeZoneName',bI.timeZoneName); addWECPropertyIfDefined(bw,'era',bI.era); addWECPropertyIfDefined(bw,'year',bI.year); addWECPropertyIfDefined(bw,'month',bI.month); addWECPropertyIfDefined(bw,'day',bI.day); addWECPropertyIfDefined(bw,'weekday',bI.weekday); addWECPropertyIfDefined(bw,'hour12',bI.hour12); addWECPropertyIfDefined(bw,'hour',bI.hour); addWECPropertyIfDefined(bw,'minute',bI.minute); addWECPropertyIfDefined(bw,'second',bI.second); return bw; }, 2 ); %FunctionSetName(g.DateTimeFormat.prototype.resolvedOptions, 'resolvedOptions'); %FunctionRemovePrototype(g.DateTimeFormat.prototype.resolvedOptions); %SetNativeFlag(g.DateTimeFormat.prototype.resolvedOptions); %AddNamedProperty(g.DateTimeFormat,'supportedLocalesOf',function(R){ if(%_IsConstructCall()){ throw new $TypeError(E); } return supportedLocalesOf('dateformat',R,%_Arguments(1)); }, 2 ); %FunctionSetName(g.DateTimeFormat.supportedLocalesOf,'supportedLocalesOf'); %FunctionRemovePrototype(g.DateTimeFormat.supportedLocalesOf); %SetNativeFlag(g.DateTimeFormat.supportedLocalesOf); function formatDate(bu,bK){ var bL; if(bK===d){ bL=a.now(); }else{ bL=$Number(bK); } if(!$isFinite(bL)){ throw new $RangeError('Provided date is not in valid range.'); } return %InternalDateFormat(%GetImplFromInitializedIntlObject(bu), new a(bL)); } function parseDate(bu,ah){ return %InternalDateParse(%GetImplFromInitializedIntlObject(bu), c(ah)); } addBoundMethod(g.DateTimeFormat,'format',formatDate,0); addBoundMethod(g.DateTimeFormat,'v8Parse',parseDate,1); function canonicalizeTimeZoneID(bM){ if(bM===d){ return bM; } var bN=bM.toUpperCase(); if(bN==='UTC'||bN==='GMT'|| bN==='ETC/UTC'||bN==='ETC/GMT'){ return'UTC'; } var bC=GetTimezoneNameCheckRE().exec(bM); if((bC===null)){ throw new $RangeError('Expected Area/Location for time zone, got '+bM); } var bw=toTitleCaseWord(bC[1])+'/'+toTitleCaseWord(bC[2]); var Y=3; while(bC[Y]!==d&&Y0){ if((%_DebugIsActive()!=0))%DebugPrepareStepInIfStepping(this); try{ return %_GeneratorNext(this,a); }catch(e){ %GeneratorClose(this); throw e; } }else if(b==0){ return{value:void 0,done:true}; }else{ throw MakeTypeError('generator_running',[]); } } function GeneratorObjectThrow(a){ if(!(%_ClassOf(this)==='Generator')){ throw MakeTypeError('incompatible_method_receiver', ['[Generator].prototype.throw',this]); } var b=%GeneratorGetContinuation(this); if(b>0){ try{ return %_GeneratorThrow(this,a); }catch(e){ %GeneratorClose(this); throw e; } }else if(b==0){ throw a; }else{ throw MakeTypeError('generator_running',[]); } } function GeneratorObjectIterator(){ return this; } function GeneratorFunctionPrototypeConstructor(a){ if(%_IsConstructCall()){ throw MakeTypeError('not_constructor',['GeneratorFunctionPrototype']); } } function GeneratorFunctionConstructor(a){ return NewFunctionFromString(arguments,'function*'); } function SetUpGenerators(){ %CheckIsBootstrapping(); %NeverOptimizeFunction(GeneratorObjectNext); %NeverOptimizeFunction(GeneratorObjectThrow); var a=GeneratorFunctionPrototype.prototype; InstallFunctions(a, 2|4|1, ["next",GeneratorObjectNext, "throw",GeneratorObjectThrow]); %FunctionSetName(GeneratorObjectIterator,'[Symbol.iterator]'); %AddNamedProperty(a,symbolIterator, GeneratorObjectIterator,2|4|1); %AddNamedProperty(a,"constructor", GeneratorFunctionPrototype,2|1); %AddNamedProperty(a, symbolToStringTag,"Generator",2|1); %InternalSetPrototype(GeneratorFunctionPrototype,$Function.prototype); %AddNamedProperty(GeneratorFunctionPrototype, symbolToStringTag,"GeneratorFunction",2|1); %SetCode(GeneratorFunctionPrototype,GeneratorFunctionPrototypeConstructor); %AddNamedProperty(GeneratorFunctionPrototype,"constructor", GeneratorFunction,2|1); %InternalSetPrototype(GeneratorFunction,$Function); %SetCode(GeneratorFunction,GeneratorFunctionConstructor); } SetUpGenerators(); 4harmony-arrayý5 'use strict'; function ArrayFind(a){ if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError('called_on_null_or_undefined',["Array.prototype.find"]); var b=ToObject(this); var c=ToInteger(b.length); if(!(%_ClassOf(a)==='Function')){ throw MakeTypeError('called_non_callable',[a]); } var d; if(%_ArgumentsLength()>1){ d=%_Arguments(1); } var e=false; if((d==null)){ d=%GetDefaultReceiver(a)||d; }else{ e=(!(%_IsSpecObject(d))&&%IsSloppyModeFunction(a)); } for(var f=0;f1){ d=%_Arguments(1); } var e=false; if((d==null)){ d=%GetDefaultReceiver(a)||d; }else{ e=(!(%_IsSpecObject(d))&&%IsSloppyModeFunction(a)); } for(var f=0;f>>0); var d=0; var e=c; if(%_ArgumentsLength()>1){ d=%_Arguments(1); d=(d===(void 0))?0:(%_IsSmi(%IS_VAR(d))?d:%NumberToInteger(ToNumber(d))); if(%_ArgumentsLength()>2){ e=%_Arguments(2); e=(e===(void 0))?c:(%_IsSmi(%IS_VAR(e))?e:%NumberToInteger(ToNumber(e))); } } if(d<0){ d+=c; if(d<0)d=0; }else{ if(d>c)d=c; } if(e<0){ e+=c; if(e<0)e=0; }else{ if(e>c)e=c; } if((e-d)>0&&ObjectIsFrozen(b)){ throw MakeTypeError("array_functions_on_frozen", ["Array.prototype.fill"]); } for(;d=0){ f=e; }else{ f=d+e; if(f<0){ f=0; } } while(f1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g1){ c=%_Arguments(1); } var d=false; if((c==null)){ c=%GetDefaultReceiver(a)||c; }else{ d=(!(%_IsSpecObject(c))&&%IsSloppyModeFunction(a)); } var e=(%_DebugIsActive()!=0)&&%DebugCallbackSupportsStepping(a); for(var g=0;g