| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 121 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
| 122 STATIC_ASSERT(initial_capacity >= 0); | 122 STATIC_ASSERT(initial_capacity >= 0); |
| 123 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 123 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
| 124 | 124 |
| 125 // Allocate the JSArray object together with space for a fixed array with the | 125 // Allocate the JSArray object together with space for a fixed array with the |
| 126 // requested elements. | 126 // requested elements. |
| 127 int size = JSArray::kSize; | 127 int size = JSArray::kSize; |
| 128 if (initial_capacity > 0) { | 128 if (initial_capacity > 0) { |
| 129 size += FixedArray::SizeFor(initial_capacity); | 129 size += FixedArray::SizeFor(initial_capacity); |
| 130 } | 130 } |
| 131 __ AllocateInNewSpace(size, | 131 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT); |
| 132 result, | 132 |
| 133 scratch2, | |
| 134 scratch3, | |
| 135 gc_required, | |
| 136 TAG_OBJECT); | |
| 137 // Allocated the JSArray. Now initialize the fields except for the elements | 133 // Allocated the JSArray. Now initialize the fields except for the elements |
| 138 // array. | 134 // array. |
| 139 // result: JSObject | 135 // result: JSObject |
| 140 // scratch1: initial map | 136 // scratch1: initial map |
| 141 // scratch2: start of next object | 137 // scratch2: start of next object |
| 142 __ sw(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); | 138 __ sw(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); |
| 143 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 139 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
| 144 __ sw(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); | 140 __ sw(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); |
| 145 // Field JSArray::kElementsOffset is initialized later. | 141 // Field JSArray::kElementsOffset is initialized later. |
| 146 __ mov(scratch3, zero_reg); | 142 __ mov(scratch3, zero_reg); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 __ IncrementCounter(counters->string_ctor_cached_number(), 1, a3, t0); | 654 __ IncrementCounter(counters->string_ctor_cached_number(), 1, a3, t0); |
| 659 __ bind(&argument_is_string); | 655 __ bind(&argument_is_string); |
| 660 | 656 |
| 661 // ----------- S t a t e ------------- | 657 // ----------- S t a t e ------------- |
| 662 // -- a2 : argument converted to string | 658 // -- a2 : argument converted to string |
| 663 // -- a1 : constructor function | 659 // -- a1 : constructor function |
| 664 // -- ra : return address | 660 // -- ra : return address |
| 665 // ----------------------------------- | 661 // ----------------------------------- |
| 666 | 662 |
| 667 Label gc_required; | 663 Label gc_required; |
| 668 __ AllocateInNewSpace(JSValue::kSize, | 664 __ Allocate(JSValue::kSize, |
| 669 v0, // Result. | 665 v0, // Result. |
| 670 a3, // Scratch. | 666 a3, // Scratch. |
| 671 t0, // Scratch. | 667 t0, // Scratch. |
| 672 &gc_required, | 668 &gc_required, |
| 673 TAG_OBJECT); | 669 TAG_OBJECT); |
| 674 | 670 |
| 675 // Initialising the String Object. | 671 // Initialising the String Object. |
| 676 Register map = a3; | 672 Register map = a3; |
| 677 __ LoadGlobalFunctionInitialMap(function, map, t0); | 673 __ LoadGlobalFunctionInitialMap(function, map, t0); |
| 678 if (FLAG_debug_code) { | 674 if (FLAG_debug_code) { |
| 679 __ lbu(t0, FieldMemOperand(map, Map::kInstanceSizeOffset)); | 675 __ lbu(t0, FieldMemOperand(map, Map::kInstanceSizeOffset)); |
| 680 __ Assert(eq, "Unexpected string wrapper instance size", | 676 __ Assert(eq, "Unexpected string wrapper instance size", |
| 681 t0, Operand(JSValue::kSize >> kPointerSizeLog2)); | 677 t0, Operand(JSValue::kSize >> kPointerSizeLog2)); |
| 682 __ lbu(t0, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); | 678 __ lbu(t0, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); |
| 683 __ Assert(eq, "Unexpected unused properties of string wrapper", | 679 __ Assert(eq, "Unexpected unused properties of string wrapper", |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 __ bind(&dont_adapt_arguments); | 1953 __ bind(&dont_adapt_arguments); |
| 1958 __ Jump(a3); | 1954 __ Jump(a3); |
| 1959 } | 1955 } |
| 1960 | 1956 |
| 1961 | 1957 |
| 1962 #undef __ | 1958 #undef __ |
| 1963 | 1959 |
| 1964 } } // namespace v8::internal | 1960 } } // namespace v8::internal |
| 1965 | 1961 |
| 1966 #endif // V8_TARGET_ARCH_MIPS | 1962 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |