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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 // Set up the call-as-constructor delegate. | 1335 // Set up the call-as-constructor delegate. |
1336 Handle<Code> code = | 1336 Handle<Code> code = |
1337 Handle<Code>(isolate->builtins()->builtin( | 1337 Handle<Code>(isolate->builtins()->builtin( |
1338 Builtins::kHandleApiCallAsConstructor)); | 1338 Builtins::kHandleApiCallAsConstructor)); |
1339 Handle<JSFunction> delegate = factory->NewFunction( | 1339 Handle<JSFunction> delegate = factory->NewFunction( |
1340 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 1340 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
1341 native_context()->set_call_as_constructor_delegate(*delegate); | 1341 native_context()->set_call_as_constructor_delegate(*delegate); |
1342 delegate->shared()->DontAdaptArguments(); | 1342 delegate->shared()->DontAdaptArguments(); |
1343 } | 1343 } |
1344 | 1344 |
| 1345 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
| 1346 |
| 1347 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
| 1348 #undef FEATURE_INITIALIZE_GLOBAL |
| 1349 |
1345 // Initialize the embedder data slot. | 1350 // Initialize the embedder data slot. |
1346 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1351 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
1347 native_context()->set_embedder_data(*embedder_data); | 1352 native_context()->set_embedder_data(*embedder_data); |
1348 } | 1353 } |
1349 | 1354 |
1350 | 1355 |
1351 void Genesis::InstallTypedArray( | 1356 void Genesis::InstallTypedArray( |
1352 const char* name, | 1357 const char* name, |
1353 ElementsKind elements_kind, | 1358 ElementsKind elements_kind, |
1354 Handle<JSFunction>* fun, | 1359 Handle<JSFunction>* fun, |
(...skipping 14 matching lines...) Expand all Loading... |
1369 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); | 1374 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); |
1370 *external_map = Map::AsElementsKind(initial_map, external_kind); | 1375 *external_map = Map::AsElementsKind(initial_map, external_kind); |
1371 } | 1376 } |
1372 | 1377 |
1373 | 1378 |
1374 void Genesis::InitializeExperimentalGlobal() { | 1379 void Genesis::InitializeExperimentalGlobal() { |
1375 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1380 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1376 | 1381 |
1377 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) | 1382 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
1378 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) | 1383 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
1379 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) | |
1380 #undef FEATURE_INITIALIZE_GLOBAL | 1384 #undef FEATURE_INITIALIZE_GLOBAL |
1381 } | 1385 } |
1382 | 1386 |
1383 | 1387 |
1384 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1388 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
1385 Vector<const char> name = Natives::GetScriptName(index); | 1389 Vector<const char> name = Natives::GetScriptName(index); |
1386 Handle<String> source_code = | 1390 Handle<String> source_code = |
1387 isolate->bootstrapper()->NativesSourceLookup(index); | 1391 isolate->bootstrapper()->NativesSourceLookup(index); |
1388 return CompileNative(isolate, name, source_code); | 1392 return CompileNative(isolate, name, source_code); |
1389 } | 1393 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 observers_begin_perform_splice); | 1553 observers_begin_perform_splice); |
1550 INSTALL_NATIVE(JSFunction, "EndPerformSplice", | 1554 INSTALL_NATIVE(JSFunction, "EndPerformSplice", |
1551 observers_end_perform_splice); | 1555 observers_end_perform_splice); |
1552 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", | 1556 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", |
1553 native_object_observe); | 1557 native_object_observe); |
1554 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", | 1558 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", |
1555 native_object_get_notifier); | 1559 native_object_get_notifier); |
1556 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", | 1560 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", |
1557 native_object_notifier_perform_change); | 1561 native_object_notifier_perform_change); |
1558 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); | 1562 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); |
| 1563 |
| 1564 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); |
| 1565 HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR) |
| 1566 #undef INSTALL_NATIVE_FUNCTIONS_FOR |
1559 } | 1567 } |
1560 | 1568 |
1561 | 1569 |
1562 void Genesis::InstallExperimentalNativeFunctions() { | 1570 void Genesis::InstallExperimentalNativeFunctions() { |
1563 if (FLAG_harmony_proxies) { | 1571 if (FLAG_harmony_proxies) { |
1564 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1572 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1565 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1573 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1566 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1574 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1567 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1575 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1568 } | 1576 } |
1569 | 1577 |
1570 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); | 1578 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); |
1571 HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR) | 1579 HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR) |
1572 HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR) | 1580 HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR) |
1573 HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR) | |
1574 #undef INSTALL_NATIVE_FUNCTIONS_FOR | 1581 #undef INSTALL_NATIVE_FUNCTIONS_FOR |
1575 } | 1582 } |
1576 | 1583 |
1577 | 1584 |
1578 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \ | 1585 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \ |
1579 void Genesis::InstallNativeFunctions_##id() {} | 1586 void Genesis::InstallNativeFunctions_##id() {} |
1580 | 1587 |
1581 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping) | 1588 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping) |
1582 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules) | 1589 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules) |
1583 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings) | 1590 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings) |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2188 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
2182 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2189 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
2183 if (FLAG_##id) { \ | 2190 if (FLAG_##id) { \ |
2184 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2191 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
2185 if (strcmp(ExperimentalNatives::GetScriptName(i).start(), \ | 2192 if (strcmp(ExperimentalNatives::GetScriptName(i).start(), \ |
2186 id##_natives[j]) == 0) { \ | 2193 id##_natives[j]) == 0) { \ |
2187 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2194 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
2188 } \ | 2195 } \ |
2189 } \ | 2196 } \ |
2190 } | 2197 } |
| 2198 // Iterate over flags that are not enabled by default. |
2191 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); | 2199 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
2192 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); | 2200 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
2193 HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); | |
2194 #undef INSTALL_EXPERIMENTAL_NATIVES | 2201 #undef INSTALL_EXPERIMENTAL_NATIVES |
2195 } | 2202 } |
2196 | 2203 |
| 2204 #define USE_NATIVES_FOR_FEATURE(id, descr) USE(id##_natives); |
| 2205 HARMONY_SHIPPING(USE_NATIVES_FOR_FEATURE) |
| 2206 #undef USE_NATIVES_FOR_FEATURE |
| 2207 |
2197 InstallExperimentalNativeFunctions(); | 2208 InstallExperimentalNativeFunctions(); |
2198 return true; | 2209 return true; |
2199 } | 2210 } |
2200 | 2211 |
2201 | 2212 |
2202 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 2213 static void InstallBuiltinFunctionId(Handle<JSObject> holder, |
2203 const char* function_name, | 2214 const char* function_name, |
2204 BuiltinFunctionId id) { | 2215 BuiltinFunctionId id) { |
2205 Isolate* isolate = holder->GetIsolate(); | 2216 Isolate* isolate = holder->GetIsolate(); |
2206 Handle<Object> function_object = | 2217 Handle<Object> function_object = |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 return from + sizeof(NestingCounterType); | 2834 return from + sizeof(NestingCounterType); |
2824 } | 2835 } |
2825 | 2836 |
2826 | 2837 |
2827 // Called when the top-level V8 mutex is destroyed. | 2838 // Called when the top-level V8 mutex is destroyed. |
2828 void Bootstrapper::FreeThreadResources() { | 2839 void Bootstrapper::FreeThreadResources() { |
2829 DCHECK(!IsActive()); | 2840 DCHECK(!IsActive()); |
2830 } | 2841 } |
2831 | 2842 |
2832 } } // namespace v8::internal | 2843 } } // namespace v8::internal |
OLD | NEW |