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

Side by Side Diff: src/bootstrapper.cc

Issue 210993002: Merged r20233 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 delete_these_arrays_on_tear_down_->Add(memory); 146 delete_these_arrays_on_tear_down_->Add(memory);
147 } 147 }
148 return memory; 148 return memory;
149 } 149 }
150 150
151 151
152 void Bootstrapper::TearDown() { 152 void Bootstrapper::TearDown() {
153 if (delete_these_non_arrays_on_tear_down_ != NULL) { 153 if (delete_these_non_arrays_on_tear_down_ != NULL) {
154 int len = delete_these_non_arrays_on_tear_down_->length(); 154 int len = delete_these_non_arrays_on_tear_down_->length();
155 ASSERT(len < 24); // Don't use this mechanism for unbounded allocations. 155 ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
156 for (int i = 0; i < len; i++) { 156 for (int i = 0; i < len; i++) {
157 delete delete_these_non_arrays_on_tear_down_->at(i); 157 delete delete_these_non_arrays_on_tear_down_->at(i);
158 delete_these_non_arrays_on_tear_down_->at(i) = NULL; 158 delete_these_non_arrays_on_tear_down_->at(i) = NULL;
159 } 159 }
160 delete delete_these_non_arrays_on_tear_down_; 160 delete delete_these_non_arrays_on_tear_down_;
161 delete_these_non_arrays_on_tear_down_ = NULL; 161 delete_these_non_arrays_on_tear_down_ = NULL;
162 } 162 }
163 163
164 if (delete_these_arrays_on_tear_down_ != NULL) { 164 if (delete_these_arrays_on_tear_down_ != NULL) {
165 int len = delete_these_arrays_on_tear_down_->length(); 165 int len = delete_these_arrays_on_tear_down_->length();
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1105
1106 Handle<JSFunction> data_view_fun = 1106 Handle<JSFunction> data_view_fun =
1107 InstallFunction( 1107 InstallFunction(
1108 global, "DataView", JS_DATA_VIEW_TYPE, 1108 global, "DataView", JS_DATA_VIEW_TYPE,
1109 JSDataView::kSizeWithInternalFields, 1109 JSDataView::kSizeWithInternalFields,
1110 isolate->initial_object_prototype(), 1110 isolate->initial_object_prototype(),
1111 Builtins::kIllegal, true, true); 1111 Builtins::kIllegal, true, true);
1112 native_context()->set_data_view_fun(*data_view_fun); 1112 native_context()->set_data_view_fun(*data_view_fun);
1113 } 1113 }
1114 1114
1115 { // -- W e a k M a p
1116 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1117 isolate->initial_object_prototype(),
1118 Builtins::kIllegal, true, true);
1119 }
1120
1121 { // -- W e a k S e t
1122 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1123 isolate->initial_object_prototype(),
1124 Builtins::kIllegal, true, true);
1125 }
1126
1127 { // --- arguments_boilerplate_ 1115 { // --- arguments_boilerplate_
1128 // Make sure we can recognize argument objects at runtime. 1116 // Make sure we can recognize argument objects at runtime.
1129 // This is done by introducing an anonymous function with 1117 // This is done by introducing an anonymous function with
1130 // class_name equals 'Arguments'. 1118 // class_name equals 'Arguments'.
1131 Handle<String> arguments_string = factory->InternalizeOneByteString( 1119 Handle<String> arguments_string = factory->InternalizeOneByteString(
1132 STATIC_ASCII_VECTOR("Arguments")); 1120 STATIC_ASCII_VECTOR("Arguments"));
1133 Handle<Code> code = Handle<Code>( 1121 Handle<Code> code = Handle<Code>(
1134 isolate->builtins()->builtin(Builtins::kIllegal)); 1122 isolate->builtins()->builtin(Builtins::kIllegal));
1135 Handle<JSObject> prototype = 1123 Handle<JSObject> prototype =
1136 Handle<JSObject>( 1124 Handle<JSObject>(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 isolate()->initial_object_prototype(), 1352 isolate()->initial_object_prototype(),
1365 Builtins::kIllegal, true, true); 1353 Builtins::kIllegal, true, true);
1366 } 1354 }
1367 { // -- S e t 1355 { // -- S e t
1368 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, 1356 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize,
1369 isolate()->initial_object_prototype(), 1357 isolate()->initial_object_prototype(),
1370 Builtins::kIllegal, true, true); 1358 Builtins::kIllegal, true, true);
1371 } 1359 }
1372 } 1360 }
1373 1361
1362 if (FLAG_harmony_weak_collections) {
1363 { // -- W e a k M a p
1364 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1365 isolate()->initial_object_prototype(),
1366 Builtins::kIllegal, true, true);
1367 }
1368 { // -- W e a k S e t
1369 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1370 isolate()->initial_object_prototype(),
1371 Builtins::kIllegal, true, true);
1372 }
1373 }
1374
1374 if (FLAG_harmony_generators) { 1375 if (FLAG_harmony_generators) {
1375 // Create generator meta-objects and install them on the builtins object. 1376 // Create generator meta-objects and install them on the builtins object.
1376 Handle<JSObject> builtins(native_context()->builtins()); 1377 Handle<JSObject> builtins(native_context()->builtins());
1377 Handle<JSObject> generator_object_prototype = 1378 Handle<JSObject> generator_object_prototype =
1378 factory()->NewJSObject(isolate()->object_function(), TENURED); 1379 factory()->NewJSObject(isolate()->object_function(), TENURED);
1379 Handle<JSFunction> generator_function_prototype = 1380 Handle<JSFunction> generator_function_prototype =
1380 InstallFunction(builtins, "GeneratorFunctionPrototype", 1381 InstallFunction(builtins, "GeneratorFunctionPrototype",
1381 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 1382 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
1382 generator_object_prototype, Builtins::kIllegal, 1383 generator_object_prototype, Builtins::kIllegal,
1383 false, false); 1384 false, false);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ 1557 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \
1557 Object* var##_native = \ 1558 Object* var##_native = \
1558 native_context()->builtins()->GetPropertyNoExceptionThrown( \ 1559 native_context()->builtins()->GetPropertyNoExceptionThrown( \
1559 *var##_name); \ 1560 *var##_name); \
1560 native_context()->set_##var(Type::cast(var##_native)); 1561 native_context()->set_##var(Type::cast(var##_native));
1561 1562
1562 1563
1563 void Genesis::InstallNativeFunctions() { 1564 void Genesis::InstallNativeFunctions() {
1564 HandleScope scope(isolate()); 1565 HandleScope scope(isolate());
1565 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); 1566 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1566
1567 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); 1567 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1568 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); 1568 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1569 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); 1569 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1570 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); 1570 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1571 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); 1571 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1572 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1572 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1573 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); 1573 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1574
1575 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); 1574 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1576 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); 1575 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
1577 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", 1576 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
1578 configure_instance_fun); 1577 configure_instance_fun);
1579 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); 1578 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1580 INSTALL_NATIVE(JSObject, "functionCache", function_cache); 1579 INSTALL_NATIVE(JSObject, "functionCache", function_cache);
1581 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", 1580 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
1582 to_complete_property_descriptor); 1581 to_complete_property_descriptor);
1583
1584 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1585 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1586 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1587 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1588 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1589 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1590
1591 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); 1582 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
1592 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); 1583 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
1593 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", 1584 INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
1594 observers_begin_perform_splice); 1585 observers_begin_perform_splice);
1595 INSTALL_NATIVE(JSFunction, "EndPerformSplice", 1586 INSTALL_NATIVE(JSFunction, "EndPerformSplice",
1596 observers_end_perform_splice); 1587 observers_end_perform_splice);
1597 } 1588 }
1598 1589
1599 1590
1600 void Genesis::InstallExperimentalNativeFunctions() { 1591 void Genesis::InstallExperimentalNativeFunctions() {
1601 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); 1592 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
1602 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", 1593 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask",
1603 enqueue_external_microtask); 1594 enqueue_external_microtask);
1604 1595
1596 if (FLAG_harmony_promises) {
1597 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
1598 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
1599 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
1600 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
1601 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
1602 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
1603 }
1604
1605 if (FLAG_harmony_proxies) { 1605 if (FLAG_harmony_proxies) {
1606 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); 1606 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
1607 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); 1607 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
1608 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); 1608 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
1609 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); 1609 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
1610 } 1610 }
1611 } 1611 }
1612 1612
1613 #undef INSTALL_NATIVE 1613 #undef INSTALL_NATIVE
1614 1614
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 } 2044 }
2045 2045
2046 2046
2047 bool Genesis::InstallExperimentalNatives() { 2047 bool Genesis::InstallExperimentalNatives() {
2048 for (int i = ExperimentalNatives::GetDebuggerCount(); 2048 for (int i = ExperimentalNatives::GetDebuggerCount();
2049 i < ExperimentalNatives::GetBuiltinsCount(); 2049 i < ExperimentalNatives::GetBuiltinsCount();
2050 i++) { 2050 i++) {
2051 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") 2051 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
2052 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") 2052 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
2053 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") 2053 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
2054 INSTALL_EXPERIMENTAL_NATIVE(i, weak_collections, "weak_collection.js")
2055 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
2054 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") 2056 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
2055 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") 2057 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
2056 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") 2058 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
2057 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") 2059 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
2058 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") 2060 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js")
2059 } 2061 }
2060 2062
2061 InstallExperimentalNativeFunctions(); 2063 InstallExperimentalNativeFunctions();
2062 InstallExperimentalBuiltinFunctionIds(); 2064 InstallExperimentalBuiltinFunctionIds();
2063 return true; 2065 return true;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 return from + sizeof(NestingCounterType); 2747 return from + sizeof(NestingCounterType);
2746 } 2748 }
2747 2749
2748 2750
2749 // Called when the top-level V8 mutex is destroyed. 2751 // Called when the top-level V8 mutex is destroyed.
2750 void Bootstrapper::FreeThreadResources() { 2752 void Bootstrapper::FreeThreadResources() {
2751 ASSERT(!IsActive()); 2753 ASSERT(!IsActive());
2752 } 2754 }
2753 2755
2754 } } // namespace v8::internal 2756 } } // 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