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 4298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4309 // Fall back to runtime if the target differs from the new target's | 4309 // Fall back to runtime if the target differs from the new target's |
4310 // initial map constructor. | 4310 // initial map constructor. |
4311 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); | 4311 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); |
4312 __ j(not_equal, &new_object); | 4312 __ j(not_equal, &new_object); |
4313 | 4313 |
4314 // Allocate the JSObject on the heap. | 4314 // Allocate the JSObject on the heap. |
4315 Label allocate, done_allocate; | 4315 Label allocate, done_allocate; |
4316 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); | 4316 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); |
4317 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); | 4317 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); |
4318 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); | 4318 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); |
| 4319 __ decp(rdi); // Untag result end. |
4319 __ bind(&done_allocate); | 4320 __ bind(&done_allocate); |
4320 | 4321 |
4321 // Initialize the JSObject fields. | 4322 // Initialize the JSObject fields. |
4322 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); | 4323 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); |
4323 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 4324 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
4324 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 4325 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
4325 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 4326 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
4326 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4327 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
4327 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); | 4328 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); |
4328 | 4329 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4457 __ bind(&no_rest_parameters); | 4458 __ bind(&no_rest_parameters); |
4458 { | 4459 { |
4459 // ----------- S t a t e ------------- | 4460 // ----------- S t a t e ------------- |
4460 // -- rsi : context | 4461 // -- rsi : context |
4461 // -- rsp[0] : return address | 4462 // -- rsp[0] : return address |
4462 // ----------------------------------- | 4463 // ----------------------------------- |
4463 | 4464 |
4464 // Allocate an empty rest parameter array. | 4465 // Allocate an empty rest parameter array. |
4465 Label allocate, done_allocate; | 4466 Label allocate, done_allocate; |
4466 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); | 4467 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); |
| 4468 __ decp(rdx); // Untag result end. |
4467 __ bind(&done_allocate); | 4469 __ bind(&done_allocate); |
4468 | 4470 |
4469 // Setup the rest parameter array in rax. | 4471 // Setup the rest parameter array in rax. |
4470 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); | 4472 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); |
4471 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); | 4473 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); |
4472 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); | 4474 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); |
4473 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); | 4475 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); |
4474 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); | 4476 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); |
4475 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); | 4477 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); |
4476 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4478 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5451 kStackUnwindSpace, nullptr, return_value_operand, | 5453 kStackUnwindSpace, nullptr, return_value_operand, |
5452 NULL); | 5454 NULL); |
5453 } | 5455 } |
5454 | 5456 |
5455 #undef __ | 5457 #undef __ |
5456 | 5458 |
5457 } // namespace internal | 5459 } // namespace internal |
5458 } // namespace v8 | 5460 } // namespace v8 |
5459 | 5461 |
5460 #endif // V8_TARGET_ARCH_X64 | 5462 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |