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. | |
4312 __ bind(&done_allocate); | 4311 __ bind(&done_allocate); |
4313 | 4312 |
4314 // Initialize the JSObject fields. | 4313 // Initialize the JSObject fields. |
4315 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); | 4314 __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); |
4316 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); | 4315 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); |
4317 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 4316 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
4318 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 4317 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
4319 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4318 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
4320 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); | 4319 __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); |
4321 | 4320 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 __ bind(&no_rest_parameters); | 4449 __ bind(&no_rest_parameters); |
4451 { | 4450 { |
4452 // ----------- S t a t e ------------- | 4451 // ----------- S t a t e ------------- |
4453 // -- rsi : context | 4452 // -- rsi : context |
4454 // -- rsp[0] : return address | 4453 // -- rsp[0] : return address |
4455 // ----------------------------------- | 4454 // ----------------------------------- |
4456 | 4455 |
4457 // Allocate an empty rest parameter array. | 4456 // Allocate an empty rest parameter array. |
4458 Label allocate, done_allocate; | 4457 Label allocate, done_allocate; |
4459 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); | 4458 __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); |
4460 __ decp(rdx); // Untag result end. | |
4461 __ bind(&done_allocate); | 4459 __ bind(&done_allocate); |
4462 | 4460 |
4463 // Setup the rest parameter array in rax. | 4461 // Setup the rest parameter array in rax. |
4464 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); | 4462 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, rcx); |
4465 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); | 4463 __ movp(FieldOperand(rax, JSArray::kMapOffset), rcx); |
4466 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); | 4464 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); |
4467 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); | 4465 __ movp(FieldOperand(rax, JSArray::kPropertiesOffset), rcx); |
4468 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); | 4466 __ movp(FieldOperand(rax, JSArray::kElementsOffset), rcx); |
4469 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); | 4467 __ movp(FieldOperand(rax, JSArray::kLengthOffset), Immediate(0)); |
4470 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); | 4468 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5445 kStackUnwindSpace, nullptr, return_value_operand, | 5443 kStackUnwindSpace, nullptr, return_value_operand, |
5446 NULL); | 5444 NULL); |
5447 } | 5445 } |
5448 | 5446 |
5449 #undef __ | 5447 #undef __ |
5450 | 5448 |
5451 } // namespace internal | 5449 } // namespace internal |
5452 } // namespace v8 | 5450 } // namespace v8 |
5453 | 5451 |
5454 #endif // V8_TARGET_ARCH_X64 | 5452 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |