Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/bootstrapper.cc

Issue 1406113007: Merge GlobalObject with JSGlobalObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // Make the "arguments" and "caller" properties throw a TypeError on access. 169 // Make the "arguments" and "caller" properties throw a TypeError on access.
170 void AddRestrictedFunctionProperties(Handle<Map> map); 170 void AddRestrictedFunctionProperties(Handle<Map> map);
171 171
172 // Creates the global objects using the global proxy and the template passed 172 // Creates the global objects using the global proxy and the template passed
173 // in through the API. We call this regardless of whether we are building a 173 // in through the API. We call this regardless of whether we are building a
174 // context from scratch or using a deserialized one from the partial snapshot 174 // context from scratch or using a deserialized one from the partial snapshot
175 // but in the latter case we don't use the objects it produces directly, as 175 // but in the latter case we don't use the objects it produces directly, as
176 // we have to used the deserialized ones that are linked together with the 176 // we have to used the deserialized ones that are linked together with the
177 // rest of the context snapshot. 177 // rest of the context snapshot.
178 Handle<GlobalObject> CreateNewGlobals( 178 Handle<JSGlobalObject> CreateNewGlobals(
179 v8::Local<v8::ObjectTemplate> global_proxy_template, 179 v8::Local<v8::ObjectTemplate> global_proxy_template,
180 Handle<JSGlobalProxy> global_proxy); 180 Handle<JSGlobalProxy> global_proxy);
181 // Hooks the given global proxy into the context. If the context was created 181 // Hooks the given global proxy into the context. If the context was created
182 // by deserialization then this will unhook the global proxy that was 182 // by deserialization then this will unhook the global proxy that was
183 // deserialized, leaving the GC to pick it up. 183 // deserialized, leaving the GC to pick it up.
184 void HookUpGlobalProxy(Handle<GlobalObject> global_object, 184 void HookUpGlobalProxy(Handle<JSGlobalObject> global_object,
185 Handle<JSGlobalProxy> global_proxy); 185 Handle<JSGlobalProxy> global_proxy);
186 // Similarly, we want to use the global that has been created by the templates 186 // Similarly, we want to use the global that has been created by the templates
187 // passed through the API. The global from the snapshot is detached from the 187 // passed through the API. The global from the snapshot is detached from the
188 // other objects in the snapshot. 188 // other objects in the snapshot.
189 void HookUpGlobalObject(Handle<GlobalObject> global_object, 189 void HookUpGlobalObject(Handle<JSGlobalObject> global_object,
190 Handle<FixedArray> outdated_contexts); 190 Handle<FixedArray> outdated_contexts);
191 // The native context has a ScriptContextTable that store declarative bindings 191 // The native context has a ScriptContextTable that store declarative bindings
192 // made in script scopes. Add a "this" binding to that table pointing to the 192 // made in script scopes. Add a "this" binding to that table pointing to the
193 // global proxy. 193 // global proxy.
194 void InstallGlobalThisBinding(); 194 void InstallGlobalThisBinding();
195 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts); 195 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts);
196 // New context initialization. Used for creating a context from scratch. 196 // New context initialization. Used for creating a context from scratch.
197 void InitializeGlobal(Handle<GlobalObject> global_object, 197 void InitializeGlobal(Handle<JSGlobalObject> global_object,
198 Handle<JSFunction> empty_function, 198 Handle<JSFunction> empty_function,
199 ContextType context_type); 199 ContextType context_type);
200 void InitializeExperimentalGlobal(); 200 void InitializeExperimentalGlobal();
201 // Typed arrays are not serializable and have to initialized afterwards. 201 // Typed arrays are not serializable and have to initialized afterwards.
202 bool InitializeBuiltinTypedArrays(); 202 bool InitializeBuiltinTypedArrays();
203 // Depending on the situation, expose and/or get rid of the utils object. 203 // Depending on the situation, expose and/or get rid of the utils object.
204 void ConfigureUtilsObject(ContextType context_type); 204 void ConfigureUtilsObject(ContextType context_type);
205 205
206 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ 206 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \
207 void InitializeGlobal_##id(); 207 void InitializeGlobal_##id();
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 int slot = scope_info->ReceiverContextSlotIndex(); 930 int slot = scope_info->ReceiverContextSlotIndex();
931 if (slot >= 0) { 931 if (slot >= 0) {
932 DCHECK_EQ(slot, Context::MIN_CONTEXT_SLOTS); 932 DCHECK_EQ(slot, Context::MIN_CONTEXT_SLOTS);
933 context->set(slot, native_context()->global_proxy()); 933 context->set(slot, native_context()->global_proxy());
934 } 934 }
935 } 935 }
936 } 936 }
937 } 937 }
938 938
939 939
940 Handle<GlobalObject> Genesis::CreateNewGlobals( 940 Handle<JSGlobalObject> Genesis::CreateNewGlobals(
941 v8::Local<v8::ObjectTemplate> global_proxy_template, 941 v8::Local<v8::ObjectTemplate> global_proxy_template,
942 Handle<JSGlobalProxy> global_proxy) { 942 Handle<JSGlobalProxy> global_proxy) {
943 // The argument global_proxy_template aka data is an ObjectTemplateInfo. 943 // The argument global_proxy_template aka data is an ObjectTemplateInfo.
944 // It has a constructor pointer that points at global_constructor which is a 944 // It has a constructor pointer that points at global_constructor which is a
945 // FunctionTemplateInfo. 945 // FunctionTemplateInfo.
946 // The global_proxy_constructor is used to (re)initialize the 946 // The global_proxy_constructor is used to (re)initialize the
947 // global_proxy. The global_proxy_constructor also has a prototype_template 947 // global_proxy. The global_proxy_constructor also has a prototype_template
948 // pointer that points at js_global_object_template which is an 948 // pointer that points at js_global_object_template which is an
949 // ObjectTemplateInfo. 949 // ObjectTemplateInfo.
950 // That in turn has a constructor pointer that points at 950 // That in turn has a constructor pointer that points at
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 Handle<FunctionTemplateInfo> js_global_object_constructor( 990 Handle<FunctionTemplateInfo> js_global_object_constructor(
991 FunctionTemplateInfo::cast(js_global_object_template->constructor())); 991 FunctionTemplateInfo::cast(js_global_object_template->constructor()));
992 js_global_object_function = ApiNatives::CreateApiFunction( 992 js_global_object_function = ApiNatives::CreateApiFunction(
993 isolate(), js_global_object_constructor, factory()->the_hole_value(), 993 isolate(), js_global_object_constructor, factory()->the_hole_value(),
994 ApiNatives::GlobalObjectType); 994 ApiNatives::GlobalObjectType);
995 } 995 }
996 996
997 js_global_object_function->initial_map()->set_is_prototype_map(true); 997 js_global_object_function->initial_map()->set_is_prototype_map(true);
998 js_global_object_function->initial_map()->set_is_hidden_prototype(); 998 js_global_object_function->initial_map()->set_is_hidden_prototype();
999 js_global_object_function->initial_map()->set_dictionary_map(true); 999 js_global_object_function->initial_map()->set_dictionary_map(true);
1000 Handle<GlobalObject> global_object = 1000 Handle<JSGlobalObject> global_object =
1001 factory()->NewGlobalObject(js_global_object_function); 1001 factory()->NewJSGlobalObject(js_global_object_function);
1002 1002
1003 // Step 2: (re)initialize the global proxy object. 1003 // Step 2: (re)initialize the global proxy object.
1004 Handle<JSFunction> global_proxy_function; 1004 Handle<JSFunction> global_proxy_function;
1005 if (global_proxy_template.IsEmpty()) { 1005 if (global_proxy_template.IsEmpty()) {
1006 Handle<String> name = Handle<String>(heap()->empty_string()); 1006 Handle<String> name = Handle<String>(heap()->empty_string());
1007 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( 1007 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin(
1008 Builtins::kIllegal)); 1008 Builtins::kIllegal));
1009 global_proxy_function = factory()->NewFunction( 1009 global_proxy_function = factory()->NewFunction(
1010 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); 1010 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize);
1011 } else { 1011 } else {
(...skipping 11 matching lines...) Expand all
1023 global_proxy_function->initial_map()->set_is_access_check_needed(true); 1023 global_proxy_function->initial_map()->set_is_access_check_needed(true);
1024 1024
1025 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects 1025 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
1026 // Return the global proxy. 1026 // Return the global proxy.
1027 1027
1028 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); 1028 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function);
1029 return global_object; 1029 return global_object;
1030 } 1030 }
1031 1031
1032 1032
1033 void Genesis::HookUpGlobalProxy(Handle<GlobalObject> global_object, 1033 void Genesis::HookUpGlobalProxy(Handle<JSGlobalObject> global_object,
1034 Handle<JSGlobalProxy> global_proxy) { 1034 Handle<JSGlobalProxy> global_proxy) {
1035 // Set the native context for the global object. 1035 // Set the native context for the global object.
1036 global_object->set_native_context(*native_context()); 1036 global_object->set_native_context(*native_context());
1037 global_object->set_global_proxy(*global_proxy); 1037 global_object->set_global_proxy(*global_proxy);
1038 global_proxy->set_native_context(*native_context()); 1038 global_proxy->set_native_context(*native_context());
1039 // If we deserialized the context, the global proxy is already 1039 // If we deserialized the context, the global proxy is already
1040 // correctly set up. Otherwise it's undefined. 1040 // correctly set up. Otherwise it's undefined.
1041 DCHECK(native_context()->get(Context::GLOBAL_PROXY_INDEX)->IsUndefined() || 1041 DCHECK(native_context()->get(Context::GLOBAL_PROXY_INDEX)->IsUndefined() ||
1042 native_context()->global_proxy() == *global_proxy); 1042 native_context()->global_proxy() == *global_proxy);
1043 native_context()->set_global_proxy(*global_proxy); 1043 native_context()->set_global_proxy(*global_proxy);
1044 } 1044 }
1045 1045
1046 1046
1047 void Genesis::HookUpGlobalObject(Handle<GlobalObject> global_object, 1047 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object,
1048 Handle<FixedArray> outdated_contexts) { 1048 Handle<FixedArray> outdated_contexts) {
1049 Handle<GlobalObject> global_object_from_snapshot( 1049 Handle<JSGlobalObject> global_object_from_snapshot(
1050 GlobalObject::cast(native_context()->extension())); 1050 JSGlobalObject::cast(native_context()->extension()));
1051 native_context()->set_extension(*global_object); 1051 native_context()->set_extension(*global_object);
1052 native_context()->set_security_token(*global_object); 1052 native_context()->set_security_token(*global_object);
1053 1053
1054 // Replace outdated global objects in deserialized contexts. 1054 // Replace outdated global objects in deserialized contexts.
1055 for (int i = 0; i < outdated_contexts->length(); ++i) { 1055 for (int i = 0; i < outdated_contexts->length(); ++i) {
1056 Context* context = Context::cast(outdated_contexts->get(i)); 1056 Context* context = Context::cast(outdated_contexts->get(i));
1057 // Assert that there is only one native context. 1057 // Assert that there is only one native context.
1058 DCHECK(!context->IsNativeContext() || context == *native_context()); 1058 DCHECK(!context->IsNativeContext() || context == *native_context());
1059 DCHECK_EQ(context->global_object(), *global_object_from_snapshot); 1059 DCHECK_EQ(context->global_object(), *global_object_from_snapshot);
1060 context->set_global_object(*global_object); 1060 context->set_global_object(*global_object);
1061 } 1061 }
1062 1062
1063 TransferNamedProperties(global_object_from_snapshot, global_object); 1063 TransferNamedProperties(global_object_from_snapshot, global_object);
1064 TransferIndexedProperties(global_object_from_snapshot, global_object); 1064 TransferIndexedProperties(global_object_from_snapshot, global_object);
1065 } 1065 }
1066 1066
1067 1067
1068 // This is only called if we are not using snapshots. The equivalent 1068 // This is only called if we are not using snapshots. The equivalent
1069 // work in the snapshot case is done in HookUpGlobalObject. 1069 // work in the snapshot case is done in HookUpGlobalObject.
1070 void Genesis::InitializeGlobal(Handle<GlobalObject> global_object, 1070 void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
1071 Handle<JSFunction> empty_function, 1071 Handle<JSFunction> empty_function,
1072 ContextType context_type) { 1072 ContextType context_type) {
1073 // --- N a t i v e C o n t e x t --- 1073 // --- N a t i v e C o n t e x t ---
1074 // Use the empty function as closure (no scope info). 1074 // Use the empty function as closure (no scope info).
1075 native_context()->set_closure(*empty_function); 1075 native_context()->set_closure(*empty_function);
1076 native_context()->set_previous(NULL); 1076 native_context()->set_previous(NULL);
1077 // Set extension and global object. 1077 // Set extension and global object.
1078 native_context()->set_extension(*global_object); 1078 native_context()->set_extension(*global_object);
1079 native_context()->set_global_object(*global_object); 1079 native_context()->set_global_object(*global_object);
1080 // Security setup: Set the security token of the native context to the global 1080 // Security setup: Set the security token of the native context to the global
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 // object as the receiver. Provide no parameters. 1737 // object as the receiver. Provide no parameters.
1738 Handle<Object> receiver = isolate->global_object(); 1738 Handle<Object> receiver = isolate->global_object();
1739 return !Execution::Call(isolate, fun, receiver, 0, NULL).is_null(); 1739 return !Execution::Call(isolate, fun, receiver, 0, NULL).is_null();
1740 } 1740 }
1741 1741
1742 1742
1743 static Handle<JSObject> ResolveBuiltinIdHolder(Handle<Context> native_context, 1743 static Handle<JSObject> ResolveBuiltinIdHolder(Handle<Context> native_context,
1744 const char* holder_expr) { 1744 const char* holder_expr) {
1745 Isolate* isolate = native_context->GetIsolate(); 1745 Isolate* isolate = native_context->GetIsolate();
1746 Factory* factory = isolate->factory(); 1746 Factory* factory = isolate->factory();
1747 Handle<GlobalObject> global(native_context->global_object()); 1747 Handle<JSGlobalObject> global(native_context->global_object());
1748 const char* period_pos = strchr(holder_expr, '.'); 1748 const char* period_pos = strchr(holder_expr, '.');
1749 if (period_pos == NULL) { 1749 if (period_pos == NULL) {
1750 return Handle<JSObject>::cast( 1750 return Handle<JSObject>::cast(
1751 Object::GetPropertyOrElement( 1751 Object::GetPropertyOrElement(
1752 global, factory->InternalizeUtf8String(holder_expr)) 1752 global, factory->InternalizeUtf8String(holder_expr))
1753 .ToHandleChecked()); 1753 .ToHandleChecked());
1754 } 1754 }
1755 const char* inner = period_pos + 1; 1755 const char* inner = period_pos + 1;
1756 DCHECK(!strchr(inner, '.')); 1756 DCHECK(!strchr(inner, '.'));
1757 Vector<const char> property(holder_expr, 1757 Vector<const char> property(holder_expr,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 break; 1849 break;
1850 } 1850 }
1851 case THIN_CONTEXT: 1851 case THIN_CONTEXT:
1852 break; 1852 break;
1853 } 1853 }
1854 1854
1855 // The utils object can be removed for cases that reach this point. 1855 // The utils object can be removed for cases that reach this point.
1856 native_context()->set_natives_utils_object(heap()->undefined_value()); 1856 native_context()->set_natives_utils_object(heap()->undefined_value());
1857 1857
1858 #ifdef DEBUG 1858 #ifdef DEBUG
1859 GlobalObject* dummy = native_context()->runtime_context()->global_object(); 1859 JSGlobalObject* dummy = native_context()->runtime_context()->global_object();
1860 DCHECK_EQ(0, dummy->elements()->length()); 1860 DCHECK_EQ(0, dummy->elements()->length());
1861 DCHECK_EQ(0, GlobalDictionary::cast(dummy->properties())->NumberOfElements()); 1861 DCHECK_EQ(0, GlobalDictionary::cast(dummy->properties())->NumberOfElements());
1862 #endif 1862 #endif
1863 } 1863 }
1864 1864
1865 1865
1866 void Bootstrapper::ExportFromRuntime(Isolate* isolate, 1866 void Bootstrapper::ExportFromRuntime(Isolate* isolate,
1867 Handle<JSObject> container) { 1867 Handle<JSObject> container) {
1868 Factory* factory = isolate->factory(); 1868 Factory* factory = isolate->factory();
1869 HandleScope scope(isolate); 1869 HandleScope scope(isolate);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 Handle<JSFunction> cons = factory->NewFunction(name); 2259 Handle<JSFunction> cons = factory->NewFunction(name);
2260 JSFunction::SetInstancePrototype( 2260 JSFunction::SetInstancePrototype(
2261 cons, 2261 cons,
2262 Handle<Object>(native_context()->initial_object_prototype(), isolate)); 2262 Handle<Object>(native_context()->initial_object_prototype(), isolate));
2263 cons->SetInstanceClassName(*name); 2263 cons->SetInstanceClassName(*name);
2264 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); 2264 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED);
2265 DCHECK(simd_object->IsJSObject()); 2265 DCHECK(simd_object->IsJSObject());
2266 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); 2266 JSObject::AddProperty(global, name, simd_object, DONT_ENUM);
2267 2267
2268 // Install SIMD type functions. Set the instance class names since 2268 // Install SIMD type functions. Set the instance class names since
2269 // InstallFunction only does this when we install on the GlobalObject. 2269 // InstallFunction only does this when we install on the JSGlobalObject.
2270 #define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \ 2270 #define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \
2271 Handle<JSFunction> type##_function = InstallFunction( \ 2271 Handle<JSFunction> type##_function = InstallFunction( \
2272 simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \ 2272 simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \
2273 isolate->initial_object_prototype(), Builtins::kIllegal); \ 2273 isolate->initial_object_prototype(), Builtins::kIllegal); \
2274 native_context()->set_##type##_function(*type##_function); \ 2274 native_context()->set_##type##_function(*type##_function); \
2275 type##_function->SetInstanceClassName(*factory->Type##_string()); 2275 type##_function->SetInstanceClassName(*factory->Type##_string());
2276 SIMD128_TYPES(SIMD128_INSTALL_FUNCTION) 2276 SIMD128_TYPES(SIMD128_INSTALL_FUNCTION)
2277 #undef SIMD128_INSTALL_FUNCTION 2277 #undef SIMD128_INSTALL_FUNCTION
2278 } 2278 }
2279 2279
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 Handle<Context> context = 2333 Handle<Context> context =
2334 factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge); 2334 factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge);
2335 native_context()->set_runtime_context(*context); 2335 native_context()->set_runtime_context(*context);
2336 Handle<Code> code = isolate()->builtins()->Illegal(); 2336 Handle<Code> code = isolate()->builtins()->Illegal();
2337 Handle<JSFunction> global_fun = 2337 Handle<JSFunction> global_fun =
2338 factory()->NewFunction(factory()->empty_string(), code, 2338 factory()->NewFunction(factory()->empty_string(), code,
2339 JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize); 2339 JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
2340 global_fun->initial_map()->set_dictionary_map(true); 2340 global_fun->initial_map()->set_dictionary_map(true);
2341 global_fun->initial_map()->set_prototype(heap()->null_value()); 2341 global_fun->initial_map()->set_prototype(heap()->null_value());
2342 Handle<JSGlobalObject> dummy_global = 2342 Handle<JSGlobalObject> dummy_global =
2343 Handle<JSGlobalObject>::cast(factory()->NewGlobalObject(global_fun)); 2343 Handle<JSGlobalObject>::cast(factory()->NewJSGlobalObject(global_fun));
2344 dummy_global->set_native_context(*native_context()); 2344 dummy_global->set_native_context(*native_context());
2345 dummy_global->set_global_proxy(native_context()->global_proxy()); 2345 dummy_global->set_global_proxy(native_context()->global_proxy());
2346 context->set_global_object(*dummy_global); 2346 context->set_global_object(*dummy_global);
2347 // Something went wrong if we actually need to write into the dummy global. 2347 // Something went wrong if we actually need to write into the dummy global.
2348 dummy_global->set_properties(*GlobalDictionary::New(isolate(), 0)); 2348 dummy_global->set_properties(*GlobalDictionary::New(isolate(), 0));
2349 dummy_global->set_elements(heap()->empty_fixed_array()); 2349 dummy_global->set_elements(heap()->empty_fixed_array());
2350 } 2350 }
2351 2351
2352 // Set up the utils object as shared container between native scripts. 2352 // Set up the utils object as shared container between native scripts.
2353 Handle<JSObject> utils = factory()->NewJSObject(isolate()->object_function()); 2353 Handle<JSObject> utils = factory()->NewJSObject(isolate()->object_function());
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 DCHECK(!to->HasFastProperties()); 3061 DCHECK(!to->HasFastProperties());
3062 // Add to dictionary. 3062 // Add to dictionary.
3063 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); 3063 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
3064 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, 3064 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
3065 PropertyCellType::kMutable); 3065 PropertyCellType::kMutable);
3066 JSObject::SetNormalizedProperty(to, key, callbacks, d); 3066 JSObject::SetNormalizedProperty(to, key, callbacks, d);
3067 break; 3067 break;
3068 } 3068 }
3069 } 3069 }
3070 } 3070 }
3071 } else if (from->IsGlobalObject()) { 3071 } else if (from->IsJSGlobalObject()) {
3072 Handle<GlobalDictionary> properties = 3072 Handle<GlobalDictionary> properties =
3073 Handle<GlobalDictionary>(from->global_dictionary()); 3073 Handle<GlobalDictionary>(from->global_dictionary());
3074 int capacity = properties->Capacity(); 3074 int capacity = properties->Capacity();
3075 for (int i = 0; i < capacity; i++) { 3075 for (int i = 0; i < capacity; i++) {
3076 Object* raw_key(properties->KeyAt(i)); 3076 Object* raw_key(properties->KeyAt(i));
3077 if (properties->IsKey(raw_key)) { 3077 if (properties->IsKey(raw_key)) {
3078 DCHECK(raw_key->IsName()); 3078 DCHECK(raw_key->IsName());
3079 // If the property is already there we skip it. 3079 // If the property is already there we skip it.
3080 Handle<Name> key(Name::cast(raw_key)); 3080 Handle<Name> key(Name::cast(raw_key));
3081 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); 3081 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 isolate->counters()->contexts_created_by_snapshot()->Increment(); 3228 isolate->counters()->contexts_created_by_snapshot()->Increment();
3229 #if TRACE_MAPS 3229 #if TRACE_MAPS
3230 if (FLAG_trace_maps) { 3230 if (FLAG_trace_maps) {
3231 Handle<JSFunction> object_fun = isolate->object_function(); 3231 Handle<JSFunction> object_fun = isolate->object_function();
3232 PrintF("[TraceMap: InitialMap map= %p SFI= %d_Object ]\n", 3232 PrintF("[TraceMap: InitialMap map= %p SFI= %d_Object ]\n",
3233 reinterpret_cast<void*>(object_fun->initial_map()), 3233 reinterpret_cast<void*>(object_fun->initial_map()),
3234 object_fun->shared()->unique_id()); 3234 object_fun->shared()->unique_id());
3235 Map::TraceAllTransitions(object_fun->initial_map()); 3235 Map::TraceAllTransitions(object_fun->initial_map());
3236 } 3236 }
3237 #endif 3237 #endif
3238 Handle<GlobalObject> global_object = 3238 Handle<JSGlobalObject> global_object =
3239 CreateNewGlobals(global_proxy_template, global_proxy); 3239 CreateNewGlobals(global_proxy_template, global_proxy);
3240 3240
3241 HookUpGlobalProxy(global_object, global_proxy); 3241 HookUpGlobalProxy(global_object, global_proxy);
3242 HookUpGlobalObject(global_object, outdated_contexts); 3242 HookUpGlobalObject(global_object, outdated_contexts);
3243 HookUpGlobalThisBinding(outdated_contexts); 3243 HookUpGlobalThisBinding(outdated_contexts);
3244 3244
3245 if (!ConfigureGlobalObjects(global_proxy_template)) return; 3245 if (!ConfigureGlobalObjects(global_proxy_template)) return;
3246 } else { 3246 } else {
3247 // We get here if there was no context snapshot. 3247 // We get here if there was no context snapshot.
3248 CreateRoots(); 3248 CreateRoots();
3249 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 3249 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
3250 CreateStrictModeFunctionMaps(empty_function); 3250 CreateStrictModeFunctionMaps(empty_function);
3251 CreateStrongModeFunctionMaps(empty_function); 3251 CreateStrongModeFunctionMaps(empty_function);
3252 CreateIteratorMaps(); 3252 CreateIteratorMaps();
3253 Handle<GlobalObject> global_object = 3253 Handle<JSGlobalObject> global_object =
3254 CreateNewGlobals(global_proxy_template, global_proxy); 3254 CreateNewGlobals(global_proxy_template, global_proxy);
3255 HookUpGlobalProxy(global_object, global_proxy); 3255 HookUpGlobalProxy(global_object, global_proxy);
3256 InitializeGlobal(global_object, empty_function, context_type); 3256 InitializeGlobal(global_object, empty_function, context_type);
3257 InitializeNormalizedMapCaches(); 3257 InitializeNormalizedMapCaches();
3258 3258
3259 if (!InstallNatives(context_type)) return; 3259 if (!InstallNatives(context_type)) return;
3260 3260
3261 MakeFunctionInstancePrototypeWritable(); 3261 MakeFunctionInstancePrototypeWritable();
3262 3262
3263 if (context_type != THIN_CONTEXT) { 3263 if (context_type != THIN_CONTEXT) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 } 3324 }
3325 3325
3326 3326
3327 // Called when the top-level V8 mutex is destroyed. 3327 // Called when the top-level V8 mutex is destroyed.
3328 void Bootstrapper::FreeThreadResources() { 3328 void Bootstrapper::FreeThreadResources() {
3329 DCHECK(!IsActive()); 3329 DCHECK(!IsActive());
3330 } 3330 }
3331 3331
3332 } // namespace internal 3332 } // namespace internal
3333 } // namespace v8 3333 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698