From f7840f65f0990dc32a7432e8cd4ab61b0f594a50 Mon Sep 17 00:00:00 2001 From: "karlklose@chromium.org" Date: Thu, 14 Apr 2011 08:01:19 +0000 Subject: [PATCH] Isolates: Cleanup usage of FACTORY in code stubs and bootstrapper. Review URL: http://codereview.chromium.org/6720014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 1 + src/arm/code-stubs-arm.cc | 12 +- src/bootstrapper.cc | 326 ++++++++++++++++++++--------------------- src/bootstrapper.h | 1 + src/debug.cc | 1 + src/ia32/code-stubs-ia32.cc | 10 +- src/x64/code-stubs-x64.cc | 12 +- src/x64/macro-assembler-x64.cc | 13 +- 8 files changed, 193 insertions(+), 183 deletions(-) diff --git a/src/api.cc b/src/api.cc index a2373cd..1a52174 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3707,6 +3707,7 @@ Persistent v8::Context::New( // Create the environment. env = isolate->bootstrapper()->CreateEnvironment( + isolate, Utils::OpenHandle(*global_object), proxy_template, extensions); diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index be540e4..d77047f 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -3678,7 +3678,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { __ b(ne, &slow); // Null is not instance of anything. - __ cmp(scratch, Operand(FACTORY->null_value())); + __ cmp(scratch, Operand(masm->isolate()->factory()->null_value())); __ b(ne, &object_not_null); __ mov(r0, Operand(Smi::FromInt(1))); __ Ret(HasArgsInRegisters() ? 0 : 2); @@ -4176,7 +4176,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { __ bind(&failure); // For failure and exception return null. - __ mov(r0, Operand(FACTORY->null_value())); + __ mov(r0, Operand(masm->isolate()->factory()->null_value())); __ add(sp, sp, Operand(4 * kPointerSize)); __ Ret(); @@ -4247,6 +4247,8 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { const int kMaxInlineLength = 100; Label slowcase; Label done; + Factory* factory = masm->isolate()->factory(); + __ ldr(r1, MemOperand(sp, kPointerSize * 2)); STATIC_ASSERT(kSmiTag == 0); STATIC_ASSERT(kSmiTagSize == 1); @@ -4281,7 +4283,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { // Interleave operations for better latency. __ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX)); __ add(r3, r0, Operand(JSRegExpResult::kSize)); - __ mov(r4, Operand(FACTORY->empty_fixed_array())); + __ mov(r4, Operand(factory->empty_fixed_array())); __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); __ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX)); @@ -4302,13 +4304,13 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { // r5: Number of elements in array, untagged. // Set map. - __ mov(r2, Operand(FACTORY->fixed_array_map())); + __ mov(r2, Operand(factory->fixed_array_map())); __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); // Set FixedArray length. __ mov(r6, Operand(r5, LSL, kSmiTagSize)); __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); // Fill contents of fixed-array with the-hole. - __ mov(r2, Operand(FACTORY->the_hole_value())); + __ mov(r2, Operand(factory->the_hole_value())); __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); // Fill fixed array elements with hole. // r0: JSArray, tagged. diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index a30ffc0..be51747 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1,4 +1,4 @@ -// Copyright 2006-2008 the V8 project authors. All rights reserved. +// Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -141,7 +141,8 @@ void Bootstrapper::TearDown() { class Genesis BASE_EMBEDDED { public: - Genesis(Handle global_object, + Genesis(Isolate* isolate, + Handle global_object, v8::Handle global_template, v8::ExtensionConfiguration* extensions); ~Genesis() { } @@ -150,8 +151,13 @@ class Genesis BASE_EMBEDDED { Genesis* previous() { return previous_; } + Isolate* isolate() const { return isolate_; } + Factory* factory() const { return isolate_->factory(); } + Heap* heap() const { return isolate_->heap(); } + private: Handle global_context_; + Isolate* isolate_; // There may be more than one active genesis object: When GC is // triggered during environment creation there may be weak handle @@ -163,7 +169,7 @@ class Genesis BASE_EMBEDDED { // Creates some basic objects. Used for creating a context from scratch. void CreateRoots(); // Creates the empty function. Used for creating a context from scratch. - Handle CreateEmptyFunction(); + Handle CreateEmptyFunction(Isolate* isolate); // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3 Handle CreateThrowTypeErrorFunction(Builtins::Name builtin); @@ -239,7 +245,7 @@ class Genesis BASE_EMBEDDED { Handle arguments, Handle caller); - static bool CompileBuiltin(int index); + static bool CompileBuiltin(Isolate* isolate, int index); static bool CompileNative(Vector name, Handle source); static bool CompileScriptCached(Vector name, Handle source, @@ -269,12 +275,13 @@ void Bootstrapper::Iterate(ObjectVisitor* v) { Handle Bootstrapper::CreateEnvironment( + Isolate* isolate, Handle global_object, v8::Handle global_template, v8::ExtensionConfiguration* extensions) { HandleScope scope; Handle env; - Genesis genesis(global_object, global_template, extensions); + Genesis genesis(isolate, global_object, global_template, extensions); env = genesis.result(); if (!env.is_null()) { if (InstallExtensions(env, extensions)) { @@ -287,15 +294,16 @@ Handle Bootstrapper::CreateEnvironment( static void SetObjectPrototype(Handle object, Handle proto) { // object.__proto__ = proto; + Factory* factory = object->GetIsolate()->factory(); Handle old_to_map = Handle(object->map()); - Handle new_to_map = FACTORY->CopyMapDropTransitions(old_to_map); + Handle new_to_map = factory->CopyMapDropTransitions(old_to_map); new_to_map->set_prototype(*proto); object->set_map(*new_to_map); } void Bootstrapper::DetachGlobal(Handle env) { - Factory* factory = Isolate::Current()->factory(); + Factory* factory = env->GetIsolate()->factory(); JSGlobalProxy::cast(env->global_proxy())->set_context(*factory->null_value()); SetObjectPrototype(Handle(env->global_proxy()), factory->null_value()); @@ -322,7 +330,7 @@ static Handle InstallFunction(Handle target, Handle prototype, Builtins::Name call, bool is_ecma_native) { - Isolate* isolate = Isolate::Current(); + Isolate* isolate = target->GetIsolate(); Factory* factory = isolate->factory(); Handle symbol = factory->LookupAsciiSymbol(name); Handle call_code = Handle(isolate->builtins()->builtin(call)); @@ -344,30 +352,29 @@ static Handle InstallFunction(Handle target, Handle Genesis::ComputeFunctionInstanceDescriptor( PrototypePropertyMode prototypeMode) { - Factory* factory = Isolate::Current()->factory(); Handle descriptors = - factory->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5); + factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5); PropertyAttributes attributes = static_cast(DONT_ENUM | DONT_DELETE | READ_ONLY); { // Add length. - Handle proxy = factory->NewProxy(&Accessors::FunctionLength); - CallbacksDescriptor d(*factory->length_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionLength); + CallbacksDescriptor d(*factory()->length_symbol(), *proxy, attributes); descriptors->Set(0, &d); } { // Add name. - Handle proxy = factory->NewProxy(&Accessors::FunctionName); - CallbacksDescriptor d(*factory->name_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionName); + CallbacksDescriptor d(*factory()->name_symbol(), *proxy, attributes); descriptors->Set(1, &d); } { // Add arguments. - Handle proxy = factory->NewProxy(&Accessors::FunctionArguments); - CallbacksDescriptor d(*factory->arguments_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionArguments); + CallbacksDescriptor d(*factory()->arguments_symbol(), *proxy, attributes); descriptors->Set(2, &d); } { // Add caller. - Handle proxy = factory->NewProxy(&Accessors::FunctionCaller); - CallbacksDescriptor d(*factory->caller_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionCaller); + CallbacksDescriptor d(*factory()->caller_symbol(), *proxy, attributes); descriptors->Set(3, &d); } if (prototypeMode != DONT_ADD_PROTOTYPE) { @@ -375,8 +382,8 @@ Handle Genesis::ComputeFunctionInstanceDescriptor( if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { attributes = static_cast(attributes & ~READ_ONLY); } - Handle proxy = factory->NewProxy(&Accessors::FunctionPrototype); - CallbacksDescriptor d(*factory->prototype_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionPrototype); + CallbacksDescriptor d(*factory()->prototype_symbol(), *proxy, attributes); descriptors->Set(4, &d); } descriptors->Sort(); @@ -385,7 +392,7 @@ Handle Genesis::ComputeFunctionInstanceDescriptor( Handle Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { - Handle map = FACTORY->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); + Handle map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); Handle descriptors = ComputeFunctionInstanceDescriptor(prototype_mode); map->set_instance_descriptors(*descriptors); @@ -394,7 +401,7 @@ Handle Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { } -Handle Genesis::CreateEmptyFunction() { +Handle Genesis::CreateEmptyFunction(Isolate* isolate) { // Allocate the map for function instances. Maps are allocated first and their // prototypes patched later, once empty function is created. @@ -422,7 +429,6 @@ Handle Genesis::CreateEmptyFunction() { function_instance_map_writable_prototype_ = CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE); - Isolate* isolate = Isolate::Current(); Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); @@ -491,28 +497,29 @@ Handle Genesis::ComputeStrictFunctionInstanceDescriptor( PrototypePropertyMode prototypeMode, Handle arguments, Handle caller) { - Factory* factory = Isolate::Current()->factory(); Handle descriptors = - factory->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5); + factory()->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5); PropertyAttributes attributes = static_cast( DONT_ENUM | DONT_DELETE | READ_ONLY); { // length - Handle proxy = factory->NewProxy(&Accessors::FunctionLength); - CallbacksDescriptor d(*factory->length_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionLength); + CallbacksDescriptor d(*factory()->length_symbol(), *proxy, attributes); descriptors->Set(0, &d); } { // name - Handle proxy = factory->NewProxy(&Accessors::FunctionName); - CallbacksDescriptor d(*factory->name_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionName); + CallbacksDescriptor d(*factory()->name_symbol(), *proxy, attributes); descriptors->Set(1, &d); } { // arguments - CallbacksDescriptor d(*factory->arguments_symbol(), *arguments, attributes); + CallbacksDescriptor d(*factory()->arguments_symbol(), + *arguments, + attributes); descriptors->Set(2, &d); } { // caller - CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes); + CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attributes); descriptors->Set(3, &d); } @@ -521,8 +528,8 @@ Handle Genesis::ComputeStrictFunctionInstanceDescriptor( if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { attributes = static_cast(attributes & ~READ_ONLY); } - Handle proxy = factory->NewProxy(&Accessors::FunctionPrototype); - CallbacksDescriptor d(*factory->prototype_symbol(), *proxy, attributes); + Handle proxy = factory()->NewProxy(&Accessors::FunctionPrototype); + CallbacksDescriptor d(*factory()->prototype_symbol(), *proxy, attributes); descriptors->Set(4, &d); } @@ -534,14 +541,11 @@ Handle Genesis::ComputeStrictFunctionInstanceDescriptor( // ECMAScript 5th Edition, 13.2.3 Handle Genesis::CreateThrowTypeErrorFunction( Builtins::Name builtin) { - Isolate* isolate = Isolate::Current(); - Factory* factory = isolate->factory(); - - Handle name = factory->LookupAsciiSymbol("ThrowTypeError"); + Handle name = factory()->LookupAsciiSymbol("ThrowTypeError"); Handle throw_type_error = - factory->NewFunctionWithoutPrototype(name, kStrictMode); + factory()->NewFunctionWithoutPrototype(name, kStrictMode); Handle code = Handle( - isolate->builtins()->builtin(builtin)); + isolate()->builtins()->builtin(builtin)); throw_type_error->set_map(global_context()->strict_mode_function_map()); throw_type_error->set_code(*code); @@ -559,7 +563,7 @@ Handle Genesis::CreateStrictModeFunctionMap( Handle empty_function, Handle arguments_callbacks, Handle caller_callbacks) { - Handle map = FACTORY->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); + Handle map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); Handle descriptors = ComputeStrictFunctionInstanceDescriptor(prototype_mode, arguments_callbacks, @@ -574,7 +578,7 @@ Handle Genesis::CreateStrictModeFunctionMap( void Genesis::CreateStrictModeFunctionMaps(Handle empty) { // Create the callbacks arrays for ThrowTypeError functions. // The get/set callacks are filled in after the maps are created below. - Factory* factory = Isolate::Current()->factory(); + Factory* factory = empty->GetIsolate()->factory(); Handle arguments = factory->NewFixedArray(2, TENURED); Handle caller = factory->NewFixedArray(2, TENURED); @@ -623,7 +627,7 @@ void Genesis::CreateStrictModeFunctionMaps(Handle empty) { static void AddToWeakGlobalContextList(Context* context) { ASSERT(context->IsGlobalContext()); - Heap* heap = Isolate::Current()->heap(); + Heap* heap = context->GetIsolate()->heap(); #ifdef DEBUG { // NOLINT ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined()); @@ -641,15 +645,14 @@ static void AddToWeakGlobalContextList(Context* context) { void Genesis::CreateRoots() { - Isolate* isolate = Isolate::Current(); // Allocate the global context FixedArray first and then patch the // closure and extension object later (we need the empty function // and the global object, but in order to create those, we need the // global context). - global_context_ = Handle::cast(isolate->global_handles()->Create( - *isolate->factory()->NewGlobalContext())); + global_context_ = Handle::cast(isolate()->global_handles()->Create( + *factory()->NewGlobalContext())); AddToWeakGlobalContextList(*global_context_); - isolate->set_context(*global_context()); + isolate()->set_context(*global_context()); // Allocate the message listeners object. { @@ -692,17 +695,13 @@ Handle Genesis::CreateNewGlobals( } } - Isolate* isolate = Isolate::Current(); - Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); - if (js_global_template.is_null()) { - Handle name = Handle(heap->empty_symbol()); - Handle code = Handle(isolate->builtins()->builtin( + Handle name = Handle(heap()->empty_symbol()); + Handle code = Handle(isolate()->builtins()->builtin( Builtins::kIllegal)); js_global_function = - factory->NewFunction(name, JS_GLOBAL_OBJECT_TYPE, - JSGlobalObject::kSize, code, true); + factory()->NewFunction(name, JS_GLOBAL_OBJECT_TYPE, + JSGlobalObject::kSize, code, true); // Change the constructor property of the prototype of the // hidden global function to refer to the Object function. Handle prototype = @@ -710,20 +709,20 @@ Handle Genesis::CreateNewGlobals( JSObject::cast(js_global_function->instance_prototype())); SetLocalPropertyNoThrow( prototype, - factory->constructor_symbol(), - isolate->object_function(), + factory()->constructor_symbol(), + isolate()->object_function(), NONE); } else { Handle js_global_constructor( FunctionTemplateInfo::cast(js_global_template->constructor())); js_global_function = - factory->CreateApiFunction(js_global_constructor, - factory->InnerGlobalObject); + factory()->CreateApiFunction(js_global_constructor, + factory()->InnerGlobalObject); } js_global_function->initial_map()->set_is_hidden_prototype(); Handle inner_global = - factory->NewGlobalObject(js_global_function); + factory()->NewGlobalObject(js_global_function); if (inner_global_out != NULL) { *inner_global_out = inner_global; } @@ -731,23 +730,23 @@ Handle Genesis::CreateNewGlobals( // Step 2: create or re-initialize the global proxy object. Handle global_proxy_function; if (global_template.IsEmpty()) { - Handle name = Handle(heap->empty_symbol()); - Handle code = Handle(isolate->builtins()->builtin( + Handle name = Handle(heap()->empty_symbol()); + Handle code = Handle(isolate()->builtins()->builtin( Builtins::kIllegal)); global_proxy_function = - factory->NewFunction(name, JS_GLOBAL_PROXY_TYPE, - JSGlobalProxy::kSize, code, true); + factory()->NewFunction(name, JS_GLOBAL_PROXY_TYPE, + JSGlobalProxy::kSize, code, true); } else { Handle data = v8::Utils::OpenHandle(*global_template); Handle global_constructor( FunctionTemplateInfo::cast(data->constructor())); global_proxy_function = - factory->CreateApiFunction(global_constructor, - factory->OuterGlobalObject); + factory()->CreateApiFunction(global_constructor, + factory()->OuterGlobalObject); } - Handle global_name = factory->LookupAsciiSymbol("global"); + Handle global_name = factory()->LookupAsciiSymbol("global"); global_proxy_function->shared()->set_instance_class_name(*global_name); global_proxy_function->initial_map()->set_is_access_check_needed(true); @@ -761,7 +760,7 @@ Handle Genesis::CreateNewGlobals( Handle::cast(global_object)); } else { return Handle::cast( - factory->NewJSObject(global_proxy_function, TENURED)); + factory()->NewJSObject(global_proxy_function, TENURED)); } } @@ -786,7 +785,7 @@ void Genesis::HookUpInnerGlobal(Handle inner_global) { static const PropertyAttributes attributes = static_cast(READ_ONLY | DONT_DELETE); ForceSetProperty(builtins_global, - FACTORY->LookupAsciiSymbol("global"), + factory()->LookupAsciiSymbol("global"), inner_global, attributes); // Setup the reference from the global object to the builtins object. @@ -814,7 +813,7 @@ void Genesis::InitializeGlobal(Handle inner_global, // object reinitialization. global_context()->set_security_token(*inner_global); - Isolate* isolate = Isolate::Current(); + Isolate* isolate = inner_global->GetIsolate(); Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); @@ -1164,17 +1163,17 @@ void Genesis::InitializeGlobal(Handle inner_global, } -bool Genesis::CompileBuiltin(int index) { +bool Genesis::CompileBuiltin(Isolate* isolate, int index) { Vector name = Natives::GetScriptName(index); Handle source_code = - Isolate::Current()->bootstrapper()->NativesSourceLookup(index); + isolate->bootstrapper()->NativesSourceLookup(index); return CompileNative(name, source_code); } bool Genesis::CompileNative(Vector name, Handle source) { HandleScope scope; - Isolate* isolate = Isolate::Current(); + Isolate* isolate = source->GetIsolate(); #ifdef ENABLE_DEBUGGER_SUPPORT isolate->debugger()->set_compiling_natives(true); #endif @@ -1199,7 +1198,7 @@ bool Genesis::CompileScriptCached(Vector name, v8::Extension* extension, Handle top_context, bool use_runtime_context) { - Factory* factory = Isolate::Current()->factory(); + Factory* factory = source->GetIsolate()->factory(); HandleScope scope; Handle function_info; @@ -1247,14 +1246,13 @@ bool Genesis::CompileScriptCached(Vector name, #define INSTALL_NATIVE(Type, name, var) \ - Handle var##_name = factory->LookupAsciiSymbol(name); \ + Handle var##_name = factory()->LookupAsciiSymbol(name); \ Object* var##_native = \ global_context()->builtins()->GetPropertyNoExceptionThrown(*var##_name); \ global_context()->set_##var(Type::cast(var##_native)); void Genesis::InstallNativeFunctions() { - Factory* factory = Isolate::Current()->factory(); HandleScope scope; INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); @@ -1277,25 +1275,23 @@ void Genesis::InstallNativeFunctions() { bool Genesis::InstallNatives() { HandleScope scope; - Isolate* isolate = Isolate::Current(); - Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); // Create a function for the builtins object. Allocate space for the // JavaScript builtins, a reference to the builtins object // (itself) and a reference to the global_context directly in the object. Handle code = Handle( - isolate->builtins()->builtin(Builtins::kIllegal)); + isolate()->builtins()->builtin(Builtins::kIllegal)); Handle builtins_fun = - factory->NewFunction(factory->empty_symbol(), JS_BUILTINS_OBJECT_TYPE, - JSBuiltinsObject::kSize, code, true); + factory()->NewFunction(factory()->empty_symbol(), + JS_BUILTINS_OBJECT_TYPE, + JSBuiltinsObject::kSize, code, true); - Handle name = factory->LookupAsciiSymbol("builtins"); + Handle name = factory()->LookupAsciiSymbol("builtins"); builtins_fun->shared()->set_instance_class_name(*name); // Allocate the builtins object. Handle builtins = - Handle::cast(factory->NewGlobalObject(builtins_fun)); + Handle::cast(factory()->NewGlobalObject(builtins_fun)); builtins->set_builtins(*builtins); builtins->set_global_context(*global_context()); builtins->set_global_receiver(*builtins); @@ -1306,7 +1302,7 @@ bool Genesis::InstallNatives() { // global object. static const PropertyAttributes attributes = static_cast(READ_ONLY | DONT_DELETE); - Handle global_symbol = factory->LookupAsciiSymbol("global"); + Handle global_symbol = factory()->LookupAsciiSymbol("global"); Handle global_obj(global_context()->global()); SetLocalPropertyNoThrow(builtins, global_symbol, global_obj, attributes); @@ -1315,12 +1311,13 @@ bool Genesis::InstallNatives() { // Create a bridge function that has context in the global context. Handle bridge = - factory->NewFunction(factory->empty_symbol(), factory->undefined_value()); - ASSERT(bridge->context() == *isolate->global_context()); + factory()->NewFunction(factory()->empty_symbol(), + factory()->undefined_value()); + ASSERT(bridge->context() == *isolate()->global_context()); // Allocate the builtins context. Handle context = - factory->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge); + factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge); context->set_global(*builtins); // override builtins global object global_context()->set_runtime_context(*context); @@ -1329,113 +1326,113 @@ bool Genesis::InstallNatives() { // Builtin functions for Script. Handle script_fun = InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, - isolate->initial_object_prototype(), + isolate()->initial_object_prototype(), Builtins::kIllegal, false); Handle prototype = - factory->NewJSObject(isolate->object_function(), TENURED); + factory()->NewJSObject(isolate()->object_function(), TENURED); SetPrototype(script_fun, prototype); global_context()->set_script_function(*script_fun); // Add 'source' and 'data' property to scripts. PropertyAttributes common_attributes = static_cast(DONT_ENUM | DONT_DELETE | READ_ONLY); - Handle proxy_source = factory->NewProxy(&Accessors::ScriptSource); + Handle proxy_source = factory()->NewProxy(&Accessors::ScriptSource); Handle script_descriptors = - factory->CopyAppendProxyDescriptor( - factory->empty_descriptor_array(), - factory->LookupAsciiSymbol("source"), + factory()->CopyAppendProxyDescriptor( + factory()->empty_descriptor_array(), + factory()->LookupAsciiSymbol("source"), proxy_source, common_attributes); - Handle proxy_name = factory->NewProxy(&Accessors::ScriptName); + Handle proxy_name = factory()->NewProxy(&Accessors::ScriptName); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("name"), + factory()->LookupAsciiSymbol("name"), proxy_name, common_attributes); - Handle proxy_id = factory->NewProxy(&Accessors::ScriptId); + Handle proxy_id = factory()->NewProxy(&Accessors::ScriptId); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("id"), + factory()->LookupAsciiSymbol("id"), proxy_id, common_attributes); Handle proxy_line_offset = - factory->NewProxy(&Accessors::ScriptLineOffset); + factory()->NewProxy(&Accessors::ScriptLineOffset); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("line_offset"), + factory()->LookupAsciiSymbol("line_offset"), proxy_line_offset, common_attributes); Handle proxy_column_offset = - factory->NewProxy(&Accessors::ScriptColumnOffset); + factory()->NewProxy(&Accessors::ScriptColumnOffset); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("column_offset"), + factory()->LookupAsciiSymbol("column_offset"), proxy_column_offset, common_attributes); - Handle proxy_data = factory->NewProxy(&Accessors::ScriptData); + Handle proxy_data = factory()->NewProxy(&Accessors::ScriptData); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("data"), + factory()->LookupAsciiSymbol("data"), proxy_data, common_attributes); - Handle proxy_type = factory->NewProxy(&Accessors::ScriptType); + Handle proxy_type = factory()->NewProxy(&Accessors::ScriptType); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("type"), + factory()->LookupAsciiSymbol("type"), proxy_type, common_attributes); Handle proxy_compilation_type = - factory->NewProxy(&Accessors::ScriptCompilationType); + factory()->NewProxy(&Accessors::ScriptCompilationType); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("compilation_type"), + factory()->LookupAsciiSymbol("compilation_type"), proxy_compilation_type, common_attributes); Handle proxy_line_ends = - factory->NewProxy(&Accessors::ScriptLineEnds); + factory()->NewProxy(&Accessors::ScriptLineEnds); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("line_ends"), + factory()->LookupAsciiSymbol("line_ends"), proxy_line_ends, common_attributes); Handle proxy_context_data = - factory->NewProxy(&Accessors::ScriptContextData); + factory()->NewProxy(&Accessors::ScriptContextData); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("context_data"), + factory()->LookupAsciiSymbol("context_data"), proxy_context_data, common_attributes); Handle proxy_eval_from_script = - factory->NewProxy(&Accessors::ScriptEvalFromScript); + factory()->NewProxy(&Accessors::ScriptEvalFromScript); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("eval_from_script"), + factory()->LookupAsciiSymbol("eval_from_script"), proxy_eval_from_script, common_attributes); Handle proxy_eval_from_script_position = - factory->NewProxy(&Accessors::ScriptEvalFromScriptPosition); + factory()->NewProxy(&Accessors::ScriptEvalFromScriptPosition); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("eval_from_script_position"), + factory()->LookupAsciiSymbol("eval_from_script_position"), proxy_eval_from_script_position, common_attributes); Handle proxy_eval_from_function_name = - factory->NewProxy(&Accessors::ScriptEvalFromFunctionName); + factory()->NewProxy(&Accessors::ScriptEvalFromFunctionName); script_descriptors = - factory->CopyAppendProxyDescriptor( + factory()->CopyAppendProxyDescriptor( script_descriptors, - factory->LookupAsciiSymbol("eval_from_function_name"), + factory()->LookupAsciiSymbol("eval_from_function_name"), proxy_eval_from_function_name, common_attributes); @@ -1443,9 +1440,9 @@ bool Genesis::InstallNatives() { script_map->set_instance_descriptors(*script_descriptors); // Allocate the empty script. - Handle