| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void ConfigureUtilsObject(GlobalContextType context_type); | 210 void ConfigureUtilsObject(GlobalContextType context_type); |
| 211 | 211 |
| 212 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 212 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
| 213 void InitializeGlobal_##id(); | 213 void InitializeGlobal_##id(); |
| 214 | 214 |
| 215 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) | 215 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
| 216 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) | 216 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
| 217 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) | 217 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
| 218 #undef DECLARE_FEATURE_INITIALIZATION | 218 #undef DECLARE_FEATURE_INITIALIZATION |
| 219 | 219 |
| 220 void InitializeGlobal_enable_fast_array_builtins(); |
| 221 |
| 220 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, | 222 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, |
| 221 const char* name, Builtins::Name call, | 223 const char* name, Builtins::Name call, |
| 222 BuiltinFunctionId id); | 224 BuiltinFunctionId id); |
| 223 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, | 225 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, |
| 224 const char* name, | 226 const char* name, |
| 225 ElementsKind elements_kind); | 227 ElementsKind elements_kind); |
| 226 bool InstallNatives(GlobalContextType context_type); | 228 bool InstallNatives(GlobalContextType context_type); |
| 227 | 229 |
| 228 void InstallTypedArray(const char* name, ElementsKind elements_kind, | 230 void InstallTypedArray(const char* name, ElementsKind elements_kind, |
| 229 Handle<JSFunction>* fun); | 231 Handle<JSFunction>* fun); |
| (...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2904 } | 2906 } |
| 2905 | 2907 |
| 2906 | 2908 |
| 2907 void Genesis::InitializeExperimentalGlobal() { | 2909 void Genesis::InitializeExperimentalGlobal() { |
| 2908 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 2910 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 2909 | 2911 |
| 2910 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 2912 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
| 2911 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 2913 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
| 2912 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | 2914 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 2913 #undef FEATURE_INITIALIZE_GLOBAL | 2915 #undef FEATURE_INITIALIZE_GLOBAL |
| 2916 |
| 2917 InitializeGlobal_enable_fast_array_builtins(); |
| 2914 } | 2918 } |
| 2915 | 2919 |
| 2916 | 2920 |
| 2917 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { | 2921 bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) { |
| 2918 Vector<const char> name = Natives::GetScriptName(index); | 2922 Vector<const char> name = Natives::GetScriptName(index); |
| 2919 Handle<String> source_code = | 2923 Handle<String> source_code = |
| 2920 isolate->bootstrapper()->SourceLookup<Natives>(index); | 2924 isolate->bootstrapper()->SourceLookup<Natives>(index); |
| 2921 | 2925 |
| 2922 // We pass in extras_utils so that builtin code can set it up for later use | 2926 // We pass in extras_utils so that builtin code can set it up for later use |
| 2923 // by actual extras code, compiled with CompileExtraBuiltin. | 2927 // by actual extras code, compiled with CompileExtraBuiltin. |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3533 JSGlobalObject::cast(native_context->global_object())); | 3537 JSGlobalObject::cast(native_context->global_object())); |
| 3534 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 3538 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
| 3535 Handle<JSObject> symbol = Handle<JSObject>::cast( | 3539 Handle<JSObject> symbol = Handle<JSObject>::cast( |
| 3536 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); | 3540 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); |
| 3537 Handle<String> name_string = factory->InternalizeUtf8String(name); | 3541 Handle<String> name_string = factory->InternalizeUtf8String(name); |
| 3538 PropertyAttributes attributes = | 3542 PropertyAttributes attributes = |
| 3539 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 3543 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 3540 JSObject::AddProperty(symbol, name_string, value, attributes); | 3544 JSObject::AddProperty(symbol, name_string, value, attributes); |
| 3541 } | 3545 } |
| 3542 | 3546 |
| 3547 void Genesis::InitializeGlobal_enable_fast_array_builtins() { |
| 3548 if (!FLAG_enable_fast_array_builtins) return; |
| 3549 |
| 3550 Handle<JSGlobalObject> global(native_context()->global_object()); |
| 3551 Isolate* isolate = global->GetIsolate(); |
| 3552 Factory* factory = isolate->factory(); |
| 3553 |
| 3554 LookupIterator it1(global, factory->NewStringFromAsciiChecked("Array"), |
| 3555 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 3556 Handle<Object> array_object = Object::GetProperty(&it1).ToHandleChecked(); |
| 3557 LookupIterator it2(array_object, |
| 3558 factory->NewStringFromAsciiChecked("prototype"), |
| 3559 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 3560 Handle<Object> array_prototype = Object::GetProperty(&it2).ToHandleChecked(); |
| 3561 LookupIterator it3(array_prototype, |
| 3562 factory->NewStringFromAsciiChecked("forEach"), |
| 3563 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 3564 Handle<Object> for_each_function = |
| 3565 Object::GetProperty(&it3).ToHandleChecked(); |
| 3566 Handle<JSFunction>::cast(for_each_function) |
| 3567 ->set_code(isolate->builtins()->builtin(Builtins::kArrayForEach)); |
| 3568 } |
| 3543 | 3569 |
| 3544 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 3570 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
| 3545 if (!FLAG_harmony_sharedarraybuffer) return; | 3571 if (!FLAG_harmony_sharedarraybuffer) return; |
| 3546 | 3572 |
| 3547 Handle<JSGlobalObject> global(native_context()->global_object()); | 3573 Handle<JSGlobalObject> global(native_context()->global_object()); |
| 3548 Isolate* isolate = global->GetIsolate(); | 3574 Isolate* isolate = global->GetIsolate(); |
| 3549 Factory* factory = isolate->factory(); | 3575 Factory* factory = isolate->factory(); |
| 3550 | 3576 |
| 3551 Handle<JSFunction> shared_array_buffer_fun = | 3577 Handle<JSFunction> shared_array_buffer_fun = |
| 3552 InstallArrayBuffer(global, "SharedArrayBuffer", | 3578 InstallArrayBuffer(global, "SharedArrayBuffer", |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4844 } | 4870 } |
| 4845 | 4871 |
| 4846 | 4872 |
| 4847 // Called when the top-level V8 mutex is destroyed. | 4873 // Called when the top-level V8 mutex is destroyed. |
| 4848 void Bootstrapper::FreeThreadResources() { | 4874 void Bootstrapper::FreeThreadResources() { |
| 4849 DCHECK(!IsActive()); | 4875 DCHECK(!IsActive()); |
| 4850 } | 4876 } |
| 4851 | 4877 |
| 4852 } // namespace internal | 4878 } // namespace internal |
| 4853 } // namespace v8 | 4879 } // namespace v8 |
| OLD | NEW |