Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: src/bootstrapper.cc

Issue 219303002: Revert 20313 - "Ship promises and weak collections" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "bootstrapper.h" 5 #include "bootstrapper.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "natives.h" 9 #include "natives.h"
10 #include "snapshot.h" 10 #include "snapshot.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 delete_these_arrays_on_tear_down_->Add(memory); 115 delete_these_arrays_on_tear_down_->Add(memory);
116 } 116 }
117 return memory; 117 return memory;
118 } 118 }
119 119
120 120
121 void Bootstrapper::TearDown() { 121 void Bootstrapper::TearDown() {
122 if (delete_these_non_arrays_on_tear_down_ != NULL) { 122 if (delete_these_non_arrays_on_tear_down_ != NULL) {
123 int len = delete_these_non_arrays_on_tear_down_->length(); 123 int len = delete_these_non_arrays_on_tear_down_->length();
124 ASSERT(len < 24); // Don't use this mechanism for unbounded allocations. 124 ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
125 for (int i = 0; i < len; i++) { 125 for (int i = 0; i < len; i++) {
126 delete delete_these_non_arrays_on_tear_down_->at(i); 126 delete delete_these_non_arrays_on_tear_down_->at(i);
127 delete_these_non_arrays_on_tear_down_->at(i) = NULL; 127 delete_these_non_arrays_on_tear_down_->at(i) = NULL;
128 } 128 }
129 delete delete_these_non_arrays_on_tear_down_; 129 delete delete_these_non_arrays_on_tear_down_;
130 delete_these_non_arrays_on_tear_down_ = NULL; 130 delete_these_non_arrays_on_tear_down_ = NULL;
131 } 131 }
132 132
133 if (delete_these_arrays_on_tear_down_ != NULL) { 133 if (delete_these_arrays_on_tear_down_ != NULL) {
134 int len = delete_these_arrays_on_tear_down_->length(); 134 int len = delete_these_arrays_on_tear_down_->length();
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1074
1075 Handle<JSFunction> data_view_fun = 1075 Handle<JSFunction> data_view_fun =
1076 InstallFunction( 1076 InstallFunction(
1077 global, "DataView", JS_DATA_VIEW_TYPE, 1077 global, "DataView", JS_DATA_VIEW_TYPE,
1078 JSDataView::kSizeWithInternalFields, 1078 JSDataView::kSizeWithInternalFields,
1079 isolate->initial_object_prototype(), 1079 isolate->initial_object_prototype(),
1080 Builtins::kIllegal, true, true); 1080 Builtins::kIllegal, true, true);
1081 native_context()->set_data_view_fun(*data_view_fun); 1081 native_context()->set_data_view_fun(*data_view_fun);
1082 } 1082 }
1083 1083
1084 { // -- W e a k M a p
1085 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1086 isolate->initial_object_prototype(),
1087 Builtins::kIllegal, true, true);
1088 }
1089
1090 { // -- W e a k S e t
1091 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1092 isolate->initial_object_prototype(),
1093 Builtins::kIllegal, true, true);
1094 }
1095
1096 { // --- arguments_boilerplate_ 1084 { // --- arguments_boilerplate_
1097 // Make sure we can recognize argument objects at runtime. 1085 // Make sure we can recognize argument objects at runtime.
1098 // This is done by introducing an anonymous function with 1086 // This is done by introducing an anonymous function with
1099 // class_name equals 'Arguments'. 1087 // class_name equals 'Arguments'.
1100 Handle<String> arguments_string = factory->InternalizeOneByteString( 1088 Handle<String> arguments_string = factory->InternalizeOneByteString(
1101 STATIC_ASCII_VECTOR("Arguments")); 1089 STATIC_ASCII_VECTOR("Arguments"));
1102 Handle<Code> code = Handle<Code>( 1090 Handle<Code> code = Handle<Code>(
1103 isolate->builtins()->builtin(Builtins::kIllegal)); 1091 isolate->builtins()->builtin(Builtins::kIllegal));
1104 Handle<JSObject> prototype = 1092 Handle<JSObject> prototype =
1105 Handle<JSObject>( 1093 Handle<JSObject>(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 isolate()->initial_object_prototype(), 1321 isolate()->initial_object_prototype(),
1334 Builtins::kIllegal, true, true); 1322 Builtins::kIllegal, true, true);
1335 } 1323 }
1336 { // -- S e t 1324 { // -- S e t
1337 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, 1325 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize,
1338 isolate()->initial_object_prototype(), 1326 isolate()->initial_object_prototype(),
1339 Builtins::kIllegal, true, true); 1327 Builtins::kIllegal, true, true);
1340 } 1328 }
1341 } 1329 }
1342 1330
1331 if (FLAG_harmony_weak_collections) {
1332 { // -- W e a k M a p
1333 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1334 isolate()->initial_object_prototype(),
1335 Builtins::kIllegal, true, true);
1336 }
1337 { // -- W e a k S e t
1338 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1339 isolate()->initial_object_prototype(),
1340 Builtins::kIllegal, true, true);
1341 }
1342 }
1343
1343 if (FLAG_harmony_generators) { 1344 if (FLAG_harmony_generators) {
1344 // Create generator meta-objects and install them on the builtins object. 1345 // Create generator meta-objects and install them on the builtins object.
1345 Handle<JSObject> builtins(native_context()->builtins()); 1346 Handle<JSObject> builtins(native_context()->builtins());
1346 Handle<JSObject> generator_object_prototype = 1347 Handle<JSObject> generator_object_prototype =
1347 factory()->NewJSObject(isolate()->object_function(), TENURED); 1348 factory()->NewJSObject(isolate()->object_function(), TENURED);
1348 Handle<JSFunction> generator_function_prototype = 1349 Handle<JSFunction> generator_function_prototype =
1349 InstallFunction(builtins, "GeneratorFunctionPrototype", 1350 InstallFunction(builtins, "GeneratorFunctionPrototype",
1350 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 1351 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
1351 generator_object_prototype, Builtins::kIllegal, 1352 generator_object_prototype, Builtins::kIllegal,
1352 false, false); 1353 false, false);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ 1528 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \
1528 Object* var##_native = \ 1529 Object* var##_native = \
1529 native_context()->builtins()->GetPropertyNoExceptionThrown( \ 1530 native_context()->builtins()->GetPropertyNoExceptionThrown( \
1530 *var##_name); \ 1531 *var##_name); \
1531 native_context()->set_##var(Type::cast(var##_native)); 1532 native_context()->set_##var(Type::cast(var##_native));
1532 1533
1533 1534
1534 void Genesis::InstallNativeFunctions() { 1535 void Genesis::InstallNativeFunctions() {
1535 HandleScope scope(isolate()); 1536 HandleScope scope(isolate());
1536 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); 1537 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1537
1538 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); 1538 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1539 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); 1539 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1540 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); 1540 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1541 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); 1541 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1542 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); 1542 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1543 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1543 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1544 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); 1544 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1545
1546 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); 1545 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1547 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); 1546 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
1548 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", 1547 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
1549 configure_instance_fun); 1548 configure_instance_fun);
1550 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); 1549 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1551 INSTALL_NATIVE(JSObject, "functionCache", function_cache); 1550 INSTALL_NATIVE(JSObject, "functionCache", function_cache);
1552 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", 1551 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
1553 to_complete_property_descriptor); 1552 to_complete_property_descriptor);
1554
1555 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1556 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1557 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1558 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1559 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1560 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1561
1562 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); 1553 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
1563 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); 1554 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
1564 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", 1555 INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
1565 observers_begin_perform_splice); 1556 observers_begin_perform_splice);
1566 INSTALL_NATIVE(JSFunction, "EndPerformSplice", 1557 INSTALL_NATIVE(JSFunction, "EndPerformSplice",
1567 observers_end_perform_splice); 1558 observers_end_perform_splice);
1568 } 1559 }
1569 1560
1570 1561
1571 void Genesis::InstallExperimentalNativeFunctions() { 1562 void Genesis::InstallExperimentalNativeFunctions() {
1572 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); 1563 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
1573 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", 1564 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask",
1574 enqueue_external_microtask); 1565 enqueue_external_microtask);
1575 1566
1567 if (FLAG_harmony_promises) {
1568 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1569 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1570 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1571 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1572 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1573 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1574 }
1575
1576 if (FLAG_harmony_proxies) { 1576 if (FLAG_harmony_proxies) {
1577 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); 1577 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
1578 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); 1578 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
1579 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); 1579 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
1580 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); 1580 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
1581 } 1581 }
1582 } 1582 }
1583 1583
1584 #undef INSTALL_NATIVE 1584 #undef INSTALL_NATIVE
1585 1585
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 } 2015 }
2016 2016
2017 2017
2018 bool Genesis::InstallExperimentalNatives() { 2018 bool Genesis::InstallExperimentalNatives() {
2019 for (int i = ExperimentalNatives::GetDebuggerCount(); 2019 for (int i = ExperimentalNatives::GetDebuggerCount();
2020 i < ExperimentalNatives::GetBuiltinsCount(); 2020 i < ExperimentalNatives::GetBuiltinsCount();
2021 i++) { 2021 i++) {
2022 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") 2022 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
2023 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") 2023 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
2024 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") 2024 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
2025 INSTALL_EXPERIMENTAL_NATIVE(i, weak_collections, "weak_collection.js")
2026 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
2025 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") 2027 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
2026 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") 2028 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
2027 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") 2029 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
2028 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") 2030 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
2029 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") 2031 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js")
2030 } 2032 }
2031 2033
2032 InstallExperimentalNativeFunctions(); 2034 InstallExperimentalNativeFunctions();
2033 InstallExperimentalBuiltinFunctionIds(); 2035 InstallExperimentalBuiltinFunctionIds();
2034 return true; 2036 return true;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 return from + sizeof(NestingCounterType); 2722 return from + sizeof(NestingCounterType);
2721 } 2723 }
2722 2724
2723 2725
2724 // Called when the top-level V8 mutex is destroyed. 2726 // Called when the top-level V8 mutex is destroyed.
2725 void Bootstrapper::FreeThreadResources() { 2727 void Bootstrapper::FreeThreadResources() {
2726 ASSERT(!IsActive()); 2728 ASSERT(!IsActive());
2727 } 2729 }
2728 2730
2729 } } // namespace v8::internal 2731 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698