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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void InitializeExperimentalGlobal(); | 208 void InitializeExperimentalGlobal(); |
209 // Installs the contents of the native .js files on the global objects. | 209 // Installs the contents of the native .js files on the global objects. |
210 // Used for creating a context from scratch. | 210 // Used for creating a context from scratch. |
211 void InstallNativeFunctions(); | 211 void InstallNativeFunctions(); |
212 void InstallExperimentalNativeFunctions(); | 212 void InstallExperimentalNativeFunctions(); |
213 | 213 |
214 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ | 214 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ |
215 void InstallNativeFunctions_##id(); \ | 215 void InstallNativeFunctions_##id(); \ |
216 void InitializeGlobal_##id(); | 216 void InitializeGlobal_##id(); |
217 | 217 |
218 SHIPPING_FEATURES(DECLARE_FEATURE_INITIALIZATION) | 218 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) |
219 HARMONY_FEATURES(DECLARE_FEATURE_INITIALIZATION) | 219 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) |
220 STAGED_FEATURES(DECLARE_FEATURE_INITIALIZATION) | 220 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) |
221 | |
222 DECLARE_FEATURE_INITIALIZATION(harmony_proxies, "") | |
223 #undef DECLARE_FEATURE_INITIALIZATION | 221 #undef DECLARE_FEATURE_INITIALIZATION |
224 | 222 |
225 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, | 223 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, |
226 const char* name, | 224 const char* name, |
227 ElementsKind elements_kind); | 225 ElementsKind elements_kind); |
228 bool InstallNatives(); | 226 bool InstallNatives(); |
229 | 227 |
230 void InstallTypedArray( | 228 void InstallTypedArray( |
231 const char* name, | 229 const char* name, |
232 ElementsKind elements_kind, | 230 ElementsKind elements_kind, |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 Handle<Code>(isolate->builtins()->builtin( | 1335 Handle<Code>(isolate->builtins()->builtin( |
1338 Builtins::kHandleApiCallAsConstructor)); | 1336 Builtins::kHandleApiCallAsConstructor)); |
1339 Handle<JSFunction> delegate = factory->NewFunction( | 1337 Handle<JSFunction> delegate = factory->NewFunction( |
1340 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 1338 factory->empty_string(), code, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
1341 native_context()->set_call_as_constructor_delegate(*delegate); | 1339 native_context()->set_call_as_constructor_delegate(*delegate); |
1342 delegate->shared()->DontAdaptArguments(); | 1340 delegate->shared()->DontAdaptArguments(); |
1343 } | 1341 } |
1344 | 1342 |
1345 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1343 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1346 | 1344 |
1347 SHIPPING_FEATURES(FEATURE_INITIALIZE_GLOBAL) | 1345 HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) |
1348 #undef FEATURE_INITIALIZE_GLOBAL | 1346 #undef FEATURE_INITIALIZE_GLOBAL |
1349 | 1347 |
1350 // Initialize the embedder data slot. | 1348 // Initialize the embedder data slot. |
1351 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1349 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
1352 native_context()->set_embedder_data(*embedder_data); | 1350 native_context()->set_embedder_data(*embedder_data); |
1353 } | 1351 } |
1354 | 1352 |
1355 | 1353 |
1356 void Genesis::InstallTypedArray( | 1354 void Genesis::InstallTypedArray( |
1357 const char* name, | 1355 const char* name, |
(...skipping 14 matching lines...) Expand all Loading... |
1372 *fun = result; | 1370 *fun = result; |
1373 | 1371 |
1374 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); | 1372 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); |
1375 *external_map = Map::AsElementsKind(initial_map, external_kind); | 1373 *external_map = Map::AsElementsKind(initial_map, external_kind); |
1376 } | 1374 } |
1377 | 1375 |
1378 | 1376 |
1379 void Genesis::InitializeExperimentalGlobal() { | 1377 void Genesis::InitializeExperimentalGlobal() { |
1380 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); | 1378 #define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id(); |
1381 | 1379 |
1382 HARMONY_FEATURES(FEATURE_INITIALIZE_GLOBAL) | 1380 HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) |
1383 STAGED_FEATURES(FEATURE_INITIALIZE_GLOBAL) | 1381 HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) |
1384 #undef FEATURE_INITIALIZE_GLOBAL | 1382 #undef FEATURE_INITIALIZE_GLOBAL |
1385 } | 1383 } |
1386 | 1384 |
1387 | 1385 |
1388 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1386 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
1389 Vector<const char> name = Natives::GetScriptName(index); | 1387 Vector<const char> name = Natives::GetScriptName(index); |
1390 Handle<String> source_code = | 1388 Handle<String> source_code = |
1391 isolate->bootstrapper()->NativesSourceLookup(index); | 1389 isolate->bootstrapper()->NativesSourceLookup(index); |
1392 return CompileNative(isolate, name, source_code); | 1390 return CompileNative(isolate, name, source_code); |
1393 } | 1391 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", | 1556 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", |
1559 native_object_get_notifier); | 1557 native_object_get_notifier); |
1560 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", | 1558 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", |
1561 native_object_notifier_perform_change); | 1559 native_object_notifier_perform_change); |
1562 | 1560 |
1563 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); | 1561 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); |
1564 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); | 1562 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); |
1565 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); | 1563 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); |
1566 | 1564 |
1567 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); | 1565 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); |
1568 | 1566 HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR) |
1569 SHIPPING_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) | |
1570 #undef INSTALL_NATIVE_FUNCTIONS_FOR | 1567 #undef INSTALL_NATIVE_FUNCTIONS_FOR |
1571 } | 1568 } |
1572 | 1569 |
1573 | 1570 |
1574 void Genesis::InstallExperimentalNativeFunctions() { | 1571 void Genesis::InstallExperimentalNativeFunctions() { |
1575 if (FLAG_harmony_proxies) { | 1572 if (FLAG_harmony_proxies) { |
1576 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1573 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1577 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1574 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1578 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1575 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1579 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1576 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1580 } | 1577 } |
1581 | 1578 |
1582 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); | 1579 #define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id(); |
1583 | 1580 HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR) |
1584 HARMONY_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) | 1581 HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR) |
1585 STAGED_FEATURES(INSTALL_NATIVE_FUNCTIONS_FOR) | |
1586 INSTALL_NATIVE_FUNCTIONS_FOR(harmony_proxies, "") | |
1587 #undef INSTALL_NATIVE_FUNCTIONS_FOR | 1582 #undef INSTALL_NATIVE_FUNCTIONS_FOR |
1588 } | 1583 } |
1589 | 1584 |
1590 | 1585 |
1591 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \ | 1586 #define EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(id) \ |
1592 void Genesis::InstallNativeFunctions_##id() {} | 1587 void Genesis::InstallNativeFunctions_##id() {} |
1593 | 1588 |
1594 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping) | 1589 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_scoping) |
1595 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules) | 1590 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_modules) |
1596 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings) | 1591 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_strings) |
(...skipping 22 matching lines...) Expand all Loading... |
1619 | 1614 |
1620 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_scoping) | 1615 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_scoping) |
1621 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) | 1616 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_modules) |
1622 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_strings) | 1617 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_strings) |
1623 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays) | 1618 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrays) |
1624 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) | 1619 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) |
1625 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) | 1620 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) |
1626 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) | 1621 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) |
1627 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals) | 1622 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals) |
1628 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) | 1623 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) |
| 1624 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) |
1629 | 1625 |
1630 void Genesis::InitializeGlobal_harmony_regexps() { | 1626 void Genesis::InitializeGlobal_harmony_regexps() { |
1631 Handle<JSObject> builtins(native_context()->builtins()); | 1627 Handle<JSObject> builtins(native_context()->builtins()); |
1632 | 1628 |
1633 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() | 1629 Handle<HeapObject> flag(FLAG_harmony_regexps ? heap()->true_value() |
1634 : heap()->false_value()); | 1630 : heap()->false_value()); |
1635 PropertyAttributes attributes = | 1631 PropertyAttributes attributes = |
1636 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); | 1632 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
1637 Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(), | 1633 Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(), |
1638 flag, attributes).Assert(); | 1634 flag, attributes).Assert(); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 i < ExperimentalNatives::GetBuiltinsCount(); i++) { | 2169 i < ExperimentalNatives::GetBuiltinsCount(); i++) { |
2174 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ | 2170 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ |
2175 if (FLAG_##id) { \ | 2171 if (FLAG_##id) { \ |
2176 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ | 2172 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ |
2177 if (strcmp(ExperimentalNatives::GetScriptName(i).start(), \ | 2173 if (strcmp(ExperimentalNatives::GetScriptName(i).start(), \ |
2178 id##_natives[j]) == 0) { \ | 2174 id##_natives[j]) == 0) { \ |
2179 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2175 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
2180 } \ | 2176 } \ |
2181 } \ | 2177 } \ |
2182 } | 2178 } |
2183 INSTALL_EXPERIMENTAL_NATIVES(harmony_proxies, ""); | |
2184 // Iterate over flags that are not enabled by default. | 2179 // Iterate over flags that are not enabled by default. |
2185 HARMONY_FEATURES(INSTALL_EXPERIMENTAL_NATIVES); | 2180 HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); |
2186 STAGED_FEATURES(INSTALL_EXPERIMENTAL_NATIVES); | 2181 HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); |
2187 #undef INSTALL_EXPERIMENTAL_NATIVES | 2182 #undef INSTALL_EXPERIMENTAL_NATIVES |
2188 } | 2183 } |
2189 | 2184 |
2190 #define USE_NATIVES_FOR_FEATURE(id, descr) USE(id##_natives); | 2185 #define USE_NATIVES_FOR_FEATURE(id, descr) USE(id##_natives); |
2191 | 2186 HARMONY_SHIPPING(USE_NATIVES_FOR_FEATURE) |
2192 SHIPPING_FEATURES(USE_NATIVES_FOR_FEATURE) | |
2193 #undef USE_NATIVES_FOR_FEATURE | 2187 #undef USE_NATIVES_FOR_FEATURE |
2194 | 2188 |
2195 InstallExperimentalNativeFunctions(); | 2189 InstallExperimentalNativeFunctions(); |
2196 return true; | 2190 return true; |
2197 } | 2191 } |
2198 | 2192 |
2199 | 2193 |
2200 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 2194 static void InstallBuiltinFunctionId(Handle<JSObject> holder, |
2201 const char* function_name, | 2195 const char* function_name, |
2202 BuiltinFunctionId id) { | 2196 BuiltinFunctionId id) { |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 return from + sizeof(NestingCounterType); | 2810 return from + sizeof(NestingCounterType); |
2817 } | 2811 } |
2818 | 2812 |
2819 | 2813 |
2820 // Called when the top-level V8 mutex is destroyed. | 2814 // Called when the top-level V8 mutex is destroyed. |
2821 void Bootstrapper::FreeThreadResources() { | 2815 void Bootstrapper::FreeThreadResources() { |
2822 DCHECK(!IsActive()); | 2816 DCHECK(!IsActive()); |
2823 } | 2817 } |
2824 | 2818 |
2825 } } // namespace v8::internal | 2819 } } // namespace v8::internal |
OLD | NEW |