OLD | NEW |
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 "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 { // length | 1197 { // length |
1198 FieldDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex, | 1198 FieldDescriptor d(factory->length_string(), Heap::kArgumentsLengthIndex, |
1199 DONT_ENUM, Representation::Tagged()); | 1199 DONT_ENUM, Representation::Tagged()); |
1200 map->AppendDescriptor(&d); | 1200 map->AppendDescriptor(&d); |
1201 } | 1201 } |
1202 { // callee | 1202 { // callee |
1203 FieldDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex, | 1203 FieldDescriptor d(factory->callee_string(), Heap::kArgumentsCalleeIndex, |
1204 DONT_ENUM, Representation::Tagged()); | 1204 DONT_ENUM, Representation::Tagged()); |
1205 map->AppendDescriptor(&d); | 1205 map->AppendDescriptor(&d); |
1206 } | 1206 } |
| 1207 // @@iterator method is added later. |
1207 | 1208 |
1208 map->set_function_with_prototype(true); | 1209 map->set_function_with_prototype(true); |
1209 map->set_pre_allocated_property_fields(2); | 1210 map->set_pre_allocated_property_fields(2); |
1210 map->set_inobject_properties(2); | 1211 map->set_inobject_properties(2); |
1211 native_context()->set_sloppy_arguments_map(*map); | 1212 native_context()->set_sloppy_arguments_map(*map); |
1212 | 1213 |
1213 DCHECK(!function->has_initial_map()); | 1214 DCHECK(!function->has_initial_map()); |
1214 JSFunction::SetInitialMap(function, map, | 1215 JSFunction::SetInitialMap(function, map, |
1215 isolate->initial_object_prototype()); | 1216 isolate->initial_object_prototype()); |
1216 | 1217 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 map->AppendDescriptor(&d); | 1256 map->AppendDescriptor(&d); |
1256 } | 1257 } |
1257 { // callee | 1258 { // callee |
1258 CallbacksDescriptor d(factory->callee_string(), callee, attributes); | 1259 CallbacksDescriptor d(factory->callee_string(), callee, attributes); |
1259 map->AppendDescriptor(&d); | 1260 map->AppendDescriptor(&d); |
1260 } | 1261 } |
1261 { // caller | 1262 { // caller |
1262 CallbacksDescriptor d(factory->caller_string(), caller, attributes); | 1263 CallbacksDescriptor d(factory->caller_string(), caller, attributes); |
1263 map->AppendDescriptor(&d); | 1264 map->AppendDescriptor(&d); |
1264 } | 1265 } |
| 1266 // @@iterator method is added later. |
1265 | 1267 |
1266 map->set_function_with_prototype(true); | 1268 map->set_function_with_prototype(true); |
1267 map->set_prototype(native_context()->object_function()->prototype()); | 1269 map->set_prototype(native_context()->object_function()->prototype()); |
1268 map->set_pre_allocated_property_fields(1); | 1270 map->set_pre_allocated_property_fields(1); |
1269 map->set_inobject_properties(1); | 1271 map->set_inobject_properties(1); |
1270 | 1272 |
1271 // Copy constructor from the sloppy arguments boilerplate. | 1273 // Copy constructor from the sloppy arguments boilerplate. |
1272 map->set_constructor( | 1274 map->set_constructor( |
1273 native_context()->sloppy_arguments_map()->constructor()); | 1275 native_context()->sloppy_arguments_map()->constructor()); |
1274 | 1276 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 observers_end_perform_splice); | 1591 observers_end_perform_splice); |
1590 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", | 1592 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", |
1591 native_object_observe); | 1593 native_object_observe); |
1592 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", | 1594 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", |
1593 native_object_get_notifier); | 1595 native_object_get_notifier); |
1594 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", | 1596 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", |
1595 native_object_notifier_perform_change); | 1597 native_object_notifier_perform_change); |
1596 | 1598 |
1597 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); | 1599 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); |
1598 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); | 1600 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); |
| 1601 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); |
1599 | 1602 |
1600 INSTALL_NATIVE_MATH(abs) | 1603 INSTALL_NATIVE_MATH(abs) |
1601 INSTALL_NATIVE_MATH(acos) | 1604 INSTALL_NATIVE_MATH(acos) |
1602 INSTALL_NATIVE_MATH(asin) | 1605 INSTALL_NATIVE_MATH(asin) |
1603 INSTALL_NATIVE_MATH(atan) | 1606 INSTALL_NATIVE_MATH(atan) |
1604 INSTALL_NATIVE_MATH(atan2) | 1607 INSTALL_NATIVE_MATH(atan2) |
1605 INSTALL_NATIVE_MATH(ceil) | 1608 INSTALL_NATIVE_MATH(ceil) |
1606 INSTALL_NATIVE_MATH(cos) | 1609 INSTALL_NATIVE_MATH(cos) |
1607 INSTALL_NATIVE_MATH(exp) | 1610 INSTALL_NATIVE_MATH(exp) |
1608 INSTALL_NATIVE_MATH(floor) | 1611 INSTALL_NATIVE_MATH(floor) |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 initial_map->AppendDescriptor(&input_field); | 2035 initial_map->AppendDescriptor(&input_field); |
2033 } | 2036 } |
2034 | 2037 |
2035 initial_map->set_inobject_properties(2); | 2038 initial_map->set_inobject_properties(2); |
2036 initial_map->set_pre_allocated_property_fields(2); | 2039 initial_map->set_pre_allocated_property_fields(2); |
2037 initial_map->set_unused_property_fields(0); | 2040 initial_map->set_unused_property_fields(0); |
2038 | 2041 |
2039 native_context()->set_regexp_result_map(*initial_map); | 2042 native_context()->set_regexp_result_map(*initial_map); |
2040 } | 2043 } |
2041 | 2044 |
| 2045 // Add @@iterator method to the arguments object maps. |
| 2046 { |
| 2047 PropertyAttributes attribs = DONT_ENUM; |
| 2048 Handle<AccessorInfo> arguments_iterator = |
| 2049 Accessors::ArgumentsIteratorInfo(isolate(), attribs); |
| 2050 { |
| 2051 CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()), |
| 2052 arguments_iterator, attribs); |
| 2053 Handle<Map> map(native_context()->sloppy_arguments_map()); |
| 2054 Map::EnsureDescriptorSlack(map, 1); |
| 2055 map->AppendDescriptor(&d); |
| 2056 } |
| 2057 { |
| 2058 CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()), |
| 2059 arguments_iterator, attribs); |
| 2060 Handle<Map> map(native_context()->aliased_arguments_map()); |
| 2061 Map::EnsureDescriptorSlack(map, 1); |
| 2062 map->AppendDescriptor(&d); |
| 2063 } |
| 2064 { |
| 2065 CallbacksDescriptor d(Handle<Name>(native_context()->iterator_symbol()), |
| 2066 arguments_iterator, attribs); |
| 2067 Handle<Map> map(native_context()->strict_arguments_map()); |
| 2068 Map::EnsureDescriptorSlack(map, 1); |
| 2069 map->AppendDescriptor(&d); |
| 2070 } |
| 2071 } |
| 2072 |
2042 #ifdef VERIFY_HEAP | 2073 #ifdef VERIFY_HEAP |
2043 builtins->ObjectVerify(); | 2074 builtins->ObjectVerify(); |
2044 #endif | 2075 #endif |
2045 | 2076 |
2046 return true; | 2077 return true; |
2047 } | 2078 } |
2048 | 2079 |
2049 | 2080 |
2050 #define INSTALL_EXPERIMENTAL_NATIVE(i, flag, file) \ | 2081 #define INSTALL_EXPERIMENTAL_NATIVE(i, flag, file) \ |
2051 if (FLAG_harmony_##flag && \ | 2082 if (FLAG_harmony_##flag && \ |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 return from + sizeof(NestingCounterType); | 2721 return from + sizeof(NestingCounterType); |
2691 } | 2722 } |
2692 | 2723 |
2693 | 2724 |
2694 // Called when the top-level V8 mutex is destroyed. | 2725 // Called when the top-level V8 mutex is destroyed. |
2695 void Bootstrapper::FreeThreadResources() { | 2726 void Bootstrapper::FreeThreadResources() { |
2696 DCHECK(!IsActive()); | 2727 DCHECK(!IsActive()); |
2697 } | 2728 } |
2698 | 2729 |
2699 } } // namespace v8::internal | 2730 } } // namespace v8::internal |
OLD | NEW |