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

Side by Side Diff: src/bootstrapper.cc

Issue 266243003: Re^3-land "Ship promises and weak collections" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 < 20); // Don't use this mechanism for unbounded allocations. 124 ASSERT(len < 24); // 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1071
1072 Handle<JSFunction> data_view_fun = 1072 Handle<JSFunction> data_view_fun =
1073 InstallFunction( 1073 InstallFunction(
1074 global, "DataView", JS_DATA_VIEW_TYPE, 1074 global, "DataView", JS_DATA_VIEW_TYPE,
1075 JSDataView::kSizeWithInternalFields, 1075 JSDataView::kSizeWithInternalFields,
1076 isolate->initial_object_prototype(), 1076 isolate->initial_object_prototype(),
1077 Builtins::kIllegal, true, true); 1077 Builtins::kIllegal, true, true);
1078 native_context()->set_data_view_fun(*data_view_fun); 1078 native_context()->set_data_view_fun(*data_view_fun);
1079 } 1079 }
1080 1080
1081 { // -- W e a k M a p
1082 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1083 isolate->initial_object_prototype(),
1084 Builtins::kIllegal, true, true);
1085 }
1086
1087 { // -- W e a k S e t
1088 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1089 isolate->initial_object_prototype(),
1090 Builtins::kIllegal, true, true);
1091 }
1092
1081 { // --- arguments_boilerplate_ 1093 { // --- arguments_boilerplate_
1082 // Make sure we can recognize argument objects at runtime. 1094 // Make sure we can recognize argument objects at runtime.
1083 // This is done by introducing an anonymous function with 1095 // This is done by introducing an anonymous function with
1084 // class_name equals 'Arguments'. 1096 // class_name equals 'Arguments'.
1085 Handle<String> arguments_string = factory->InternalizeOneByteString( 1097 Handle<String> arguments_string = factory->InternalizeOneByteString(
1086 STATIC_ASCII_VECTOR("Arguments")); 1098 STATIC_ASCII_VECTOR("Arguments"));
1087 Handle<Code> code(isolate->builtins()->builtin(Builtins::kIllegal)); 1099 Handle<Code> code(isolate->builtins()->builtin(Builtins::kIllegal));
1088 Handle<JSObject> prototype( 1100 Handle<JSObject> prototype(
1089 JSObject::cast(native_context()->object_function()->prototype())); 1101 JSObject::cast(native_context()->object_function()->prototype()));
1090 1102
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 JS_SET_ITERATOR_TYPE, JSSetIterator::kSize); 1341 JS_SET_ITERATOR_TYPE, JSSetIterator::kSize);
1330 native_context()->set_set_iterator_map(*map); 1342 native_context()->set_set_iterator_map(*map);
1331 } 1343 }
1332 { // -- M a p I t e r a t o r 1344 { // -- M a p I t e r a t o r
1333 Handle<Map> map = isolate()->factory()->NewMap( 1345 Handle<Map> map = isolate()->factory()->NewMap(
1334 JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize); 1346 JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize);
1335 native_context()->set_map_iterator_map(*map); 1347 native_context()->set_map_iterator_map(*map);
1336 } 1348 }
1337 } 1349 }
1338 1350
1339 if (FLAG_harmony_weak_collections) {
1340 { // -- W e a k M a p
1341 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1342 isolate()->initial_object_prototype(),
1343 Builtins::kIllegal, true, true);
1344 }
1345 { // -- W e a k S e t
1346 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1347 isolate()->initial_object_prototype(),
1348 Builtins::kIllegal, true, true);
1349 }
1350 }
1351
1352 if (FLAG_harmony_generators) { 1351 if (FLAG_harmony_generators) {
1353 // Create generator meta-objects and install them on the builtins object. 1352 // Create generator meta-objects and install them on the builtins object.
1354 Handle<JSObject> builtins(native_context()->builtins()); 1353 Handle<JSObject> builtins(native_context()->builtins());
1355 Handle<JSObject> generator_object_prototype = 1354 Handle<JSObject> generator_object_prototype =
1356 factory()->NewJSObject(isolate()->object_function(), TENURED); 1355 factory()->NewJSObject(isolate()->object_function(), TENURED);
1357 Handle<JSFunction> generator_function_prototype = 1356 Handle<JSFunction> generator_function_prototype =
1358 InstallFunction(builtins, "GeneratorFunctionPrototype", 1357 InstallFunction(builtins, "GeneratorFunctionPrototype",
1359 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 1358 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
1360 generator_object_prototype, Builtins::kIllegal, 1359 generator_object_prototype, Builtins::kIllegal,
1361 false, false); 1360 false, false);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 Handle<String> var##_name = \ 1528 Handle<String> var##_name = \
1530 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ 1529 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \
1531 Handle<Object> var##_native = Object::GetProperty( \ 1530 Handle<Object> var##_native = Object::GetProperty( \
1532 handle(native_context()->builtins()), var##_name).ToHandleChecked(); \ 1531 handle(native_context()->builtins()), var##_name).ToHandleChecked(); \
1533 native_context()->set_##var(Type::cast(*var##_native)); 1532 native_context()->set_##var(Type::cast(*var##_native));
1534 1533
1535 1534
1536 void Genesis::InstallNativeFunctions() { 1535 void Genesis::InstallNativeFunctions() {
1537 HandleScope scope(isolate()); 1536 HandleScope scope(isolate());
1538 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); 1537 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1538
1539 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); 1539 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1540 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); 1540 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1541 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); 1541 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1542 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); 1542 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1543 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); 1543 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1544 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1544 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1545 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); 1545 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1546
1546 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); 1547 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1547 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); 1548 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
1548 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", 1549 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
1549 configure_instance_fun); 1550 configure_instance_fun);
1550 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); 1551 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1551 INSTALL_NATIVE(JSObject, "functionCache", function_cache); 1552 INSTALL_NATIVE(JSObject, "functionCache", function_cache);
1552 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", 1553 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
1553 to_complete_property_descriptor); 1554 to_complete_property_descriptor);
1555
1556 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1557 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1558 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1559 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1560 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1561 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1562
1554 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); 1563 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
1555 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); 1564 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
1556 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", 1565 INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
1557 observers_begin_perform_splice); 1566 observers_begin_perform_splice);
1558 INSTALL_NATIVE(JSFunction, "EndPerformSplice", 1567 INSTALL_NATIVE(JSFunction, "EndPerformSplice",
1559 observers_end_perform_splice); 1568 observers_end_perform_splice);
1560 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", 1569 INSTALL_NATIVE(JSFunction, "NativeObjectObserve",
1561 native_object_observe); 1570 native_object_observe);
1562 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", 1571 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier",
1563 native_object_get_notifier); 1572 native_object_get_notifier);
1564 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", 1573 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange",
1565 native_object_notifier_perform_change); 1574 native_object_notifier_perform_change);
1566 } 1575 }
1567 1576
1568 1577
1569 void Genesis::InstallExperimentalNativeFunctions() { 1578 void Genesis::InstallExperimentalNativeFunctions() {
1570 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); 1579 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
1571 INSTALL_NATIVE(JSFunction, "EnqueueMicrotask", enqueue_microtask); 1580 INSTALL_NATIVE(JSFunction, "EnqueueMicrotask", enqueue_microtask);
1572 1581
1573 if (FLAG_harmony_promises) {
1574 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1575 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1576 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1577 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1578 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1579 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1580 }
1581
1582 if (FLAG_harmony_proxies) { 1582 if (FLAG_harmony_proxies) {
1583 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); 1583 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
1584 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); 1584 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
1585 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); 1585 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
1586 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); 1586 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
1587 } 1587 }
1588 } 1588 }
1589 1589
1590 #undef INSTALL_NATIVE 1590 #undef INSTALL_NATIVE
1591 1591
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 } 1992 }
1993 1993
1994 1994
1995 bool Genesis::InstallExperimentalNatives() { 1995 bool Genesis::InstallExperimentalNatives() {
1996 for (int i = ExperimentalNatives::GetDebuggerCount(); 1996 for (int i = ExperimentalNatives::GetDebuggerCount();
1997 i < ExperimentalNatives::GetBuiltinsCount(); 1997 i < ExperimentalNatives::GetBuiltinsCount();
1998 i++) { 1998 i++) {
1999 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") 1999 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
2000 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") 2000 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
2001 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") 2001 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
2002 INSTALL_EXPERIMENTAL_NATIVE(i, weak_collections, "weak_collection.js")
2003 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
2004 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") 2002 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
2005 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") 2003 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
2006 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") 2004 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
2007 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") 2005 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
2008 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") 2006 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js")
2009 } 2007 }
2010 2008
2011 InstallExperimentalNativeFunctions(); 2009 InstallExperimentalNativeFunctions();
2012 InstallExperimentalBuiltinFunctionIds(); 2010 InstallExperimentalBuiltinFunctionIds();
2013 return true; 2011 return true;
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 return from + sizeof(NestingCounterType); 2696 return from + sizeof(NestingCounterType);
2699 } 2697 }
2700 2698
2701 2699
2702 // Called when the top-level V8 mutex is destroyed. 2700 // Called when the top-level V8 mutex is destroyed.
2703 void Bootstrapper::FreeThreadResources() { 2701 void Bootstrapper::FreeThreadResources() {
2704 ASSERT(!IsActive()); 2702 ASSERT(!IsActive());
2705 } 2703 }
2706 2704
2707 } } // namespace v8::internal 2705 } } // 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