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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 __ addp(r8, Immediate(Heap::kSloppyArgumentsObjectSize)); | 657 __ addp(r8, Immediate(Heap::kSloppyArgumentsObjectSize)); |
658 | 658 |
659 // Do the allocation of all three objects in one go. | 659 // Do the allocation of all three objects in one go. |
660 __ Allocate(r8, rax, r9, no_reg, &runtime, TAG_OBJECT); | 660 __ Allocate(r8, rax, r9, no_reg, &runtime, TAG_OBJECT); |
661 | 661 |
662 // rax = address of new object(s) (tagged) | 662 // rax = address of new object(s) (tagged) |
663 // r11 = argument count (untagged) | 663 // r11 = argument count (untagged) |
664 // Get the arguments map from the current native context into r9. | 664 // Get the arguments map from the current native context into r9. |
665 Label has_mapped_parameters, instantiate; | 665 Label has_mapped_parameters, instantiate; |
666 __ movp(r9, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 666 __ movp(r9, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
667 __ movp(r9, FieldOperand(r9, GlobalObject::kNativeContextOffset)); | 667 __ movp(r9, FieldOperand(r9, JSGlobalObject::kNativeContextOffset)); |
668 __ testp(rbx, rbx); | 668 __ testp(rbx, rbx); |
669 __ j(not_zero, &has_mapped_parameters, Label::kNear); | 669 __ j(not_zero, &has_mapped_parameters, Label::kNear); |
670 | 670 |
671 const int kIndex = Context::SLOPPY_ARGUMENTS_MAP_INDEX; | 671 const int kIndex = Context::SLOPPY_ARGUMENTS_MAP_INDEX; |
672 __ movp(r9, Operand(r9, Context::SlotOffset(kIndex))); | 672 __ movp(r9, Operand(r9, Context::SlotOffset(kIndex))); |
673 __ jmp(&instantiate, Label::kNear); | 673 __ jmp(&instantiate, Label::kNear); |
674 | 674 |
675 const int kAliasedIndex = Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX; | 675 const int kAliasedIndex = Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX; |
676 __ bind(&has_mapped_parameters); | 676 __ bind(&has_mapped_parameters); |
677 __ movp(r9, Operand(r9, Context::SlotOffset(kAliasedIndex))); | 677 __ movp(r9, Operand(r9, Context::SlotOffset(kAliasedIndex))); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 __ j(zero, &add_arguments_object, Label::kNear); | 939 __ j(zero, &add_arguments_object, Label::kNear); |
940 __ leap(rax, Operand(rax, times_pointer_size, FixedArray::kHeaderSize)); | 940 __ leap(rax, Operand(rax, times_pointer_size, FixedArray::kHeaderSize)); |
941 __ bind(&add_arguments_object); | 941 __ bind(&add_arguments_object); |
942 __ addp(rax, Immediate(Heap::kStrictArgumentsObjectSize)); | 942 __ addp(rax, Immediate(Heap::kStrictArgumentsObjectSize)); |
943 | 943 |
944 // Do the allocation of both objects in one go. | 944 // Do the allocation of both objects in one go. |
945 __ Allocate(rax, rax, rbx, no_reg, &runtime, TAG_OBJECT); | 945 __ Allocate(rax, rax, rbx, no_reg, &runtime, TAG_OBJECT); |
946 | 946 |
947 // Get the arguments map from the current native context. | 947 // Get the arguments map from the current native context. |
948 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 948 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
949 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); | 949 __ movp(rdi, FieldOperand(rdi, JSGlobalObject::kNativeContextOffset)); |
950 const int offset = Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX); | 950 const int offset = Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX); |
951 __ movp(rdi, Operand(rdi, offset)); | 951 __ movp(rdi, Operand(rdi, offset)); |
952 | 952 |
953 __ movp(FieldOperand(rax, JSObject::kMapOffset), rdi); | 953 __ movp(FieldOperand(rax, JSObject::kMapOffset), rdi); |
954 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex); | 954 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex); |
955 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister); | 955 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister); |
956 __ movp(FieldOperand(rax, JSObject::kElementsOffset), kScratchRegister); | 956 __ movp(FieldOperand(rax, JSObject::kElementsOffset), kScratchRegister); |
957 | 957 |
958 // Get the length (smi tagged) and set that as an in-object property too. | 958 // Get the length (smi tagged) and set that as an in-object property too. |
959 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 959 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
(...skipping 4635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5595 kStackSpace, nullptr, return_value_operand, NULL); | 5595 kStackSpace, nullptr, return_value_operand, NULL); |
5596 } | 5596 } |
5597 | 5597 |
5598 | 5598 |
5599 #undef __ | 5599 #undef __ |
5600 | 5600 |
5601 } // namespace internal | 5601 } // namespace internal |
5602 } // namespace v8 | 5602 } // namespace v8 |
5603 | 5603 |
5604 #endif // V8_TARGET_ARCH_X64 | 5604 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |