| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 // Fall back to runtime if the target differs from the new target's | 4197 // Fall back to runtime if the target differs from the new target's |
| 4198 // initial map constructor. | 4198 // initial map constructor. |
| 4199 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); | 4199 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); |
| 4200 __ j(not_equal, &new_object); | 4200 __ j(not_equal, &new_object); |
| 4201 | 4201 |
| 4202 // Allocate the JSObject on the heap. | 4202 // Allocate the JSObject on the heap. |
| 4203 Label allocate, done_allocate; | 4203 Label allocate, done_allocate; |
| 4204 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); | 4204 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); |
| 4205 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); | 4205 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); |
| 4206 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); | 4206 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); |
| 4207 __ decp(rdi); // Untag result end. |
| 4207 __ bind(&done_allocate); | 4208 __ bind(&done_allocate); |
| 4208 | 4209 |
| 4209 // Initialize the JSObject fields. | 4210 // Initialize the JSObject fields. |
| 4210 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); | 4211 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); |
| 4211 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 4212 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
| 4212 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 4213 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
| 4213 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 4214 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
| 4214 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4215 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
| 4215 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); | 4216 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); |
| 4216 | 4217 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4345 __ bind(&no_rest_parameters); | 4346 __ bind(&no_rest_parameters); |
| 4346 { | 4347 { |
| 4347 // ----------- S t a t e ------------- | 4348 // ----------- S t a t e ------------- |
| 4348 // -- rsi : context | 4349 // -- rsi : context |
| 4349 // -- rsp[0] : return address | 4350 // -- rsp[0] : return address |
| 4350 // ----------------------------------- | 4351 // ----------------------------------- |
| 4351 | 4352 |
| 4352 // Allocate an empty rest parameter array. | 4353 // Allocate an empty rest parameter array. |
| 4353 Label allocate, done_allocate; | 4354 Label allocate, done_allocate; |
| 4354 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); | 4355 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); |
| 4356 __ decp(rdx); // Untag result end. |
| 4355 __ bind(&done_allocate); | 4357 __ bind(&done_allocate); |
| 4356 | 4358 |
| 4357 // Setup the rest parameter array in rax. | 4359 // Setup the rest parameter array in rax. |
| 4358 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); | 4360 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); |
| 4359 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); | 4361 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); |
| 4360 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); | 4362 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); |
| 4361 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); | 4363 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); |
| 4362 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); | 4364 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); |
| 4363 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); | 4365 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); |
| 4364 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4366 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5361 kStackUnwindSpace, nullptr, return_value_operand, | 5363 kStackUnwindSpace, nullptr, return_value_operand, |
| 5362 NULL); | 5364 NULL); |
| 5363 } | 5365 } |
| 5364 | 5366 |
| 5365 #undef __ | 5367 #undef __ |
| 5366 | 5368 |
| 5367 } // namespace internal | 5369 } // namespace internal |
| 5368 } // namespace v8 | 5370 } // namespace v8 |
| 5369 | 5371 |
| 5370 #endif // V8_TARGET_ARCH_X64 | 5372 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |