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