| OLD | NEW |
| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 new_map->SetPrototype(proto, FAST_PROTOTYPE); | 328 new_map->SetPrototype(proto, FAST_PROTOTYPE); |
| 329 JSObject::MigrateToMap(object, new_map); | 329 JSObject::MigrateToMap(object, new_map); |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 void Bootstrapper::DetachGlobal(Handle<Context> env) { | 333 void Bootstrapper::DetachGlobal(Handle<Context> env) { |
| 334 Factory* factory = env->GetIsolate()->factory(); | 334 Factory* factory = env->GetIsolate()->factory(); |
| 335 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); | 335 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); |
| 336 global_proxy->set_native_context(*factory->null_value()); | 336 global_proxy->set_native_context(*factory->null_value()); |
| 337 SetObjectPrototype(global_proxy, factory->null_value()); | 337 SetObjectPrototype(global_proxy, factory->null_value()); |
| 338 global_proxy->map()->set_constructor(*factory->null_value()); | 338 global_proxy->map()->SetConstructor(*factory->null_value()); |
| 339 if (FLAG_track_detached_contexts) { | 339 if (FLAG_track_detached_contexts) { |
| 340 env->GetIsolate()->AddDetachedContext(env); | 340 env->GetIsolate()->AddDetachedContext(env); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 | 344 |
| 345 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, | 345 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, |
| 346 const char* name, | 346 const char* name, |
| 347 InstanceType type, | 347 InstanceType type, |
| 348 int instance_size, | 348 int instance_size, |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 // @@iterator method is added later. | 1257 // @@iterator method is added later. |
| 1258 | 1258 |
| 1259 map->set_function_with_prototype(true); | 1259 map->set_function_with_prototype(true); |
| 1260 DCHECK_EQ(native_context()->object_function()->prototype(), | 1260 DCHECK_EQ(native_context()->object_function()->prototype(), |
| 1261 *isolate->initial_object_prototype()); | 1261 *isolate->initial_object_prototype()); |
| 1262 map->SetPrototype(isolate->initial_object_prototype()); | 1262 map->SetPrototype(isolate->initial_object_prototype()); |
| 1263 map->set_pre_allocated_property_fields(1); | 1263 map->set_pre_allocated_property_fields(1); |
| 1264 map->set_inobject_properties(1); | 1264 map->set_inobject_properties(1); |
| 1265 | 1265 |
| 1266 // Copy constructor from the sloppy arguments boilerplate. | 1266 // Copy constructor from the sloppy arguments boilerplate. |
| 1267 map->set_constructor( | 1267 map->SetConstructor( |
| 1268 native_context()->sloppy_arguments_map()->constructor()); | 1268 native_context()->sloppy_arguments_map()->GetConstructor()); |
| 1269 | 1269 |
| 1270 native_context()->set_strict_arguments_map(*map); | 1270 native_context()->set_strict_arguments_map(*map); |
| 1271 | 1271 |
| 1272 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); | 1272 DCHECK(map->inobject_properties() > Heap::kArgumentsLengthIndex); |
| 1273 DCHECK(!map->is_dictionary_map()); | 1273 DCHECK(!map->is_dictionary_map()); |
| 1274 DCHECK(IsFastObjectElementsKind(map->elements_kind())); | 1274 DCHECK(IsFastObjectElementsKind(map->elements_kind())); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 { // --- context extension | 1277 { // --- context extension |
| 1278 // Create a function for the context extension objects. | 1278 // Create a function for the context extension objects. |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2117 // RegExpResult initial map. | 2117 // RegExpResult initial map. |
| 2118 | 2118 |
| 2119 // Find global.Array.prototype to inherit from. | 2119 // Find global.Array.prototype to inherit from. |
| 2120 Handle<JSFunction> array_constructor(native_context()->array_function()); | 2120 Handle<JSFunction> array_constructor(native_context()->array_function()); |
| 2121 Handle<JSObject> array_prototype( | 2121 Handle<JSObject> array_prototype( |
| 2122 JSObject::cast(array_constructor->instance_prototype())); | 2122 JSObject::cast(array_constructor->instance_prototype())); |
| 2123 | 2123 |
| 2124 // Add initial map. | 2124 // Add initial map. |
| 2125 Handle<Map> initial_map = | 2125 Handle<Map> initial_map = |
| 2126 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); | 2126 factory()->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize); |
| 2127 initial_map->set_constructor(*array_constructor); | 2127 initial_map->SetConstructor(*array_constructor); |
| 2128 | 2128 |
| 2129 // Set prototype on map. | 2129 // Set prototype on map. |
| 2130 initial_map->set_non_instance_prototype(false); | 2130 initial_map->set_non_instance_prototype(false); |
| 2131 initial_map->SetPrototype(array_prototype); | 2131 initial_map->SetPrototype(array_prototype); |
| 2132 | 2132 |
| 2133 // Update map with length accessor from Array and add "index" and "input". | 2133 // Update map with length accessor from Array and add "index" and "input". |
| 2134 Map::EnsureDescriptorSlack(initial_map, 3); | 2134 Map::EnsureDescriptorSlack(initial_map, 3); |
| 2135 | 2135 |
| 2136 { | 2136 { |
| 2137 JSFunction* array_function = native_context()->array_function(); | 2137 JSFunction* array_function = native_context()->array_function(); |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2859 return from + sizeof(NestingCounterType); | 2859 return from + sizeof(NestingCounterType); |
| 2860 } | 2860 } |
| 2861 | 2861 |
| 2862 | 2862 |
| 2863 // Called when the top-level V8 mutex is destroyed. | 2863 // Called when the top-level V8 mutex is destroyed. |
| 2864 void Bootstrapper::FreeThreadResources() { | 2864 void Bootstrapper::FreeThreadResources() { |
| 2865 DCHECK(!IsActive()); | 2865 DCHECK(!IsActive()); |
| 2866 } | 2866 } |
| 2867 | 2867 |
| 2868 } } // namespace v8::internal | 2868 } } // namespace v8::internal |
| OLD | NEW |