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