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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 __ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4); | 641 __ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4); |
647 __ bind(&argument_is_string); | 642 __ bind(&argument_is_string); |
648 | 643 |
649 // ----------- S t a t e ------------- | 644 // ----------- S t a t e ------------- |
650 // -- r2 : argument converted to string | 645 // -- r2 : argument converted to string |
651 // -- r1 : constructor function | 646 // -- r1 : constructor function |
652 // -- lr : return address | 647 // -- lr : return address |
653 // ----------------------------------- | 648 // ----------------------------------- |
654 | 649 |
655 Label gc_required; | 650 Label gc_required; |
656 __ AllocateInNewSpace(JSValue::kSize, | 651 __ Allocate(JSValue::kSize, |
657 r0, // Result. | 652 r0, // Result. |
658 r3, // Scratch. | 653 r3, // Scratch. |
659 r4, // Scratch. | 654 r4, // Scratch. |
660 &gc_required, | 655 &gc_required, |
661 TAG_OBJECT); | 656 TAG_OBJECT); |
662 | 657 |
663 // Initialising the String Object. | 658 // Initialising the String Object. |
664 Register map = r3; | 659 Register map = r3; |
665 __ LoadGlobalFunctionInitialMap(function, map, r4); | 660 __ LoadGlobalFunctionInitialMap(function, map, r4); |
666 if (FLAG_debug_code) { | 661 if (FLAG_debug_code) { |
667 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); | 662 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); |
668 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); | 663 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); |
669 __ Assert(eq, "Unexpected string wrapper instance size"); | 664 __ Assert(eq, "Unexpected string wrapper instance size"); |
670 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); | 665 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); |
671 __ cmp(r4, Operand::Zero()); | 666 __ cmp(r4, Operand::Zero()); |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 __ bind(&dont_adapt_arguments); | 1881 __ bind(&dont_adapt_arguments); |
1887 __ Jump(r3); | 1882 __ Jump(r3); |
1888 } | 1883 } |
1889 | 1884 |
1890 | 1885 |
1891 #undef __ | 1886 #undef __ |
1892 | 1887 |
1893 } } // namespace v8::internal | 1888 } } // namespace v8::internal |
1894 | 1889 |
1895 #endif // V8_TARGET_ARCH_ARM | 1890 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |