OLD | NEW |
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 Loading... |
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 < 20); // Don't use this mechanism for unbounded allocations. | 155 ASSERT(len < 24); // 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 Loading... |
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 |
1115 { // --- arguments_boilerplate_ | 1127 { // --- arguments_boilerplate_ |
1116 // Make sure we can recognize argument objects at runtime. | 1128 // Make sure we can recognize argument objects at runtime. |
1117 // This is done by introducing an anonymous function with | 1129 // This is done by introducing an anonymous function with |
1118 // class_name equals 'Arguments'. | 1130 // class_name equals 'Arguments'. |
1119 Handle<String> arguments_string = factory->InternalizeOneByteString( | 1131 Handle<String> arguments_string = factory->InternalizeOneByteString( |
1120 STATIC_ASCII_VECTOR("Arguments")); | 1132 STATIC_ASCII_VECTOR("Arguments")); |
1121 Handle<Code> code = Handle<Code>( | 1133 Handle<Code> code = Handle<Code>( |
1122 isolate->builtins()->builtin(Builtins::kIllegal)); | 1134 isolate->builtins()->builtin(Builtins::kIllegal)); |
1123 Handle<JSObject> prototype = | 1135 Handle<JSObject> prototype = |
1124 Handle<JSObject>( | 1136 Handle<JSObject>( |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 isolate()->initial_object_prototype(), | 1364 isolate()->initial_object_prototype(), |
1353 Builtins::kIllegal, true, true); | 1365 Builtins::kIllegal, true, true); |
1354 } | 1366 } |
1355 { // -- S e t | 1367 { // -- S e t |
1356 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, | 1368 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, |
1357 isolate()->initial_object_prototype(), | 1369 isolate()->initial_object_prototype(), |
1358 Builtins::kIllegal, true, true); | 1370 Builtins::kIllegal, true, true); |
1359 } | 1371 } |
1360 } | 1372 } |
1361 | 1373 |
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 | |
1375 if (FLAG_harmony_generators) { | 1374 if (FLAG_harmony_generators) { |
1376 // Create generator meta-objects and install them on the builtins object. | 1375 // Create generator meta-objects and install them on the builtins object. |
1377 Handle<JSObject> builtins(native_context()->builtins()); | 1376 Handle<JSObject> builtins(native_context()->builtins()); |
1378 Handle<JSObject> generator_object_prototype = | 1377 Handle<JSObject> generator_object_prototype = |
1379 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1378 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1380 Handle<JSFunction> generator_function_prototype = | 1379 Handle<JSFunction> generator_function_prototype = |
1381 InstallFunction(builtins, "GeneratorFunctionPrototype", | 1380 InstallFunction(builtins, "GeneratorFunctionPrototype", |
1382 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, | 1381 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, |
1383 generator_object_prototype, Builtins::kIllegal, | 1382 generator_object_prototype, Builtins::kIllegal, |
1384 false, false); | 1383 false, false); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ | 1556 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ |
1558 Object* var##_native = \ | 1557 Object* var##_native = \ |
1559 native_context()->builtins()->GetPropertyNoExceptionThrown( \ | 1558 native_context()->builtins()->GetPropertyNoExceptionThrown( \ |
1560 *var##_name); \ | 1559 *var##_name); \ |
1561 native_context()->set_##var(Type::cast(var##_native)); | 1560 native_context()->set_##var(Type::cast(var##_native)); |
1562 | 1561 |
1563 | 1562 |
1564 void Genesis::InstallNativeFunctions() { | 1563 void Genesis::InstallNativeFunctions() { |
1565 HandleScope scope(isolate()); | 1564 HandleScope scope(isolate()); |
1566 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); | 1565 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 |
1574 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); | 1575 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); |
1575 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); | 1576 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); |
1576 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", | 1577 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", |
1577 configure_instance_fun); | 1578 configure_instance_fun); |
1578 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); | 1579 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); |
1579 INSTALL_NATIVE(JSObject, "functionCache", function_cache); | 1580 INSTALL_NATIVE(JSObject, "functionCache", function_cache); |
1580 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", | 1581 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", |
1581 to_complete_property_descriptor); | 1582 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 |
1582 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); | 1591 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); |
1583 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); | 1592 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); |
1584 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", | 1593 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", |
1585 observers_begin_perform_splice); | 1594 observers_begin_perform_splice); |
1586 INSTALL_NATIVE(JSFunction, "EndPerformSplice", | 1595 INSTALL_NATIVE(JSFunction, "EndPerformSplice", |
1587 observers_end_perform_splice); | 1596 observers_end_perform_splice); |
1588 } | 1597 } |
1589 | 1598 |
1590 | 1599 |
1591 void Genesis::InstallExperimentalNativeFunctions() { | 1600 void Genesis::InstallExperimentalNativeFunctions() { |
1592 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); | 1601 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); |
1593 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", | 1602 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", |
1594 enqueue_external_microtask); | 1603 enqueue_external_microtask); |
1595 | 1604 |
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 Loading... |
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") | |
2056 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") | 2054 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") |
2057 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") | 2055 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") |
2058 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") | 2056 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") |
2059 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") | 2057 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") |
2060 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") | 2058 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") |
2061 } | 2059 } |
2062 | 2060 |
2063 InstallExperimentalNativeFunctions(); | 2061 InstallExperimentalNativeFunctions(); |
2064 InstallExperimentalBuiltinFunctionIds(); | 2062 InstallExperimentalBuiltinFunctionIds(); |
2065 return true; | 2063 return true; |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 return from + sizeof(NestingCounterType); | 2745 return from + sizeof(NestingCounterType); |
2748 } | 2746 } |
2749 | 2747 |
2750 | 2748 |
2751 // Called when the top-level V8 mutex is destroyed. | 2749 // Called when the top-level V8 mutex is destroyed. |
2752 void Bootstrapper::FreeThreadResources() { | 2750 void Bootstrapper::FreeThreadResources() { |
2753 ASSERT(!IsActive()); | 2751 ASSERT(!IsActive()); |
2754 } | 2752 } |
2755 | 2753 |
2756 } } // namespace v8::internal | 2754 } } // namespace v8::internal |
OLD | NEW |