| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); | 1069 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); |
| 1070 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); | 1070 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); |
| 1071 // Set up a well-formed parameter map to make assertions happy. | 1071 // Set up a well-formed parameter map to make assertions happy. |
| 1072 Handle<FixedArray> elements = factory->NewFixedArray(2); | 1072 Handle<FixedArray> elements = factory->NewFixedArray(2); |
| 1073 elements->set_map(heap->non_strict_arguments_elements_map()); | 1073 elements->set_map(heap->non_strict_arguments_elements_map()); |
| 1074 Handle<FixedArray> array; | 1074 Handle<FixedArray> array; |
| 1075 array = factory->NewFixedArray(0); | 1075 array = factory->NewFixedArray(0); |
| 1076 elements->set(0, *array); | 1076 elements->set(0, *array); |
| 1077 array = factory->NewFixedArray(0); | 1077 array = factory->NewFixedArray(0); |
| 1078 elements->set(1, *array); | 1078 elements->set(1, *array); |
| 1079 Handle<Map> non_strict_arguments_elements_map = |
| 1080 factory->GetElementsTransitionMap(result, |
| 1081 NON_STRICT_ARGUMENTS_ELEMENTS); |
| 1082 result->set_map(*non_strict_arguments_elements_map); |
| 1083 ASSERT(result->HasNonStrictArgumentsElements()); |
| 1079 result->set_elements(*elements); | 1084 result->set_elements(*elements); |
| 1080 global_context()->set_aliased_arguments_boilerplate(*result); | 1085 global_context()->set_aliased_arguments_boilerplate(*result); |
| 1081 } | 1086 } |
| 1082 | 1087 |
| 1083 { // --- strict mode arguments boilerplate | 1088 { // --- strict mode arguments boilerplate |
| 1084 const PropertyAttributes attributes = | 1089 const PropertyAttributes attributes = |
| 1085 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1090 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 1086 | 1091 |
| 1087 // Create the ThrowTypeError functions. | 1092 // Create the ThrowTypeError functions. |
| 1088 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED); | 1093 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 Builtins::kArrayCode, | 1553 Builtins::kArrayCode, |
| 1549 true); | 1554 true); |
| 1550 Handle<JSObject> prototype = | 1555 Handle<JSObject> prototype = |
| 1551 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1556 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1552 SetPrototype(array_function, prototype); | 1557 SetPrototype(array_function, prototype); |
| 1553 | 1558 |
| 1554 array_function->shared()->set_construct_stub( | 1559 array_function->shared()->set_construct_stub( |
| 1555 isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); | 1560 isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); |
| 1556 array_function->shared()->DontAdaptArguments(); | 1561 array_function->shared()->DontAdaptArguments(); |
| 1557 | 1562 |
| 1563 // InternalArrays should not use Smi-Only array optimizations. There are too |
| 1564 // many places in the C++ runtime code (e.g. RegEx) that assume that |
| 1565 // elements in InternalArrays can be set to Objects* without going through a |
| 1566 // bottleneck that would make the SMI_ONLY -> FAST_ELEMENT transition easy |
| 1567 // to trap. Moreover, they rarely are only smi-only. |
| 1568 MaybeObject* maybe_map = |
| 1569 array_function->initial_map()->CopyDropTransitions(); |
| 1570 Map* new_map; |
| 1571 if (!maybe_map->To<Map>(&new_map)) return maybe_map; |
| 1572 new_map->set_elements_kind(FAST_ELEMENTS); |
| 1573 array_function->set_initial_map(new_map); |
| 1574 |
| 1558 // Make "length" magic on instances. | 1575 // Make "length" magic on instances. |
| 1559 Handle<DescriptorArray> array_descriptors = | 1576 Handle<DescriptorArray> array_descriptors = |
| 1560 factory()->CopyAppendForeignDescriptor( | 1577 factory()->CopyAppendForeignDescriptor( |
| 1561 factory()->empty_descriptor_array(), | 1578 factory()->empty_descriptor_array(), |
| 1562 factory()->length_symbol(), | 1579 factory()->length_symbol(), |
| 1563 factory()->NewForeign(&Accessors::ArrayLength), | 1580 factory()->NewForeign(&Accessors::ArrayLength), |
| 1564 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); | 1581 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); |
| 1565 | 1582 |
| 1566 array_function->initial_map()->set_instance_descriptors( | 1583 array_function->initial_map()->set_instance_descriptors( |
| 1567 *array_descriptors); | 1584 *array_descriptors); |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 return from + sizeof(NestingCounterType); | 2242 return from + sizeof(NestingCounterType); |
| 2226 } | 2243 } |
| 2227 | 2244 |
| 2228 | 2245 |
| 2229 // Called when the top-level V8 mutex is destroyed. | 2246 // Called when the top-level V8 mutex is destroyed. |
| 2230 void Bootstrapper::FreeThreadResources() { | 2247 void Bootstrapper::FreeThreadResources() { |
| 2231 ASSERT(!IsActive()); | 2248 ASSERT(!IsActive()); |
| 2232 } | 2249 } |
| 2233 | 2250 |
| 2234 } } // namespace v8::internal | 2251 } } // namespace v8::internal |
| OLD | NEW |