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 Handle<JSObject> utils = | |
3555 Handle<JSObject>::cast(isolate->natives_utils_object()); | |
Yang
2017/02/03 10:20:25
Alternatively, you could just get global.Array.pro
danno
2017/02/03 12:46:55
Done.
| |
3556 LookupIterator it(utils, | |
3557 factory->NewStringFromAsciiChecked("ForEachFunction"), | |
3558 LookupIterator::OWN_SKIP_INTERCEPTOR); | |
3559 Handle<Object> for_each_function = Object::GetProperty(&it).ToHandleChecked(); | |
3560 Handle<JSFunction>::cast(for_each_function) | |
3561 ->set_code(isolate->builtins()->builtin(Builtins::kArrayForEach)); | |
3562 } | |
3543 | 3563 |
3544 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 3564 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { |
3545 if (!FLAG_harmony_sharedarraybuffer) return; | 3565 if (!FLAG_harmony_sharedarraybuffer) return; |
3546 | 3566 |
3547 Handle<JSGlobalObject> global(native_context()->global_object()); | 3567 Handle<JSGlobalObject> global(native_context()->global_object()); |
3548 Isolate* isolate = global->GetIsolate(); | 3568 Isolate* isolate = global->GetIsolate(); |
3549 Factory* factory = isolate->factory(); | 3569 Factory* factory = isolate->factory(); |
3550 | 3570 |
3551 Handle<JSFunction> shared_array_buffer_fun = | 3571 Handle<JSFunction> shared_array_buffer_fun = |
3552 InstallArrayBuffer(global, "SharedArrayBuffer", | 3572 InstallArrayBuffer(global, "SharedArrayBuffer", |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4844 } | 4864 } |
4845 | 4865 |
4846 | 4866 |
4847 // Called when the top-level V8 mutex is destroyed. | 4867 // Called when the top-level V8 mutex is destroyed. |
4848 void Bootstrapper::FreeThreadResources() { | 4868 void Bootstrapper::FreeThreadResources() { |
4849 DCHECK(!IsActive()); | 4869 DCHECK(!IsActive()); |
4850 } | 4870 } |
4851 | 4871 |
4852 } // namespace internal | 4872 } // namespace internal |
4853 } // namespace v8 | 4873 } // namespace v8 |
OLD | NEW |