| 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/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DCHECK(source_code->is_short()); | 50 DCHECK(source_code->is_short()); |
| 51 Source::GetSourceCache(heap)->set(index, *source_code); | 51 Source::GetSourceCache(heap)->set(index, *source_code); |
| 52 } | 52 } |
| 53 Handle<Object> cached_source(Source::GetSourceCache(heap)->get(index), | 53 Handle<Object> cached_source(Source::GetSourceCache(heap)->get(index), |
| 54 isolate_); | 54 isolate_); |
| 55 return Handle<String>::cast(cached_source); | 55 return Handle<String>::cast(cached_source); |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 template Handle<String> Bootstrapper::SourceLookup<Natives>(int index); | 59 template Handle<String> Bootstrapper::SourceLookup<Natives>(int index); |
| 60 template Handle<String> Bootstrapper::SourceLookup<ExperimentalNatives>( |
| 61 int index); |
| 60 template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>( | 62 template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>( |
| 61 int index); | 63 int index); |
| 62 template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index); | 64 template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index); |
| 63 | 65 |
| 64 | 66 |
| 65 void Bootstrapper::Initialize(bool create_heap_objects) { | 67 void Bootstrapper::Initialize(bool create_heap_objects) { |
| 66 extensions_cache_.Initialize(isolate_, create_heap_objects); | 68 extensions_cache_.Initialize(isolate_, create_heap_objects); |
| 67 } | 69 } |
| 68 | 70 |
| 69 | 71 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ExternalOneByteString::cast(natives_source)->resource()); | 126 ExternalOneByteString::cast(natives_source)->resource()); |
| 125 delete resource; | 127 delete resource; |
| 126 } | 128 } |
| 127 } | 129 } |
| 128 } | 130 } |
| 129 } | 131 } |
| 130 | 132 |
| 131 | 133 |
| 132 void Bootstrapper::TearDown() { | 134 void Bootstrapper::TearDown() { |
| 133 DeleteNativeSources(Natives::GetSourceCache(isolate_->heap())); | 135 DeleteNativeSources(Natives::GetSourceCache(isolate_->heap())); |
| 136 DeleteNativeSources(ExperimentalNatives::GetSourceCache(isolate_->heap())); |
| 134 DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap())); | 137 DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap())); |
| 135 DeleteNativeSources( | 138 DeleteNativeSources( |
| 136 ExperimentalExtraNatives::GetSourceCache(isolate_->heap())); | 139 ExperimentalExtraNatives::GetSourceCache(isolate_->heap())); |
| 137 | 140 |
| 138 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical | 141 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical |
| 139 } | 142 } |
| 140 | 143 |
| 141 | 144 |
| 142 class Genesis BASE_EMBEDDED { | 145 class Genesis BASE_EMBEDDED { |
| 143 public: | 146 public: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 224 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
| 222 const char* name, Builtins::Name call, | 225 const char* name, Builtins::Name call, |
| 223 BuiltinFunctionId id); | 226 BuiltinFunctionId id); |
| 224 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 227 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
| 225 const char* name, | 228 const char* name, |
| 226 ElementsKind elements_kind); | 229 ElementsKind elements_kind); |
| 227 bool InstallNatives(GlobalContextType context_type); | 230 bool InstallNatives(GlobalContextType context_type); |
| 228 | 231 |
| 229 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 232 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
| 230 Handle<JSFunction>* fun); | 233 Handle<JSFunction>* fun); |
| 234 bool InstallExperimentalNatives(); |
| 231 bool InstallExtraNatives(); | 235 bool InstallExtraNatives(); |
| 232 bool InstallExperimentalExtraNatives(); | 236 bool InstallExperimentalExtraNatives(); |
| 233 bool InstallDebuggerNatives(); | 237 bool InstallDebuggerNatives(); |
| 234 void InstallBuiltinFunctionIds(); | 238 void InstallBuiltinFunctionIds(); |
| 235 void InstallExperimentalBuiltinFunctionIds(); | 239 void InstallExperimentalBuiltinFunctionIds(); |
| 236 void InitializeNormalizedMapCaches(); | 240 void InitializeNormalizedMapCaches(); |
| 237 | 241 |
| 238 enum ExtensionTraversalState { | 242 enum ExtensionTraversalState { |
| 239 UNVISITED, VISITED, INSTALLED | 243 UNVISITED, VISITED, INSTALLED |
| 240 }; | 244 }; |
| (...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 Handle<Object> global = isolate->global_object(); | 2998 Handle<Object> global = isolate->global_object(); |
| 2995 Handle<Object> utils = isolate->natives_utils_object(); | 2999 Handle<Object> utils = isolate->natives_utils_object(); |
| 2996 Handle<Object> extras_utils = isolate->extras_utils_object(); | 3000 Handle<Object> extras_utils = isolate->extras_utils_object(); |
| 2997 Handle<Object> args[] = {global, utils, extras_utils}; | 3001 Handle<Object> args[] = {global, utils, extras_utils}; |
| 2998 | 3002 |
| 2999 return Bootstrapper::CompileNative(isolate, name, source_code, | 3003 return Bootstrapper::CompileNative(isolate, name, source_code, |
| 3000 arraysize(args), args, NATIVES_CODE); | 3004 arraysize(args), args, NATIVES_CODE); |
| 3001 } | 3005 } |
| 3002 | 3006 |
| 3003 | 3007 |
| 3008 bool Bootstrapper::CompileExperimentalBuiltin(Isolate* isolate, int index) { |
| 3009 HandleScope scope(isolate); |
| 3010 Vector<const char> name = ExperimentalNatives::GetScriptName(index); |
| 3011 Handle<String> source_code = |
| 3012 isolate->bootstrapper()->SourceLookup<ExperimentalNatives>(index); |
| 3013 Handle<Object> global = isolate->global_object(); |
| 3014 Handle<Object> utils = isolate->natives_utils_object(); |
| 3015 Handle<Object> args[] = {global, utils}; |
| 3016 return Bootstrapper::CompileNative(isolate, name, source_code, |
| 3017 arraysize(args), args, NATIVES_CODE); |
| 3018 } |
| 3019 |
| 3020 |
| 3004 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { | 3021 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { |
| 3005 HandleScope scope(isolate); | 3022 HandleScope scope(isolate); |
| 3006 Vector<const char> name = ExtraNatives::GetScriptName(index); | 3023 Vector<const char> name = ExtraNatives::GetScriptName(index); |
| 3007 Handle<String> source_code = | 3024 Handle<String> source_code = |
| 3008 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); | 3025 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); |
| 3009 Handle<Object> global = isolate->global_object(); | 3026 Handle<Object> global = isolate->global_object(); |
| 3010 Handle<Object> binding = isolate->extras_binding_object(); | 3027 Handle<Object> binding = isolate->extras_binding_object(); |
| 3011 Handle<Object> extras_utils = isolate->extras_utils_object(); | 3028 Handle<Object> extras_utils = isolate->extras_utils_object(); |
| 3012 Handle<Object> args[] = {global, binding, extras_utils}; | 3029 Handle<Object> args[] = {global, binding, extras_utils}; |
| 3013 return Bootstrapper::CompileNative(isolate, name, source_code, | 3030 return Bootstrapper::CompileNative(isolate, name, source_code, |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3620 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 3637 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
| 3621 | 3638 |
| 3622 Handle<String> name = factory->InternalizeUtf8String("Atomics"); | 3639 Handle<String> name = factory->InternalizeUtf8String("Atomics"); |
| 3623 Handle<JSFunction> cons = factory->NewFunction(name); | 3640 Handle<JSFunction> cons = factory->NewFunction(name); |
| 3624 JSFunction::SetInstancePrototype( | 3641 JSFunction::SetInstancePrototype( |
| 3625 cons, | 3642 cons, |
| 3626 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 3643 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| 3627 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED); | 3644 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED); |
| 3628 DCHECK(atomics_object->IsJSObject()); | 3645 DCHECK(atomics_object->IsJSObject()); |
| 3629 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM); | 3646 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM); |
| 3630 JSObject::AddProperty(atomics_object, factory->to_string_tag_symbol(), name, | |
| 3631 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | |
| 3632 | 3647 |
| 3633 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"), | 3648 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"), |
| 3634 Builtins::kAtomicsLoad, 2, true); | 3649 Builtins::kAtomicsLoad, 2, true); |
| 3635 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("store"), | 3650 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("store"), |
| 3636 Builtins::kAtomicsStore, 3, true); | 3651 Builtins::kAtomicsStore, 3, true); |
| 3637 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("add"), | |
| 3638 Builtins::kAtomicsAdd, 3, true); | |
| 3639 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("sub"), | |
| 3640 Builtins::kAtomicsSub, 3, true); | |
| 3641 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("and"), | |
| 3642 Builtins::kAtomicsAnd, 3, true); | |
| 3643 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("or"), | |
| 3644 Builtins::kAtomicsOr, 3, true); | |
| 3645 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("xor"), | |
| 3646 Builtins::kAtomicsXor, 3, true); | |
| 3647 SimpleInstallFunction(atomics_object, | |
| 3648 factory->InternalizeUtf8String("exchange"), | |
| 3649 Builtins::kAtomicsExchange, 3, true); | |
| 3650 SimpleInstallFunction(atomics_object, | |
| 3651 factory->InternalizeUtf8String("compareExchange"), | |
| 3652 Builtins::kAtomicsCompareExchange, 4, true); | |
| 3653 SimpleInstallFunction(atomics_object, | |
| 3654 factory->InternalizeUtf8String("isLockFree"), | |
| 3655 Builtins::kAtomicsIsLockFree, 1, true); | |
| 3656 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("wait"), | |
| 3657 Builtins::kAtomicsWait, 4, true); | |
| 3658 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("wake"), | |
| 3659 Builtins::kAtomicsWake, 3, true); | |
| 3660 } | 3652 } |
| 3661 | 3653 |
| 3662 void Genesis::InitializeGlobal_harmony_array_prototype_values() { | 3654 void Genesis::InitializeGlobal_harmony_array_prototype_values() { |
| 3663 if (!FLAG_harmony_array_prototype_values) return; | 3655 if (!FLAG_harmony_array_prototype_values) return; |
| 3664 Handle<JSFunction> array_constructor(native_context()->array_function()); | 3656 Handle<JSFunction> array_constructor(native_context()->array_function()); |
| 3665 Handle<JSObject> array_prototype( | 3657 Handle<JSObject> array_prototype( |
| 3666 JSObject::cast(array_constructor->instance_prototype())); | 3658 JSObject::cast(array_constructor->instance_prototype())); |
| 3667 Handle<Object> values_iterator = | 3659 Handle<Object> values_iterator = |
| 3668 JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) | 3660 JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) |
| 3669 .ToHandleChecked(); | 3661 .ToHandleChecked(); |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4253 arguments_iterator, attribs); | 4245 arguments_iterator, attribs); |
| 4254 Handle<Map> map(native_context()->strict_arguments_map()); | 4246 Handle<Map> map(native_context()->strict_arguments_map()); |
| 4255 Map::EnsureDescriptorSlack(map, 1); | 4247 Map::EnsureDescriptorSlack(map, 1); |
| 4256 map->AppendDescriptor(&d); | 4248 map->AppendDescriptor(&d); |
| 4257 } | 4249 } |
| 4258 } | 4250 } |
| 4259 | 4251 |
| 4260 return true; | 4252 return true; |
| 4261 } | 4253 } |
| 4262 | 4254 |
| 4255 |
| 4256 bool Genesis::InstallExperimentalNatives() { |
| 4257 static const char* harmony_tailcalls_natives[] = {nullptr}; |
| 4258 static const char* harmony_sharedarraybuffer_natives[] = { |
| 4259 "native harmony-atomics.js", NULL}; |
| 4260 static const char* harmony_do_expressions_natives[] = {nullptr}; |
| 4261 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
| 4262 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; |
| 4263 static const char* harmony_regexp_property_natives[] = {nullptr}; |
| 4264 static const char* harmony_function_sent_natives[] = {nullptr}; |
| 4265 static const char* harmony_array_prototype_values_natives[] = {nullptr}; |
| 4266 #ifdef V8_I18N_SUPPORT |
| 4267 static const char* icu_case_mapping_natives[] = {nullptr}; |
| 4268 static const char* datetime_format_to_parts_natives[] = {nullptr}; |
| 4269 #endif |
| 4270 static const char* harmony_restrictive_generators_natives[] = {nullptr}; |
| 4271 static const char* harmony_trailing_commas_natives[] = {nullptr}; |
| 4272 static const char* harmony_function_tostring_natives[] = {nullptr}; |
| 4273 static const char* harmony_class_fields_natives[] = {nullptr}; |
| 4274 static const char* harmony_object_rest_spread_natives[] = {nullptr}; |
| 4275 static const char* harmony_async_iteration_natives[] = {nullptr}; |
| 4276 static const char* harmony_dynamic_import_natives[] = {nullptr}; |
| 4277 static const char* harmony_promise_finally_natives[] = {nullptr}; |
| 4278 static const char* harmony_template_escapes_natives[] = {nullptr}; |
| 4279 |
| 4280 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| 4281 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
| 4282 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
| 4283 if (FLAG_##id) { \ |
| 4284 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
| 4285 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ |
| 4286 if (strncmp(script_name.start(), id##_natives[j], \ |
| 4287 script_name.length()) == 0) { \ |
| 4288 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ |
| 4289 return false; \ |
| 4290 } \ |
| 4291 } \ |
| 4292 } \ |
| 4293 } |
| 4294 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
| 4295 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
| 4296 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); |
| 4297 #undef INSTALL_EXPERIMENTAL_NATIVES |
| 4298 } |
| 4299 |
| 4300 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; |
| 4301 |
| 4302 InstallExperimentalBuiltinFunctionIds(); |
| 4303 return true; |
| 4304 } |
| 4305 |
| 4306 |
| 4263 bool Genesis::InstallExtraNatives() { | 4307 bool Genesis::InstallExtraNatives() { |
| 4264 HandleScope scope(isolate()); | 4308 HandleScope scope(isolate()); |
| 4265 | 4309 |
| 4266 Handle<JSObject> extras_binding = | 4310 Handle<JSObject> extras_binding = |
| 4267 factory()->NewJSObject(isolate()->object_function()); | 4311 factory()->NewJSObject(isolate()->object_function()); |
| 4268 native_context()->set_extras_binding_object(*extras_binding); | 4312 native_context()->set_extras_binding_object(*extras_binding); |
| 4269 | 4313 |
| 4270 for (int i = ExtraNatives::GetDebuggerCount(); | 4314 for (int i = ExtraNatives::GetDebuggerCount(); |
| 4271 i < ExtraNatives::GetBuiltinsCount(); i++) { | 4315 i < ExtraNatives::GetBuiltinsCount(); i++) { |
| 4272 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false; | 4316 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4284 } | 4328 } |
| 4285 | 4329 |
| 4286 return true; | 4330 return true; |
| 4287 } | 4331 } |
| 4288 | 4332 |
| 4289 | 4333 |
| 4290 bool Genesis::InstallDebuggerNatives() { | 4334 bool Genesis::InstallDebuggerNatives() { |
| 4291 for (int i = 0; i < Natives::GetDebuggerCount(); ++i) { | 4335 for (int i = 0; i < Natives::GetDebuggerCount(); ++i) { |
| 4292 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; | 4336 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; |
| 4293 } | 4337 } |
| 4294 return true; | 4338 return CallUtilsFunction(isolate(), "PostDebug"); |
| 4295 } | 4339 } |
| 4296 | 4340 |
| 4297 | 4341 |
| 4298 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 4342 static void InstallBuiltinFunctionId(Handle<JSObject> holder, |
| 4299 const char* function_name, | 4343 const char* function_name, |
| 4300 BuiltinFunctionId id) { | 4344 BuiltinFunctionId id) { |
| 4301 Isolate* isolate = holder->GetIsolate(); | 4345 Isolate* isolate = holder->GetIsolate(); |
| 4302 Handle<Object> function_object = | 4346 Handle<Object> function_object = |
| 4303 JSReceiver::GetProperty(isolate, holder, function_name).ToHandleChecked(); | 4347 JSReceiver::GetProperty(isolate, holder, function_name).ToHandleChecked(); |
| 4304 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 4348 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4322 const BuiltinFunctionIds builtins[] = { | 4366 const BuiltinFunctionIds builtins[] = { |
| 4323 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; | 4367 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; |
| 4324 | 4368 |
| 4325 for (const BuiltinFunctionIds& builtin : builtins) { | 4369 for (const BuiltinFunctionIds& builtin : builtins) { |
| 4326 Handle<JSObject> holder = | 4370 Handle<JSObject> holder = |
| 4327 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); | 4371 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); |
| 4328 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); | 4372 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); |
| 4329 } | 4373 } |
| 4330 } | 4374 } |
| 4331 | 4375 |
| 4376 |
| 4377 void Genesis::InstallExperimentalBuiltinFunctionIds() { |
| 4378 if (FLAG_harmony_sharedarraybuffer) { |
| 4379 struct BuiltinFunctionIds { |
| 4380 const char* holder_expr; |
| 4381 const char* fun_name; |
| 4382 BuiltinFunctionId id; |
| 4383 }; |
| 4384 |
| 4385 const BuiltinFunctionIds atomic_builtins[] = { |
| 4386 ATOMIC_FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; |
| 4387 |
| 4388 for (const BuiltinFunctionIds& builtin : atomic_builtins) { |
| 4389 Handle<JSObject> holder = |
| 4390 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); |
| 4391 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); |
| 4392 } |
| 4393 } |
| 4394 } |
| 4395 |
| 4332 #undef INSTALL_BUILTIN_ID | 4396 #undef INSTALL_BUILTIN_ID |
| 4333 | 4397 |
| 4334 | 4398 |
| 4335 void Genesis::InitializeNormalizedMapCaches() { | 4399 void Genesis::InitializeNormalizedMapCaches() { |
| 4336 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate()); | 4400 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate()); |
| 4337 native_context()->set_normalized_map_cache(*cache); | 4401 native_context()->set_normalized_map_cache(*cache); |
| 4338 } | 4402 } |
| 4339 | 4403 |
| 4340 | 4404 |
| 4341 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, | 4405 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4832 | 4896 |
| 4833 isolate->counters()->contexts_created_from_scratch()->Increment(); | 4897 isolate->counters()->contexts_created_from_scratch()->Increment(); |
| 4834 } | 4898 } |
| 4835 | 4899 |
| 4836 // Install experimental natives. Do not include them into the | 4900 // Install experimental natives. Do not include them into the |
| 4837 // snapshot as we should be able to turn them off at runtime. Re-installing | 4901 // snapshot as we should be able to turn them off at runtime. Re-installing |
| 4838 // them after they have already been deserialized would also fail. | 4902 // them after they have already been deserialized would also fail. |
| 4839 if (context_type == FULL_CONTEXT) { | 4903 if (context_type == FULL_CONTEXT) { |
| 4840 if (!isolate->serializer_enabled()) { | 4904 if (!isolate->serializer_enabled()) { |
| 4841 InitializeExperimentalGlobal(); | 4905 InitializeExperimentalGlobal(); |
| 4906 if (!InstallExperimentalNatives()) return; |
| 4842 | 4907 |
| 4843 if (FLAG_experimental_extras) { | 4908 if (FLAG_experimental_extras) { |
| 4844 if (!InstallExperimentalExtraNatives()) return; | 4909 if (!InstallExperimentalExtraNatives()) return; |
| 4845 } | 4910 } |
| 4846 | 4911 |
| 4847 // Store String.prototype's map again in case it has been changed by | 4912 // Store String.prototype's map again in case it has been changed by |
| 4848 // experimental natives. | 4913 // experimental natives. |
| 4849 Handle<JSFunction> string_function(native_context()->string_function()); | 4914 Handle<JSFunction> string_function(native_context()->string_function()); |
| 4850 JSObject* string_function_prototype = | 4915 JSObject* string_function_prototype = |
| 4851 JSObject::cast(string_function->initial_map()->prototype()); | 4916 JSObject::cast(string_function->initial_map()->prototype()); |
| 4852 DCHECK(string_function_prototype->HasFastProperties()); | 4917 DCHECK(string_function_prototype->HasFastProperties()); |
| 4853 native_context()->set_string_function_prototype_map( | 4918 native_context()->set_string_function_prototype_map( |
| 4854 string_function_prototype->map()); | 4919 string_function_prototype->map()); |
| 4855 } | 4920 } |
| 4921 // The serializer cannot serialize typed arrays. Reset those typed arrays |
| 4922 // for each new context. |
| 4856 } else if (context_type == DEBUG_CONTEXT) { | 4923 } else if (context_type == DEBUG_CONTEXT) { |
| 4857 DCHECK(!isolate->serializer_enabled()); | 4924 DCHECK(!isolate->serializer_enabled()); |
| 4858 InitializeExperimentalGlobal(); | 4925 InitializeExperimentalGlobal(); |
| 4859 if (!InstallDebuggerNatives()) return; | 4926 if (!InstallDebuggerNatives()) return; |
| 4860 } | 4927 } |
| 4861 | 4928 |
| 4862 ConfigureUtilsObject(context_type); | 4929 ConfigureUtilsObject(context_type); |
| 4863 | 4930 |
| 4864 // Check that the script context table is empty except for the 'this' binding. | 4931 // Check that the script context table is empty except for the 'this' binding. |
| 4865 // We do not need script contexts for native scripts. | 4932 // We do not need script contexts for native scripts. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4967 } | 5034 } |
| 4968 | 5035 |
| 4969 | 5036 |
| 4970 // Called when the top-level V8 mutex is destroyed. | 5037 // Called when the top-level V8 mutex is destroyed. |
| 4971 void Bootstrapper::FreeThreadResources() { | 5038 void Bootstrapper::FreeThreadResources() { |
| 4972 DCHECK(!IsActive()); | 5039 DCHECK(!IsActive()); |
| 4973 } | 5040 } |
| 4974 | 5041 |
| 4975 } // namespace internal | 5042 } // namespace internal |
| 4976 } // namespace v8 | 5043 } // namespace v8 |
| OLD | NEW |