| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 117 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
| 118 STATIC_ASSERT(initial_capacity >= 0); | 118 STATIC_ASSERT(initial_capacity >= 0); |
| 119 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 119 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
| 120 | 120 |
| 121 // Allocate the JSArray object together with space for a fixed array with the | 121 // Allocate the JSArray object together with space for a fixed array with the |
| 122 // requested elements. | 122 // requested elements. |
| 123 int size = JSArray::kSize; | 123 int size = JSArray::kSize; |
| 124 if (initial_capacity > 0) { | 124 if (initial_capacity > 0) { |
| 125 size += FixedArray::SizeFor(initial_capacity); | 125 size += FixedArray::SizeFor(initial_capacity); |
| 126 } | 126 } |
| 127 __ AllocateInNewSpace(size, | 127 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT, |
| 128 result, | 128 MacroAssembler::NEW_SPACE); |
| 129 scratch2, | |
| 130 scratch3, | |
| 131 gc_required, | |
| 132 TAG_OBJECT); | |
| 133 | 129 |
| 134 // Allocated the JSArray. Now initialize the fields except for the elements | 130 // Allocated the JSArray. Now initialize the fields except for the elements |
| 135 // array. | 131 // array. |
| 136 // result: JSObject | 132 // result: JSObject |
| 137 // scratch1: initial map | 133 // scratch1: initial map |
| 138 // scratch2: start of next object | 134 // scratch2: start of next object |
| 139 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); | 135 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); |
| 140 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 136 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
| 141 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); | 137 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); |
| 142 // Field JSArray::kElementsOffset is initialized later. | 138 // Field JSArray::kElementsOffset is initialized later. |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 __ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4); | 608 __ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4); |
| 613 __ bind(&argument_is_string); | 609 __ bind(&argument_is_string); |
| 614 | 610 |
| 615 // ----------- S t a t e ------------- | 611 // ----------- S t a t e ------------- |
| 616 // -- r2 : argument converted to string | 612 // -- r2 : argument converted to string |
| 617 // -- r1 : constructor function | 613 // -- r1 : constructor function |
| 618 // -- lr : return address | 614 // -- lr : return address |
| 619 // ----------------------------------- | 615 // ----------------------------------- |
| 620 | 616 |
| 621 Label gc_required; | 617 Label gc_required; |
| 622 __ AllocateInNewSpace(JSValue::kSize, | 618 __ Allocate(JSValue::kSize, |
| 623 r0, // Result. | 619 r0, // Result. |
| 624 r3, // Scratch. | 620 r3, // Scratch. |
| 625 r4, // Scratch. | 621 r4, // Scratch. |
| 626 &gc_required, | 622 &gc_required, |
| 627 TAG_OBJECT); | 623 TAG_OBJECT, |
| 624 MacroAssembler::NEW_SPACE); |
| 628 | 625 |
| 629 // Initialising the String Object. | 626 // Initialising the String Object. |
| 630 Register map = r3; | 627 Register map = r3; |
| 631 __ LoadGlobalFunctionInitialMap(function, map, r4); | 628 __ LoadGlobalFunctionInitialMap(function, map, r4); |
| 632 if (FLAG_debug_code) { | 629 if (FLAG_debug_code) { |
| 633 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); | 630 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); |
| 634 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); | 631 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); |
| 635 __ Assert(eq, "Unexpected string wrapper instance size"); | 632 __ Assert(eq, "Unexpected string wrapper instance size"); |
| 636 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); | 633 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); |
| 637 __ cmp(r4, Operand::Zero()); | 634 __ cmp(r4, Operand::Zero()); |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 __ bind(&dont_adapt_arguments); | 1847 __ bind(&dont_adapt_arguments); |
| 1851 __ Jump(r3); | 1848 __ Jump(r3); |
| 1852 } | 1849 } |
| 1853 | 1850 |
| 1854 | 1851 |
| 1855 #undef __ | 1852 #undef __ |
| 1856 | 1853 |
| 1857 } } // namespace v8::internal | 1854 } } // namespace v8::internal |
| 1858 | 1855 |
| 1859 #endif // V8_TARGET_ARCH_ARM | 1856 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |