Chromium Code Reviews| 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 | |
|
Sven Panne
2011/09/16 09:19:32
Please explain why...
danno
2011/09/21 14:32:04
Done.
| |
| 1564 MaybeObject* maybe_map = | |
| 1565 array_function->initial_map()->CopyDropTransitions(); | |
| 1566 Map* new_map; | |
| 1567 if (!maybe_map->To<Map>(&new_map)) return maybe_map; | |
| 1568 new_map->set_elements_kind(FAST_ELEMENTS); | |
| 1569 array_function->set_initial_map(new_map); | |
| 1570 | |
| 1558 // Make "length" magic on instances. | 1571 // Make "length" magic on instances. |
| 1559 Handle<DescriptorArray> array_descriptors = | 1572 Handle<DescriptorArray> array_descriptors = |
| 1560 factory()->CopyAppendForeignDescriptor( | 1573 factory()->CopyAppendForeignDescriptor( |
| 1561 factory()->empty_descriptor_array(), | 1574 factory()->empty_descriptor_array(), |
| 1562 factory()->length_symbol(), | 1575 factory()->length_symbol(), |
| 1563 factory()->NewForeign(&Accessors::ArrayLength), | 1576 factory()->NewForeign(&Accessors::ArrayLength), |
| 1564 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); | 1577 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); |
| 1565 | 1578 |
| 1566 array_function->initial_map()->set_instance_descriptors( | 1579 array_function->initial_map()->set_instance_descriptors( |
| 1567 *array_descriptors); | 1580 *array_descriptors); |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2225 return from + sizeof(NestingCounterType); | 2238 return from + sizeof(NestingCounterType); |
| 2226 } | 2239 } |
| 2227 | 2240 |
| 2228 | 2241 |
| 2229 // Called when the top-level V8 mutex is destroyed. | 2242 // Called when the top-level V8 mutex is destroyed. |
| 2230 void Bootstrapper::FreeThreadResources() { | 2243 void Bootstrapper::FreeThreadResources() { |
| 2231 ASSERT(!IsActive()); | 2244 ASSERT(!IsActive()); |
| 2232 } | 2245 } |
| 2233 | 2246 |
| 2234 } } // namespace v8::internal | 2247 } } // namespace v8::internal |
| OLD | NEW |