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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 delete_these_arrays_on_tear_down_->Add(memory); | 148 delete_these_arrays_on_tear_down_->Add(memory); |
149 } | 149 } |
150 return memory; | 150 return memory; |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 void Bootstrapper::TearDown() { | 154 void Bootstrapper::TearDown() { |
155 if (delete_these_non_arrays_on_tear_down_ != NULL) { | 155 if (delete_these_non_arrays_on_tear_down_ != NULL) { |
156 int len = delete_these_non_arrays_on_tear_down_->length(); | 156 int len = delete_these_non_arrays_on_tear_down_->length(); |
157 ASSERT(len < 24); // Don't use this mechanism for unbounded allocations. | 157 ASSERT(len < 20); // Don't use this mechanism for unbounded allocations. |
158 for (int i = 0; i < len; i++) { | 158 for (int i = 0; i < len; i++) { |
159 delete delete_these_non_arrays_on_tear_down_->at(i); | 159 delete delete_these_non_arrays_on_tear_down_->at(i); |
160 delete_these_non_arrays_on_tear_down_->at(i) = NULL; | 160 delete_these_non_arrays_on_tear_down_->at(i) = NULL; |
161 } | 161 } |
162 delete delete_these_non_arrays_on_tear_down_; | 162 delete delete_these_non_arrays_on_tear_down_; |
163 delete_these_non_arrays_on_tear_down_ = NULL; | 163 delete_these_non_arrays_on_tear_down_ = NULL; |
164 } | 164 } |
165 | 165 |
166 if (delete_these_arrays_on_tear_down_ != NULL) { | 166 if (delete_these_arrays_on_tear_down_ != NULL) { |
167 int len = delete_these_arrays_on_tear_down_->length(); | 167 int len = delete_these_arrays_on_tear_down_->length(); |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 | 1107 |
1108 Handle<JSFunction> data_view_fun = | 1108 Handle<JSFunction> data_view_fun = |
1109 InstallFunction( | 1109 InstallFunction( |
1110 global, "DataView", JS_DATA_VIEW_TYPE, | 1110 global, "DataView", JS_DATA_VIEW_TYPE, |
1111 JSDataView::kSizeWithInternalFields, | 1111 JSDataView::kSizeWithInternalFields, |
1112 isolate->initial_object_prototype(), | 1112 isolate->initial_object_prototype(), |
1113 Builtins::kIllegal, true, true); | 1113 Builtins::kIllegal, true, true); |
1114 native_context()->set_data_view_fun(*data_view_fun); | 1114 native_context()->set_data_view_fun(*data_view_fun); |
1115 } | 1115 } |
1116 | 1116 |
1117 { // -- W e a k M a p | |
1118 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | |
1119 isolate->initial_object_prototype(), | |
1120 Builtins::kIllegal, true, true); | |
1121 } | |
1122 | |
1123 { // -- W e a k S e t | |
1124 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, | |
1125 isolate->initial_object_prototype(), | |
1126 Builtins::kIllegal, true, true); | |
1127 } | |
1128 | |
1129 { // --- arguments_boilerplate_ | 1117 { // --- arguments_boilerplate_ |
1130 // Make sure we can recognize argument objects at runtime. | 1118 // Make sure we can recognize argument objects at runtime. |
1131 // This is done by introducing an anonymous function with | 1119 // This is done by introducing an anonymous function with |
1132 // class_name equals 'Arguments'. | 1120 // class_name equals 'Arguments'. |
1133 Handle<String> arguments_string = factory->InternalizeOneByteString( | 1121 Handle<String> arguments_string = factory->InternalizeOneByteString( |
1134 STATIC_ASCII_VECTOR("Arguments")); | 1122 STATIC_ASCII_VECTOR("Arguments")); |
1135 Handle<Code> code = Handle<Code>( | 1123 Handle<Code> code = Handle<Code>( |
1136 isolate->builtins()->builtin(Builtins::kIllegal)); | 1124 isolate->builtins()->builtin(Builtins::kIllegal)); |
1137 Handle<JSObject> prototype = | 1125 Handle<JSObject> prototype = |
1138 Handle<JSObject>( | 1126 Handle<JSObject>( |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 isolate()->initial_object_prototype(), | 1354 isolate()->initial_object_prototype(), |
1367 Builtins::kIllegal, true, true); | 1355 Builtins::kIllegal, true, true); |
1368 } | 1356 } |
1369 { // -- S e t | 1357 { // -- S e t |
1370 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, | 1358 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, |
1371 isolate()->initial_object_prototype(), | 1359 isolate()->initial_object_prototype(), |
1372 Builtins::kIllegal, true, true); | 1360 Builtins::kIllegal, true, true); |
1373 } | 1361 } |
1374 } | 1362 } |
1375 | 1363 |
| 1364 if (FLAG_harmony_weak_collections) { |
| 1365 { // -- W e a k M a p |
| 1366 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
| 1367 isolate()->initial_object_prototype(), |
| 1368 Builtins::kIllegal, true, true); |
| 1369 } |
| 1370 { // -- W e a k S e t |
| 1371 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, |
| 1372 isolate()->initial_object_prototype(), |
| 1373 Builtins::kIllegal, true, true); |
| 1374 } |
| 1375 } |
| 1376 |
1376 if (FLAG_harmony_generators) { | 1377 if (FLAG_harmony_generators) { |
1377 // Create generator meta-objects and install them on the builtins object. | 1378 // Create generator meta-objects and install them on the builtins object. |
1378 Handle<JSObject> builtins(native_context()->builtins()); | 1379 Handle<JSObject> builtins(native_context()->builtins()); |
1379 Handle<JSObject> generator_object_prototype = | 1380 Handle<JSObject> generator_object_prototype = |
1380 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1381 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1381 Handle<JSFunction> generator_function_prototype = | 1382 Handle<JSFunction> generator_function_prototype = |
1382 InstallFunction(builtins, "GeneratorFunctionPrototype", | 1383 InstallFunction(builtins, "GeneratorFunctionPrototype", |
1383 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, | 1384 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, |
1384 generator_object_prototype, Builtins::kIllegal, | 1385 generator_object_prototype, Builtins::kIllegal, |
1385 false, false); | 1386 false, false); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ | 1561 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ |
1561 Object* var##_native = \ | 1562 Object* var##_native = \ |
1562 native_context()->builtins()->GetPropertyNoExceptionThrown( \ | 1563 native_context()->builtins()->GetPropertyNoExceptionThrown( \ |
1563 *var##_name); \ | 1564 *var##_name); \ |
1564 native_context()->set_##var(Type::cast(var##_native)); | 1565 native_context()->set_##var(Type::cast(var##_native)); |
1565 | 1566 |
1566 | 1567 |
1567 void Genesis::InstallNativeFunctions() { | 1568 void Genesis::InstallNativeFunctions() { |
1568 HandleScope scope(isolate()); | 1569 HandleScope scope(isolate()); |
1569 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); | 1570 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); |
1570 | |
1571 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); | 1571 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); |
1572 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); | 1572 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); |
1573 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); | 1573 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); |
1574 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); | 1574 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); |
1575 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); | 1575 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); |
1576 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); | 1576 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); |
1577 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); | 1577 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); |
1578 | |
1579 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); | 1578 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); |
1580 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); | 1579 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); |
1581 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", | 1580 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", |
1582 configure_instance_fun); | 1581 configure_instance_fun); |
1583 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); | 1582 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); |
1584 INSTALL_NATIVE(JSObject, "functionCache", function_cache); | 1583 INSTALL_NATIVE(JSObject, "functionCache", function_cache); |
1585 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", | 1584 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", |
1586 to_complete_property_descriptor); | 1585 to_complete_property_descriptor); |
1587 | |
1588 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise); | |
1589 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create); | |
1590 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve); | |
1591 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject); | |
1592 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain); | |
1593 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch); | |
1594 | |
1595 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); | 1586 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); |
1596 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); | 1587 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); |
1597 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", | 1588 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", |
1598 observers_begin_perform_splice); | 1589 observers_begin_perform_splice); |
1599 INSTALL_NATIVE(JSFunction, "EndPerformSplice", | 1590 INSTALL_NATIVE(JSFunction, "EndPerformSplice", |
1600 observers_end_perform_splice); | 1591 observers_end_perform_splice); |
1601 } | 1592 } |
1602 | 1593 |
1603 | 1594 |
1604 void Genesis::InstallExperimentalNativeFunctions() { | 1595 void Genesis::InstallExperimentalNativeFunctions() { |
1605 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); | 1596 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); |
1606 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", | 1597 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", |
1607 enqueue_external_microtask); | 1598 enqueue_external_microtask); |
1608 | 1599 |
| 1600 if (FLAG_harmony_promises) { |
| 1601 INSTALL_NATIVE(JSFunction, "IsPromise", is_promise); |
| 1602 INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create); |
| 1603 INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve); |
| 1604 INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject); |
| 1605 INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain); |
| 1606 INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch); |
| 1607 } |
| 1608 |
1609 if (FLAG_harmony_proxies) { | 1609 if (FLAG_harmony_proxies) { |
1610 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1610 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1611 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1611 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1612 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1612 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1613 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1613 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1614 } | 1614 } |
1615 } | 1615 } |
1616 | 1616 |
1617 #undef INSTALL_NATIVE | 1617 #undef INSTALL_NATIVE |
1618 | 1618 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 } | 2048 } |
2049 | 2049 |
2050 | 2050 |
2051 bool Genesis::InstallExperimentalNatives() { | 2051 bool Genesis::InstallExperimentalNatives() { |
2052 for (int i = ExperimentalNatives::GetDebuggerCount(); | 2052 for (int i = ExperimentalNatives::GetDebuggerCount(); |
2053 i < ExperimentalNatives::GetBuiltinsCount(); | 2053 i < ExperimentalNatives::GetBuiltinsCount(); |
2054 i++) { | 2054 i++) { |
2055 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") | 2055 INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js") |
2056 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") | 2056 INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js") |
2057 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") | 2057 INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js") |
| 2058 INSTALL_EXPERIMENTAL_NATIVE(i, weak_collections, "weak_collection.js") |
| 2059 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js") |
2058 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") | 2060 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") |
2059 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") | 2061 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") |
2060 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") | 2062 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") |
2061 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") | 2063 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") |
2062 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") | 2064 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") |
2063 } | 2065 } |
2064 | 2066 |
2065 InstallExperimentalNativeFunctions(); | 2067 InstallExperimentalNativeFunctions(); |
2066 InstallExperimentalBuiltinFunctionIds(); | 2068 InstallExperimentalBuiltinFunctionIds(); |
2067 return true; | 2069 return true; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2753 return from + sizeof(NestingCounterType); | 2755 return from + sizeof(NestingCounterType); |
2754 } | 2756 } |
2755 | 2757 |
2756 | 2758 |
2757 // Called when the top-level V8 mutex is destroyed. | 2759 // Called when the top-level V8 mutex is destroyed. |
2758 void Bootstrapper::FreeThreadResources() { | 2760 void Bootstrapper::FreeThreadResources() { |
2759 ASSERT(!IsActive()); | 2761 ASSERT(!IsActive()); |
2760 } | 2762 } |
2761 | 2763 |
2762 } } // namespace v8::internal | 2764 } } // namespace v8::internal |
OLD | NEW |