| 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); | |
| 62 template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>( | 60 template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>( |
| 63 int index); | 61 int index); |
| 64 template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index); | 62 template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index); |
| 65 | 63 |
| 66 | 64 |
| 67 void Bootstrapper::Initialize(bool create_heap_objects) { | 65 void Bootstrapper::Initialize(bool create_heap_objects) { |
| 68 extensions_cache_.Initialize(isolate_, create_heap_objects); | 66 extensions_cache_.Initialize(isolate_, create_heap_objects); |
| 69 } | 67 } |
| 70 | 68 |
| 71 | 69 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ExternalOneByteString::cast(natives_source)->resource()); | 124 ExternalOneByteString::cast(natives_source)->resource()); |
| 127 delete resource; | 125 delete resource; |
| 128 } | 126 } |
| 129 } | 127 } |
| 130 } | 128 } |
| 131 } | 129 } |
| 132 | 130 |
| 133 | 131 |
| 134 void Bootstrapper::TearDown() { | 132 void Bootstrapper::TearDown() { |
| 135 DeleteNativeSources(Natives::GetSourceCache(isolate_->heap())); | 133 DeleteNativeSources(Natives::GetSourceCache(isolate_->heap())); |
| 136 DeleteNativeSources(ExperimentalNatives::GetSourceCache(isolate_->heap())); | |
| 137 DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap())); | 134 DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap())); |
| 138 DeleteNativeSources( | 135 DeleteNativeSources( |
| 139 ExperimentalExtraNatives::GetSourceCache(isolate_->heap())); | 136 ExperimentalExtraNatives::GetSourceCache(isolate_->heap())); |
| 140 | 137 |
| 141 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical | 138 extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical |
| 142 } | 139 } |
| 143 | 140 |
| 144 | 141 |
| 145 class Genesis BASE_EMBEDDED { | 142 class Genesis BASE_EMBEDDED { |
| 146 public: | 143 public: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 221 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
| 225 const char* name, Builtins::Name call, | 222 const char* name, Builtins::Name call, |
| 226 BuiltinFunctionId id, bool is_shared); | 223 BuiltinFunctionId id, bool is_shared); |
| 227 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 224 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
| 228 const char* name, | 225 const char* name, |
| 229 ElementsKind elements_kind); | 226 ElementsKind elements_kind); |
| 230 bool InstallNatives(GlobalContextType context_type); | 227 bool InstallNatives(GlobalContextType context_type); |
| 231 | 228 |
| 232 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 229 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
| 233 Handle<JSFunction>* fun); | 230 Handle<JSFunction>* fun); |
| 234 bool InstallExperimentalNatives(); | |
| 235 bool InstallExtraNatives(); | 231 bool InstallExtraNatives(); |
| 236 bool InstallExperimentalExtraNatives(); | 232 bool InstallExperimentalExtraNatives(); |
| 237 bool InstallDebuggerNatives(); | 233 bool InstallDebuggerNatives(); |
| 238 void InstallBuiltinFunctionIds(); | 234 void InstallBuiltinFunctionIds(); |
| 239 void InstallExperimentalBuiltinFunctionIds(); | 235 void InstallExperimentalBuiltinFunctionIds(); |
| 240 void InitializeNormalizedMapCaches(); | 236 void InitializeNormalizedMapCaches(); |
| 241 | 237 |
| 242 enum ExtensionTraversalState { | 238 enum ExtensionTraversalState { |
| 243 UNVISITED, VISITED, INSTALLED | 239 UNVISITED, VISITED, INSTALLED |
| 244 }; | 240 }; |
| (...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 Handle<Object> global = isolate->global_object(); | 3085 Handle<Object> global = isolate->global_object(); |
| 3090 Handle<Object> utils = isolate->natives_utils_object(); | 3086 Handle<Object> utils = isolate->natives_utils_object(); |
| 3091 Handle<Object> extras_utils = isolate->extras_utils_object(); | 3087 Handle<Object> extras_utils = isolate->extras_utils_object(); |
| 3092 Handle<Object> args[] = {global, utils, extras_utils}; | 3088 Handle<Object> args[] = {global, utils, extras_utils}; |
| 3093 | 3089 |
| 3094 return Bootstrapper::CompileNative(isolate, name, source_code, | 3090 return Bootstrapper::CompileNative(isolate, name, source_code, |
| 3095 arraysize(args), args, NATIVES_CODE); | 3091 arraysize(args), args, NATIVES_CODE); |
| 3096 } | 3092 } |
| 3097 | 3093 |
| 3098 | 3094 |
| 3099 bool Bootstrapper::CompileExperimentalBuiltin(Isolate* isolate, int index) { | |
| 3100 HandleScope scope(isolate); | |
| 3101 Vector<const char> name = ExperimentalNatives::GetScriptName(index); | |
| 3102 Handle<String> source_code = | |
| 3103 isolate->bootstrapper()->SourceLookup<ExperimentalNatives>(index); | |
| 3104 Handle<Object> global = isolate->global_object(); | |
| 3105 Handle<Object> utils = isolate->natives_utils_object(); | |
| 3106 Handle<Object> args[] = {global, utils}; | |
| 3107 return Bootstrapper::CompileNative(isolate, name, source_code, | |
| 3108 arraysize(args), args, NATIVES_CODE); | |
| 3109 } | |
| 3110 | |
| 3111 | |
| 3112 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { | 3095 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { |
| 3113 HandleScope scope(isolate); | 3096 HandleScope scope(isolate); |
| 3114 Vector<const char> name = ExtraNatives::GetScriptName(index); | 3097 Vector<const char> name = ExtraNatives::GetScriptName(index); |
| 3115 Handle<String> source_code = | 3098 Handle<String> source_code = |
| 3116 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); | 3099 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); |
| 3117 Handle<Object> global = isolate->global_object(); | 3100 Handle<Object> global = isolate->global_object(); |
| 3118 Handle<Object> binding = isolate->extras_binding_object(); | 3101 Handle<Object> binding = isolate->extras_binding_object(); |
| 3119 Handle<Object> extras_utils = isolate->extras_utils_object(); | 3102 Handle<Object> extras_utils = isolate->extras_utils_object(); |
| 3120 Handle<Object> args[] = {global, binding, extras_utils}; | 3103 Handle<Object> args[] = {global, binding, extras_utils}; |
| 3121 return Bootstrapper::CompileNative(isolate, name, source_code, | 3104 return Bootstrapper::CompileNative(isolate, name, source_code, |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3753 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 3736 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); |
| 3754 | 3737 |
| 3755 Handle<String> name = factory->InternalizeUtf8String("Atomics"); | 3738 Handle<String> name = factory->InternalizeUtf8String("Atomics"); |
| 3756 Handle<JSFunction> cons = factory->NewFunction(name); | 3739 Handle<JSFunction> cons = factory->NewFunction(name); |
| 3757 JSFunction::SetInstancePrototype( | 3740 JSFunction::SetInstancePrototype( |
| 3758 cons, | 3741 cons, |
| 3759 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 3742 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| 3760 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED); | 3743 Handle<JSObject> atomics_object = factory->NewJSObject(cons, TENURED); |
| 3761 DCHECK(atomics_object->IsJSObject()); | 3744 DCHECK(atomics_object->IsJSObject()); |
| 3762 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM); | 3745 JSObject::AddProperty(global, name, atomics_object, DONT_ENUM); |
| 3746 JSObject::AddProperty(atomics_object, factory->to_string_tag_symbol(), name, |
| 3747 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 3763 | 3748 |
| 3764 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"), | 3749 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("load"), |
| 3765 Builtins::kAtomicsLoad, 2, true); | 3750 Builtins::kAtomicsLoad, 2, true); |
| 3766 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("store"), | 3751 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("store"), |
| 3767 Builtins::kAtomicsStore, 3, true); | 3752 Builtins::kAtomicsStore, 3, true); |
| 3753 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("add"), |
| 3754 Builtins::kAtomicsAdd, 3, true); |
| 3755 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("sub"), |
| 3756 Builtins::kAtomicsSub, 3, true); |
| 3757 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("and"), |
| 3758 Builtins::kAtomicsAnd, 3, true); |
| 3759 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("or"), |
| 3760 Builtins::kAtomicsOr, 3, true); |
| 3761 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("xor"), |
| 3762 Builtins::kAtomicsXor, 3, true); |
| 3768 SimpleInstallFunction(atomics_object, | 3763 SimpleInstallFunction(atomics_object, |
| 3769 factory->InternalizeUtf8String("exchange"), | 3764 factory->InternalizeUtf8String("exchange"), |
| 3770 Builtins::kAtomicsExchange, 3, true); | 3765 Builtins::kAtomicsExchange, 3, true); |
| 3766 SimpleInstallFunction(atomics_object, |
| 3767 factory->InternalizeUtf8String("compareExchange"), |
| 3768 Builtins::kAtomicsCompareExchange, 4, true); |
| 3769 SimpleInstallFunction(atomics_object, |
| 3770 factory->InternalizeUtf8String("isLockFree"), |
| 3771 Builtins::kAtomicsIsLockFree, 1, true); |
| 3772 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("wait"), |
| 3773 Builtins::kAtomicsWait, 4, true); |
| 3774 SimpleInstallFunction(atomics_object, factory->InternalizeUtf8String("wake"), |
| 3775 Builtins::kAtomicsWake, 3, true); |
| 3771 } | 3776 } |
| 3772 | 3777 |
| 3773 void Genesis::InitializeGlobal_harmony_array_prototype_values() { | 3778 void Genesis::InitializeGlobal_harmony_array_prototype_values() { |
| 3774 if (!FLAG_harmony_array_prototype_values) return; | 3779 if (!FLAG_harmony_array_prototype_values) return; |
| 3775 Handle<JSFunction> array_constructor(native_context()->array_function()); | 3780 Handle<JSFunction> array_constructor(native_context()->array_function()); |
| 3776 Handle<JSObject> array_prototype( | 3781 Handle<JSObject> array_prototype( |
| 3777 JSObject::cast(array_constructor->instance_prototype())); | 3782 JSObject::cast(array_constructor->instance_prototype())); |
| 3778 Handle<Object> values_iterator = | 3783 Handle<Object> values_iterator = |
| 3779 JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) | 3784 JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) |
| 3780 .ToHandleChecked(); | 3785 .ToHandleChecked(); |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4371 arguments_iterator, attribs); | 4376 arguments_iterator, attribs); |
| 4372 Handle<Map> map(native_context()->strict_arguments_map()); | 4377 Handle<Map> map(native_context()->strict_arguments_map()); |
| 4373 Map::EnsureDescriptorSlack(map, 1); | 4378 Map::EnsureDescriptorSlack(map, 1); |
| 4374 map->AppendDescriptor(&d); | 4379 map->AppendDescriptor(&d); |
| 4375 } | 4380 } |
| 4376 } | 4381 } |
| 4377 | 4382 |
| 4378 return true; | 4383 return true; |
| 4379 } | 4384 } |
| 4380 | 4385 |
| 4381 | |
| 4382 bool Genesis::InstallExperimentalNatives() { | |
| 4383 static const char* harmony_tailcalls_natives[] = {nullptr}; | |
| 4384 static const char* harmony_sharedarraybuffer_natives[] = { | |
| 4385 "native harmony-atomics.js", NULL}; | |
| 4386 static const char* harmony_do_expressions_natives[] = {nullptr}; | |
| 4387 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | |
| 4388 static const char* harmony_regexp_named_captures_natives[] = {nullptr}; | |
| 4389 static const char* harmony_regexp_property_natives[] = {nullptr}; | |
| 4390 static const char* harmony_function_sent_natives[] = {nullptr}; | |
| 4391 static const char* harmony_array_prototype_values_natives[] = {nullptr}; | |
| 4392 #ifdef V8_I18N_SUPPORT | |
| 4393 static const char* icu_case_mapping_natives[] = {nullptr}; | |
| 4394 static const char* datetime_format_to_parts_natives[] = {nullptr}; | |
| 4395 #endif | |
| 4396 static const char* harmony_restrictive_generators_natives[] = {nullptr}; | |
| 4397 static const char* harmony_trailing_commas_natives[] = {nullptr}; | |
| 4398 static const char* harmony_function_tostring_natives[] = {nullptr}; | |
| 4399 static const char* harmony_class_fields_natives[] = {nullptr}; | |
| 4400 static const char* harmony_object_rest_spread_natives[] = {nullptr}; | |
| 4401 static const char* harmony_async_iteration_natives[] = {nullptr}; | |
| 4402 static const char* harmony_dynamic_import_natives[] = {nullptr}; | |
| 4403 static const char* harmony_promise_finally_natives[] = {nullptr}; | |
| 4404 static const char* harmony_template_escapes_natives[] = {nullptr}; | |
| 4405 | |
| 4406 for (int i = ExperimentalNatives::GetDebuggerCount(); | |
| 4407 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | |
| 4408 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | |
| 4409 if (FLAG_##id) { \ | |
| 4410 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | |
| 4411 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ | |
| 4412 if (strncmp(script_name.start(), id##_natives[j], \ | |
| 4413 script_name.length()) == 0) { \ | |
| 4414 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ | |
| 4415 return false; \ | |
| 4416 } \ | |
| 4417 } \ | |
| 4418 } \ | |
| 4419 } | |
| 4420 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | |
| 4421 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | |
| 4422 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | |
| 4423 #undef INSTALL_EXPERIMENTAL_NATIVES | |
| 4424 } | |
| 4425 | |
| 4426 if (!CallUtilsFunction(isolate(), "PostExperimentals")) return false; | |
| 4427 | |
| 4428 InstallExperimentalBuiltinFunctionIds(); | |
| 4429 return true; | |
| 4430 } | |
| 4431 | |
| 4432 | |
| 4433 bool Genesis::InstallExtraNatives() { | 4386 bool Genesis::InstallExtraNatives() { |
| 4434 HandleScope scope(isolate()); | 4387 HandleScope scope(isolate()); |
| 4435 | 4388 |
| 4436 Handle<JSObject> extras_binding = | 4389 Handle<JSObject> extras_binding = |
| 4437 factory()->NewJSObject(isolate()->object_function()); | 4390 factory()->NewJSObject(isolate()->object_function()); |
| 4438 native_context()->set_extras_binding_object(*extras_binding); | 4391 native_context()->set_extras_binding_object(*extras_binding); |
| 4439 | 4392 |
| 4440 for (int i = ExtraNatives::GetDebuggerCount(); | 4393 for (int i = ExtraNatives::GetDebuggerCount(); |
| 4441 i < ExtraNatives::GetBuiltinsCount(); i++) { | 4394 i < ExtraNatives::GetBuiltinsCount(); i++) { |
| 4442 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false; | 4395 if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4454 } | 4407 } |
| 4455 | 4408 |
| 4456 return true; | 4409 return true; |
| 4457 } | 4410 } |
| 4458 | 4411 |
| 4459 | 4412 |
| 4460 bool Genesis::InstallDebuggerNatives() { | 4413 bool Genesis::InstallDebuggerNatives() { |
| 4461 for (int i = 0; i < Natives::GetDebuggerCount(); ++i) { | 4414 for (int i = 0; i < Natives::GetDebuggerCount(); ++i) { |
| 4462 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; | 4415 if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false; |
| 4463 } | 4416 } |
| 4464 return CallUtilsFunction(isolate(), "PostDebug"); | 4417 return true; |
| 4465 } | 4418 } |
| 4466 | 4419 |
| 4467 | 4420 |
| 4468 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 4421 static void InstallBuiltinFunctionId(Handle<JSObject> holder, |
| 4469 const char* function_name, | 4422 const char* function_name, |
| 4470 BuiltinFunctionId id) { | 4423 BuiltinFunctionId id) { |
| 4471 Isolate* isolate = holder->GetIsolate(); | 4424 Isolate* isolate = holder->GetIsolate(); |
| 4472 Handle<Object> function_object = | 4425 Handle<Object> function_object = |
| 4473 JSReceiver::GetProperty(isolate, holder, function_name).ToHandleChecked(); | 4426 JSReceiver::GetProperty(isolate, holder, function_name).ToHandleChecked(); |
| 4474 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 4427 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4492 const BuiltinFunctionIds builtins[] = { | 4445 const BuiltinFunctionIds builtins[] = { |
| 4493 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; | 4446 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; |
| 4494 | 4447 |
| 4495 for (const BuiltinFunctionIds& builtin : builtins) { | 4448 for (const BuiltinFunctionIds& builtin : builtins) { |
| 4496 Handle<JSObject> holder = | 4449 Handle<JSObject> holder = |
| 4497 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); | 4450 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); |
| 4498 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); | 4451 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); |
| 4499 } | 4452 } |
| 4500 } | 4453 } |
| 4501 | 4454 |
| 4502 | |
| 4503 void Genesis::InstallExperimentalBuiltinFunctionIds() { | |
| 4504 if (FLAG_harmony_sharedarraybuffer) { | |
| 4505 struct BuiltinFunctionIds { | |
| 4506 const char* holder_expr; | |
| 4507 const char* fun_name; | |
| 4508 BuiltinFunctionId id; | |
| 4509 }; | |
| 4510 | |
| 4511 const BuiltinFunctionIds atomic_builtins[] = { | |
| 4512 ATOMIC_FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)}; | |
| 4513 | |
| 4514 for (const BuiltinFunctionIds& builtin : atomic_builtins) { | |
| 4515 Handle<JSObject> holder = | |
| 4516 ResolveBuiltinIdHolder(native_context(), builtin.holder_expr); | |
| 4517 InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id); | |
| 4518 } | |
| 4519 } | |
| 4520 } | |
| 4521 | |
| 4522 #undef INSTALL_BUILTIN_ID | 4455 #undef INSTALL_BUILTIN_ID |
| 4523 | 4456 |
| 4524 | 4457 |
| 4525 void Genesis::InitializeNormalizedMapCaches() { | 4458 void Genesis::InitializeNormalizedMapCaches() { |
| 4526 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate()); | 4459 Handle<NormalizedMapCache> cache = NormalizedMapCache::New(isolate()); |
| 4527 native_context()->set_normalized_map_cache(*cache); | 4460 native_context()->set_normalized_map_cache(*cache); |
| 4528 } | 4461 } |
| 4529 | 4462 |
| 4530 | 4463 |
| 4531 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, | 4464 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5022 | 4955 |
| 5023 isolate->counters()->contexts_created_from_scratch()->Increment(); | 4956 isolate->counters()->contexts_created_from_scratch()->Increment(); |
| 5024 } | 4957 } |
| 5025 | 4958 |
| 5026 // Install experimental natives. Do not include them into the | 4959 // Install experimental natives. Do not include them into the |
| 5027 // snapshot as we should be able to turn them off at runtime. Re-installing | 4960 // snapshot as we should be able to turn them off at runtime. Re-installing |
| 5028 // them after they have already been deserialized would also fail. | 4961 // them after they have already been deserialized would also fail. |
| 5029 if (context_type == FULL_CONTEXT) { | 4962 if (context_type == FULL_CONTEXT) { |
| 5030 if (!isolate->serializer_enabled()) { | 4963 if (!isolate->serializer_enabled()) { |
| 5031 InitializeExperimentalGlobal(); | 4964 InitializeExperimentalGlobal(); |
| 5032 if (!InstallExperimentalNatives()) return; | |
| 5033 | 4965 |
| 5034 if (FLAG_experimental_extras) { | 4966 if (FLAG_experimental_extras) { |
| 5035 if (!InstallExperimentalExtraNatives()) return; | 4967 if (!InstallExperimentalExtraNatives()) return; |
| 5036 } | 4968 } |
| 5037 | 4969 |
| 5038 // Store String.prototype's map again in case it has been changed by | 4970 // Store String.prototype's map again in case it has been changed by |
| 5039 // experimental natives. | 4971 // experimental natives. |
| 5040 Handle<JSFunction> string_function(native_context()->string_function()); | 4972 Handle<JSFunction> string_function(native_context()->string_function()); |
| 5041 JSObject* string_function_prototype = | 4973 JSObject* string_function_prototype = |
| 5042 JSObject::cast(string_function->initial_map()->prototype()); | 4974 JSObject::cast(string_function->initial_map()->prototype()); |
| 5043 DCHECK(string_function_prototype->HasFastProperties()); | 4975 DCHECK(string_function_prototype->HasFastProperties()); |
| 5044 native_context()->set_string_function_prototype_map( | 4976 native_context()->set_string_function_prototype_map( |
| 5045 string_function_prototype->map()); | 4977 string_function_prototype->map()); |
| 5046 } | 4978 } |
| 5047 // The serializer cannot serialize typed arrays. Reset those typed arrays | |
| 5048 // for each new context. | |
| 5049 } else if (context_type == DEBUG_CONTEXT) { | 4979 } else if (context_type == DEBUG_CONTEXT) { |
| 5050 DCHECK(!isolate->serializer_enabled()); | 4980 DCHECK(!isolate->serializer_enabled()); |
| 5051 InitializeExperimentalGlobal(); | 4981 InitializeExperimentalGlobal(); |
| 5052 if (!InstallDebuggerNatives()) return; | 4982 if (!InstallDebuggerNatives()) return; |
| 5053 } | 4983 } |
| 5054 | 4984 |
| 5055 ConfigureUtilsObject(context_type); | 4985 ConfigureUtilsObject(context_type); |
| 5056 | 4986 |
| 5057 // Check that the script context table is empty except for the 'this' binding. | 4987 // Check that the script context table is empty except for the 'this' binding. |
| 5058 // We do not need script contexts for native scripts. | 4988 // We do not need script contexts for native scripts. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 } | 5090 } |
| 5161 | 5091 |
| 5162 | 5092 |
| 5163 // Called when the top-level V8 mutex is destroyed. | 5093 // Called when the top-level V8 mutex is destroyed. |
| 5164 void Bootstrapper::FreeThreadResources() { | 5094 void Bootstrapper::FreeThreadResources() { |
| 5165 DCHECK(!IsActive()); | 5095 DCHECK(!IsActive()); |
| 5166 } | 5096 } |
| 5167 | 5097 |
| 5168 } // namespace internal | 5098 } // namespace internal |
| 5169 } // namespace v8 | 5099 } // namespace v8 |
| OLD | NEW |