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/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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 bool Bootstrapper::CreateCodeStubContext(Isolate* isolate) { | 338 bool Bootstrapper::CreateCodeStubContext(Isolate* isolate) { |
339 HandleScope scope(isolate); | 339 HandleScope scope(isolate); |
340 SaveContext save_context(isolate); | 340 SaveContext save_context(isolate); |
341 BootstrapperActive active(this); | 341 BootstrapperActive active(this); |
342 | 342 |
343 v8::ExtensionConfiguration no_extensions; | 343 v8::ExtensionConfiguration no_extensions; |
344 Handle<Context> native_context = CreateEnvironment( | 344 Handle<Context> native_context = CreateEnvironment( |
345 MaybeHandle<JSGlobalProxy>(), v8::Local<v8::ObjectTemplate>(), | 345 MaybeHandle<JSGlobalProxy>(), v8::Local<v8::ObjectTemplate>(), |
346 &no_extensions, THIN_CONTEXT); | 346 &no_extensions, THIN_CONTEXT); |
347 isolate->heap()->set_code_stub_context(*native_context); | 347 isolate->heap()->SetRootCodeStubContext(*native_context); |
348 isolate->set_context(*native_context); | 348 isolate->set_context(*native_context); |
349 Handle<JSObject> code_stub_exports = | 349 Handle<JSObject> code_stub_exports = |
350 isolate->factory()->NewJSObject(isolate->object_function()); | 350 isolate->factory()->NewJSObject(isolate->object_function()); |
351 JSObject::NormalizeProperties(code_stub_exports, CLEAR_INOBJECT_PROPERTIES, 2, | 351 JSObject::NormalizeProperties(code_stub_exports, CLEAR_INOBJECT_PROPERTIES, 2, |
352 "container to export to extra natives"); | 352 "container to export to extra natives"); |
353 isolate->heap()->set_code_stub_exports_object(*code_stub_exports); | 353 isolate->heap()->SetRootCodeStubExportsObject(*code_stub_exports); |
354 return InstallCodeStubNatives(isolate); | 354 return InstallCodeStubNatives(isolate); |
355 } | 355 } |
356 | 356 |
357 | 357 |
358 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) { | 358 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) { |
359 // object.__proto__ = proto; | 359 // object.__proto__ = proto; |
360 Handle<Map> old_map = Handle<Map>(object->map()); | 360 Handle<Map> old_map = Handle<Map>(object->map()); |
361 Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype"); | 361 Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype"); |
362 Map::SetPrototype(new_map, proto, FAST_PROTOTYPE); | 362 Map::SetPrototype(new_map, proto, FAST_PROTOTYPE); |
363 JSObject::MigrateToMap(object, new_map); | 363 JSObject::MigrateToMap(object, new_map); |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 } | 2166 } |
2167 | 2167 |
2168 Handle<AccessorInfo> script_is_embedder_debug_script = | 2168 Handle<AccessorInfo> script_is_embedder_debug_script = |
2169 Accessors::ScriptIsEmbedderDebugScriptInfo(isolate(), attribs); | 2169 Accessors::ScriptIsEmbedderDebugScriptInfo(isolate(), attribs); |
2170 { | 2170 { |
2171 AccessorConstantDescriptor d( | 2171 AccessorConstantDescriptor d( |
2172 Handle<Name>(Name::cast(script_is_embedder_debug_script->name())), | 2172 Handle<Name>(Name::cast(script_is_embedder_debug_script->name())), |
2173 script_is_embedder_debug_script, attribs); | 2173 script_is_embedder_debug_script, attribs); |
2174 script_map->AppendDescriptor(&d); | 2174 script_map->AppendDescriptor(&d); |
2175 } | 2175 } |
2176 | |
2177 // Allocate the empty script. | |
2178 Handle<Script> script = factory()->NewScript(factory()->empty_string()); | |
2179 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | |
2180 heap()->public_set_empty_script(*script); | |
2181 } | 2176 } |
2182 { | 2177 { |
2183 // Builtin function for OpaqueReference -- a JSValue-based object, | 2178 // Builtin function for OpaqueReference -- a JSValue-based object, |
2184 // that keeps its field isolated from JavaScript code. It may store | 2179 // that keeps its field isolated from JavaScript code. It may store |
2185 // objects, that JavaScript code may not access. | 2180 // objects, that JavaScript code may not access. |
2186 Handle<JSFunction> opaque_reference_fun = InstallFunction( | 2181 Handle<JSFunction> opaque_reference_fun = InstallFunction( |
2187 builtins, "OpaqueReference", JS_VALUE_TYPE, JSValue::kSize, | 2182 builtins, "OpaqueReference", JS_VALUE_TYPE, JSValue::kSize, |
2188 isolate()->initial_object_prototype(), Builtins::kIllegal); | 2183 isolate()->initial_object_prototype(), Builtins::kIllegal); |
2189 Handle<JSObject> prototype = | 2184 Handle<JSObject> prototype = |
2190 factory()->NewJSObject(isolate()->object_function(), TENURED); | 2185 factory()->NewJSObject(isolate()->object_function(), TENURED); |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 } | 3176 } |
3182 | 3177 |
3183 | 3178 |
3184 // Called when the top-level V8 mutex is destroyed. | 3179 // Called when the top-level V8 mutex is destroyed. |
3185 void Bootstrapper::FreeThreadResources() { | 3180 void Bootstrapper::FreeThreadResources() { |
3186 DCHECK(!IsActive()); | 3181 DCHECK(!IsActive()); |
3187 } | 3182 } |
3188 | 3183 |
3189 } // namespace internal | 3184 } // namespace internal |
3190 } // namespace v8 | 3185 } // namespace v8 |
OLD | NEW |