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 4290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4301 // Fall back to runtime if the target differs from the new target's | 4301 // Fall back to runtime if the target differs from the new target's |
4302 // initial map constructor. | 4302 // initial map constructor. |
4303 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); | 4303 __ cmpp(rdi, FieldOperand(rcx, Map::kConstructorOrBackPointerOffset)); |
4304 __ j(not_equal, &new_object); | 4304 __ j(not_equal, &new_object); |
4305 | 4305 |
4306 // Allocate the JSObject on the heap. | 4306 // Allocate the JSObject on the heap. |
4307 Label allocate, done_allocate; | 4307 Label allocate, done_allocate; |
4308 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); | 4308 __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); |
4309 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); | 4309 __ leal(rbx, Operand(rbx, times_pointer_size, 0)); |
4310 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); | 4310 __ Allocate(rbx, rax, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); |
| 4311 __ decp(rdi); // Untag result end. |
4311 __ bind(&done_allocate); | 4312 __ bind(&done_allocate); |
4312 | 4313 |
4313 // Initialize the JSObject fields. | 4314 // Initialize the JSObject fields. |
4314 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); | 4315 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); |
4315 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 4316 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
4316 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 4317 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
4317 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 4318 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
4318 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4319 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
4319 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); | 4320 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); |
4320 | 4321 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4449 __ bind(&no_rest_parameters); | 4450 __ bind(&no_rest_parameters); |
4450 { | 4451 { |
4451 // ----------- S t a t e ------------- | 4452 // ----------- S t a t e ------------- |
4452 // -- rsi : context | 4453 // -- rsi : context |
4453 // -- rsp[0] : return address | 4454 // -- rsp[0] : return address |
4454 // ----------------------------------- | 4455 // ----------------------------------- |
4455 | 4456 |
4456 // Allocate an empty rest parameter array. | 4457 // Allocate an empty rest parameter array. |
4457 Label allocate, done_allocate; | 4458 Label allocate, done_allocate; |
4458 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); | 4459 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); |
| 4460 __ decp(rdx); // Untag result end. |
4459 __ bind(&done_allocate); | 4461 __ bind(&done_allocate); |
4460 | 4462 |
4461 // Setup the rest parameter array in rax. | 4463 // Setup the rest parameter array in rax. |
4462 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); | 4464 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); |
4463 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); | 4465 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); |
4464 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); | 4466 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); |
4465 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); | 4467 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); |
4466 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); | 4468 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); |
4467 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); | 4469 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); |
4468 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4470 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5443 kStackUnwindSpace, nullptr, return_value_operand, | 5445 kStackUnwindSpace, nullptr, return_value_operand, |
5444 NULL); | 5446 NULL); |
5445 } | 5447 } |
5446 | 5448 |
5447 #undef __ | 5449 #undef __ |
5448 | 5450 |
5449 } // namespace internal | 5451 } // namespace internal |
5450 } // namespace v8 | 5452 } // namespace v8 |
5451 | 5453 |
5452 #endif // V8_TARGET_ARCH_X64 | 5454 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |