| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2287 | 2287 |
| 2288 #define INITIALIZE_FLAG(FLAG) \ | 2288 #define INITIALIZE_FLAG(FLAG) \ |
| 2289 { \ | 2289 { \ |
| 2290 Handle<String> name = \ | 2290 Handle<String> name = \ |
| 2291 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ | 2291 isolate->factory()->NewStringFromAsciiChecked(#FLAG); \ |
| 2292 JSObject::AddProperty(container, name, \ | 2292 JSObject::AddProperty(container, name, \ |
| 2293 isolate->factory()->ToBoolean(FLAG), NONE); \ | 2293 isolate->factory()->ToBoolean(FLAG), NONE); \ |
| 2294 } | 2294 } |
| 2295 | 2295 |
| 2296 INITIALIZE_FLAG(FLAG_harmony_tostring) | 2296 INITIALIZE_FLAG(FLAG_harmony_tostring) |
| 2297 INITIALIZE_FLAG(FLAG_harmony_tolength) | |
| 2298 INITIALIZE_FLAG(FLAG_harmony_species) | 2297 INITIALIZE_FLAG(FLAG_harmony_species) |
| 2299 | 2298 |
| 2300 #undef INITIALIZE_FLAG | 2299 #undef INITIALIZE_FLAG |
| 2301 } | 2300 } |
| 2302 | 2301 |
| 2303 | 2302 |
| 2304 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ | 2303 #define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \ |
| 2305 void Genesis::InitializeGlobal_##id() {} | 2304 void Genesis::InitializeGlobal_##id() {} |
| 2306 | 2305 |
| 2307 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) | 2306 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) |
| 2308 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) | 2307 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) |
| 2309 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function) | 2308 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function) |
| 2310 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let) | 2309 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let) |
| 2311 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) | 2310 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) |
| 2312 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) | 2311 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_bind) |
| 2313 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) | 2312 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring_assignment) |
| 2314 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) | 2313 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) |
| 2315 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) | 2314 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) |
| 2316 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) | 2315 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) |
| 2317 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) | |
| 2318 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) | |
| 2319 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) | 2316 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) |
| 2320 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) | 2317 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) |
| 2321 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) | 2318 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) |
| 2322 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) | 2319 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) |
| 2323 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) | 2320 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) |
| 2324 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) | 2321 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) |
| 2325 | 2322 |
| 2326 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, | 2323 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, |
| 2327 const char* name, Handle<Symbol> value) { | 2324 const char* name, Handle<Symbol> value) { |
| 2328 Handle<JSGlobalObject> global( | 2325 Handle<JSGlobalObject> global( |
| 2329 JSGlobalObject::cast(native_context->global_object())); | 2326 JSGlobalObject::cast(native_context->global_object())); |
| 2330 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); | 2327 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); |
| 2331 Handle<JSObject> symbol = Handle<JSObject>::cast( | 2328 Handle<JSObject> symbol = Handle<JSObject>::cast( |
| 2332 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); | 2329 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); |
| 2333 Handle<String> name_string = factory->InternalizeUtf8String(name); | 2330 Handle<String> name_string = factory->InternalizeUtf8String(name); |
| 2334 PropertyAttributes attributes = | 2331 PropertyAttributes attributes = |
| 2335 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 2332 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 2336 JSObject::AddProperty(symbol, name_string, value, attributes); | 2333 JSObject::AddProperty(symbol, name_string, value, attributes); |
| 2337 } | 2334 } |
| 2338 | 2335 |
| 2339 | 2336 |
| 2340 void Genesis::InitializeGlobal_harmony_tostring() { | 2337 void Genesis::InitializeGlobal_harmony_tostring() { |
| 2341 if (!FLAG_harmony_tostring) return; | 2338 if (!FLAG_harmony_tostring) return; |
| 2342 InstallPublicSymbol(factory(), native_context(), "toStringTag", | 2339 InstallPublicSymbol(factory(), native_context(), "toStringTag", |
| 2343 factory()->to_string_tag_symbol()); | 2340 factory()->to_string_tag_symbol()); |
| 2344 } | 2341 } |
| 2345 | 2342 |
| 2346 | 2343 |
| 2347 void Genesis::InitializeGlobal_harmony_concat_spreadable() { | |
| 2348 if (!FLAG_harmony_concat_spreadable) return; | |
| 2349 InstallPublicSymbol(factory(), native_context(), "isConcatSpreadable", | |
| 2350 factory()->is_concat_spreadable_symbol()); | |
| 2351 } | |
| 2352 | |
| 2353 | |
| 2354 void Genesis::InitializeGlobal_harmony_regexp_subclass() { | 2344 void Genesis::InitializeGlobal_harmony_regexp_subclass() { |
| 2355 if (!FLAG_harmony_regexp_subclass) return; | 2345 if (!FLAG_harmony_regexp_subclass) return; |
| 2356 InstallPublicSymbol(factory(), native_context(), "match", | 2346 InstallPublicSymbol(factory(), native_context(), "match", |
| 2357 factory()->match_symbol()); | 2347 factory()->match_symbol()); |
| 2358 InstallPublicSymbol(factory(), native_context(), "replace", | 2348 InstallPublicSymbol(factory(), native_context(), "replace", |
| 2359 factory()->replace_symbol()); | 2349 factory()->replace_symbol()); |
| 2360 InstallPublicSymbol(factory(), native_context(), "search", | 2350 InstallPublicSymbol(factory(), native_context(), "search", |
| 2361 factory()->search_symbol()); | 2351 factory()->search_symbol()); |
| 2362 InstallPublicSymbol(factory(), native_context(), "split", | 2352 InstallPublicSymbol(factory(), native_context(), "split", |
| 2363 factory()->split_symbol()); | 2353 factory()->split_symbol()); |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2942 "native harmony-unicode-regexps.js", nullptr}; | 2932 "native harmony-unicode-regexps.js", nullptr}; |
| 2943 static const char* harmony_default_parameters_natives[] = {nullptr}; | 2933 static const char* harmony_default_parameters_natives[] = {nullptr}; |
| 2944 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", | 2934 static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", |
| 2945 nullptr}; | 2935 nullptr}; |
| 2946 static const char* harmony_destructuring_bind_natives[] = {nullptr}; | 2936 static const char* harmony_destructuring_bind_natives[] = {nullptr}; |
| 2947 static const char* harmony_destructuring_assignment_natives[] = {nullptr}; | 2937 static const char* harmony_destructuring_assignment_natives[] = {nullptr}; |
| 2948 static const char* harmony_object_observe_natives[] = { | 2938 static const char* harmony_object_observe_natives[] = { |
| 2949 "native harmony-object-observe.js", nullptr}; | 2939 "native harmony-object-observe.js", nullptr}; |
| 2950 static const char* harmony_sharedarraybuffer_natives[] = { | 2940 static const char* harmony_sharedarraybuffer_natives[] = { |
| 2951 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 2941 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; |
| 2952 static const char* harmony_concat_spreadable_natives[] = {nullptr}; | |
| 2953 static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 2942 static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
| 2954 nullptr}; | 2943 nullptr}; |
| 2955 static const char* harmony_tolength_natives[] = {nullptr}; | |
| 2956 static const char* harmony_completion_natives[] = {nullptr}; | |
| 2957 static const char* harmony_do_expressions_natives[] = {nullptr}; | 2944 static const char* harmony_do_expressions_natives[] = {nullptr}; |
| 2958 static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 2945 static const char* harmony_regexp_subclass_natives[] = {nullptr}; |
| 2959 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 2946 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
| 2960 static const char* harmony_function_name_natives[] = {nullptr}; | 2947 static const char* harmony_function_name_natives[] = {nullptr}; |
| 2961 static const char* harmony_function_sent_natives[] = {nullptr}; | 2948 static const char* harmony_function_sent_natives[] = {nullptr}; |
| 2962 static const char* promise_extra_natives[] = {"native promise-extra.js", | 2949 static const char* promise_extra_natives[] = {"native promise-extra.js", |
| 2963 nullptr}; | 2950 nullptr}; |
| 2964 static const char* harmony_object_values_entries_natives[] = {nullptr}; | 2951 static const char* harmony_object_values_entries_natives[] = {nullptr}; |
| 2965 | 2952 |
| 2966 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2953 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 } | 3616 } |
| 3630 | 3617 |
| 3631 | 3618 |
| 3632 // Called when the top-level V8 mutex is destroyed. | 3619 // Called when the top-level V8 mutex is destroyed. |
| 3633 void Bootstrapper::FreeThreadResources() { | 3620 void Bootstrapper::FreeThreadResources() { |
| 3634 DCHECK(!IsActive()); | 3621 DCHECK(!IsActive()); |
| 3635 } | 3622 } |
| 3636 | 3623 |
| 3637 } // namespace internal | 3624 } // namespace internal |
| 3638 } // namespace v8 | 3625 } // namespace v8 |
| OLD | NEW |