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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 DONT_ENUM | DONT_DELETE | READ_ONLY); | 974 DONT_ENUM | DONT_DELETE | READ_ONLY); |
975 Handle<AccessorInfo> string_length( | 975 Handle<AccessorInfo> string_length( |
976 Accessors::StringLengthInfo(isolate, attribs)); | 976 Accessors::StringLengthInfo(isolate, attribs)); |
977 | 977 |
978 { // Add length. | 978 { // Add length. |
979 CallbacksDescriptor d(factory->length_string(), string_length, attribs); | 979 CallbacksDescriptor d(factory->length_string(), string_length, attribs); |
980 string_map->AppendDescriptor(&d); | 980 string_map->AppendDescriptor(&d); |
981 } | 981 } |
982 } | 982 } |
983 | 983 |
| 984 { |
| 985 // --- S y m b o l --- |
| 986 Handle<JSFunction> symbol_fun = InstallFunction( |
| 987 global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, |
| 988 isolate->initial_object_prototype(), Builtins::kIllegal); |
| 989 native_context()->set_symbol_function(*symbol_fun); |
| 990 } |
| 991 |
984 { // --- D a t e --- | 992 { // --- D a t e --- |
985 // Builtin functions for Date.prototype. | 993 // Builtin functions for Date.prototype. |
986 Handle<JSFunction> date_fun = | 994 Handle<JSFunction> date_fun = |
987 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, | 995 InstallFunction(global, "Date", JS_DATE_TYPE, JSDate::kSize, |
988 isolate->initial_object_prototype(), | 996 isolate->initial_object_prototype(), |
989 Builtins::kIllegal); | 997 Builtins::kIllegal); |
990 | 998 |
991 native_context()->set_date_function(*date_fun); | 999 native_context()->set_date_function(*date_fun); |
992 } | 1000 } |
993 | 1001 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 *external_map = Map::AsElementsKind(initial_map, external_kind); | 1308 *external_map = Map::AsElementsKind(initial_map, external_kind); |
1301 } | 1309 } |
1302 | 1310 |
1303 | 1311 |
1304 void Genesis::InitializeExperimentalGlobal() { | 1312 void Genesis::InitializeExperimentalGlobal() { |
1305 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); | 1313 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); |
1306 | 1314 |
1307 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1315 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
1308 // longer need to live behind flags, so functions get added to the snapshot. | 1316 // longer need to live behind flags, so functions get added to the snapshot. |
1309 | 1317 |
1310 if (FLAG_harmony_symbols) { | |
1311 // --- S y m b o l --- | |
1312 Handle<JSFunction> symbol_fun = InstallFunction( | |
1313 global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, | |
1314 isolate()->initial_object_prototype(), Builtins::kIllegal); | |
1315 native_context()->set_symbol_function(*symbol_fun); | |
1316 } | |
1317 | |
1318 if (FLAG_harmony_collections) { | 1318 if (FLAG_harmony_collections) { |
1319 // -- M a p | 1319 // -- M a p |
1320 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, | 1320 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, |
1321 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1321 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1322 // -- S e t | 1322 // -- S e t |
1323 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, | 1323 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, |
1324 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1324 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1325 { // -- S e t I t e r a t o r | 1325 { // -- S e t I t e r a t o r |
1326 Handle<JSObject> builtins(native_context()->builtins()); | 1326 Handle<JSObject> builtins(native_context()->builtins()); |
1327 Handle<JSFunction> set_iterator_function = | 1327 Handle<JSFunction> set_iterator_function = |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 to_complete_property_descriptor); | 1563 to_complete_property_descriptor); |
1564 | 1564 |
1565 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise); | 1565 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise); |
1566 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create); | 1566 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create); |
1567 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve); | 1567 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve); |
1568 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject); | 1568 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject); |
1569 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain); | 1569 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain); |
1570 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch); | 1570 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch); |
1571 INSTALL_NATIVE(JSFunction, "PromiseThen", promise_then); | 1571 INSTALL_NATIVE(JSFunction, "PromiseThen", promise_then); |
1572 | 1572 |
| 1573 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); |
| 1574 |
1573 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); | 1575 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); |
1574 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); | 1576 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); |
1575 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", | 1577 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", |
1576 observers_begin_perform_splice); | 1578 observers_begin_perform_splice); |
1577 INSTALL_NATIVE(JSFunction, "EndPerformSplice", | 1579 INSTALL_NATIVE(JSFunction, "EndPerformSplice", |
1578 observers_end_perform_splice); | 1580 observers_end_perform_splice); |
1579 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", | 1581 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", |
1580 native_object_observe); | 1582 native_object_observe); |
1581 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", | 1583 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", |
1582 native_object_get_notifier); | 1584 native_object_get_notifier); |
1583 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", | 1585 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", |
1584 native_object_notifier_perform_change); | 1586 native_object_notifier_perform_change); |
1585 } | 1587 } |
1586 | 1588 |
1587 | 1589 |
1588 void Genesis::InstallExperimentalNativeFunctions() { | 1590 void Genesis::InstallExperimentalNativeFunctions() { |
1589 if (FLAG_harmony_proxies) { | 1591 if (FLAG_harmony_proxies) { |
1590 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1592 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1591 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1593 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1592 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1594 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1593 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1595 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1594 } | 1596 } |
1595 | |
1596 if (FLAG_harmony_symbols) { | |
1597 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); | |
1598 } | |
1599 } | 1597 } |
1600 | 1598 |
1601 #undef INSTALL_NATIVE | 1599 #undef INSTALL_NATIVE |
1602 | 1600 |
1603 | 1601 |
1604 Handle<JSFunction> Genesis::InstallInternalArray( | 1602 Handle<JSFunction> Genesis::InstallInternalArray( |
1605 Handle<JSBuiltinsObject> builtins, | 1603 Handle<JSBuiltinsObject> builtins, |
1606 const char* name, | 1604 const char* name, |
1607 ElementsKind elements_kind) { | 1605 ElementsKind elements_kind) { |
1608 // --- I n t e r n a l A r r a y --- | 1606 // --- I n t e r n a l A r r a y --- |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 strcmp(ExperimentalNatives::GetScriptName(i).start(), \ | 2003 strcmp(ExperimentalNatives::GetScriptName(i).start(), \ |
2006 "native " file) == 0) { \ | 2004 "native " file) == 0) { \ |
2007 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ | 2005 if (!CompileExperimentalBuiltin(isolate(), i)) return false; \ |
2008 } | 2006 } |
2009 | 2007 |
2010 | 2008 |
2011 bool Genesis::InstallExperimentalNatives() { | 2009 bool Genesis::InstallExperimentalNatives() { |
2012 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2010 for (int i = ExperimentalNatives::GetDebuggerCount(); |
2013 i < ExperimentalNatives::GetBuiltinsCount(); | 2011 i < ExperimentalNatives::GetBuiltinsCount(); |
2014 i++) { | 2012 i++) { |
2015 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") | |
2016 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") | 2013 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") |
2017 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") | 2014 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") |
2018 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection-iterator.js") | 2015 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection-iterator.js") |
2019 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") | 2016 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") |
2020 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") | 2017 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") |
2021 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "string-iterator.js") | 2018 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "string-iterator.js") |
2022 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") | 2019 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") |
2023 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") | 2020 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") |
2024 } | 2021 } |
2025 | 2022 |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2692 return from + sizeof(NestingCounterType); | 2689 return from + sizeof(NestingCounterType); |
2693 } | 2690 } |
2694 | 2691 |
2695 | 2692 |
2696 // Called when the top-level V8 mutex is destroyed. | 2693 // Called when the top-level V8 mutex is destroyed. |
2697 void Bootstrapper::FreeThreadResources() { | 2694 void Bootstrapper::FreeThreadResources() { |
2698 ASSERT(!IsActive()); | 2695 ASSERT(!IsActive()); |
2699 } | 2696 } |
2700 | 2697 |
2701 } } // namespace v8::internal | 2698 } } // namespace v8::internal |
OLD | NEW |