Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 358363003: Only create arguments-maps in the bootstrapper, remove now obsolete ValueType flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments and reformat Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/cctest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 __ leap(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize)); 915 __ leap(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize));
916 916
917 // 3. Arguments object. 917 // 3. Arguments object.
918 __ addp(r8, Immediate(Heap::kSloppyArgumentsObjectSize)); 918 __ addp(r8, Immediate(Heap::kSloppyArgumentsObjectSize));
919 919
920 // Do the allocation of all three objects in one go. 920 // Do the allocation of all three objects in one go.
921 __ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT); 921 __ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT);
922 922
923 // rax = address of new object(s) (tagged) 923 // rax = address of new object(s) (tagged)
924 // rcx = argument count (untagged) 924 // rcx = argument count (untagged)
925 // Get the arguments boilerplate from the current native context into rdi. 925 // Get the arguments map from the current native context into rdi.
926 Label has_mapped_parameters, copy; 926 Label has_mapped_parameters, instantiate;
927 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 927 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
928 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); 928 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
929 __ testp(rbx, rbx); 929 __ testp(rbx, rbx);
930 __ j(not_zero, &has_mapped_parameters, Label::kNear); 930 __ j(not_zero, &has_mapped_parameters, Label::kNear);
931 931
932 const int kIndex = Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX; 932 const int kIndex = Context::SLOPPY_ARGUMENTS_MAP_INDEX;
933 __ movp(rdi, Operand(rdi, Context::SlotOffset(kIndex))); 933 __ movp(rdi, Operand(rdi, Context::SlotOffset(kIndex)));
934 __ jmp(&copy, Label::kNear); 934 __ jmp(&instantiate, Label::kNear);
935 935
936 const int kAliasedIndex = Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX; 936 const int kAliasedIndex = Context::ALIASED_ARGUMENTS_MAP_INDEX;
937 __ bind(&has_mapped_parameters); 937 __ bind(&has_mapped_parameters);
938 __ movp(rdi, Operand(rdi, Context::SlotOffset(kAliasedIndex))); 938 __ movp(rdi, Operand(rdi, Context::SlotOffset(kAliasedIndex)));
939 __ bind(&copy); 939 __ bind(&instantiate);
940 940
941 // rax = address of new object (tagged) 941 // rax = address of new object (tagged)
942 // rbx = mapped parameter count (untagged) 942 // rbx = mapped parameter count (untagged)
943 // rcx = argument count (untagged) 943 // rcx = argument count (untagged)
944 // rdi = address of boilerplate object (tagged) 944 // rdi = address of arguments map (tagged)
945 // Copy the JS object part. 945 __ movp(FieldOperand(rax, JSObject::kMapOffset), rdi);
946 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 946 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex);
947 __ movp(rdx, FieldOperand(rdi, i)); 947 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister);
948 __ movp(FieldOperand(rax, i), rdx); 948 __ movp(FieldOperand(rax, JSObject::kElementsOffset), kScratchRegister);
949 }
950 949
951 // Set up the callee in-object property. 950 // Set up the callee in-object property.
952 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); 951 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
953 __ movp(rdx, args.GetArgumentOperand(0)); 952 __ movp(rdx, args.GetArgumentOperand(0));
953 __ AssertNotSmi(rdx);
954 __ movp(FieldOperand(rax, JSObject::kHeaderSize + 954 __ movp(FieldOperand(rax, JSObject::kHeaderSize +
955 Heap::kArgumentsCalleeIndex * kPointerSize), 955 Heap::kArgumentsCalleeIndex * kPointerSize),
956 rdx); 956 rdx);
957 957
958 // Use the length (smi tagged) and set that as an in-object property too. 958 // Use the length (smi tagged) and set that as an in-object property too.
959 // Note: rcx is tagged from here on. 959 // Note: rcx is tagged from here on.
960 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); 960 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
961 __ Integer32ToSmi(rcx, rcx); 961 __ Integer32ToSmi(rcx, rcx);
962 __ movp(FieldOperand(rax, JSObject::kHeaderSize + 962 __ movp(FieldOperand(rax, JSObject::kHeaderSize +
963 Heap::kArgumentsLengthIndex * kPointerSize), 963 Heap::kArgumentsLengthIndex * kPointerSize),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 __ bind(&try_allocate); 1133 __ bind(&try_allocate);
1134 __ testp(rcx, rcx); 1134 __ testp(rcx, rcx);
1135 __ j(zero, &add_arguments_object, Label::kNear); 1135 __ j(zero, &add_arguments_object, Label::kNear);
1136 __ leap(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize)); 1136 __ leap(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize));
1137 __ bind(&add_arguments_object); 1137 __ bind(&add_arguments_object);
1138 __ addp(rcx, Immediate(Heap::kStrictArgumentsObjectSize)); 1138 __ addp(rcx, Immediate(Heap::kStrictArgumentsObjectSize));
1139 1139
1140 // Do the allocation of both objects in one go. 1140 // Do the allocation of both objects in one go.
1141 __ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT); 1141 __ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT);
1142 1142
1143 // Get the arguments boilerplate from the current native context. 1143 // Get the arguments map from the current native context.
1144 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 1144 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
1145 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); 1145 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
1146 const int offset = 1146 const int offset = Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX);
1147 Context::SlotOffset(Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX);
1148 __ movp(rdi, Operand(rdi, offset)); 1147 __ movp(rdi, Operand(rdi, offset));
1149 1148
1150 // Copy the JS object part. 1149 __ movp(FieldOperand(rax, JSObject::kMapOffset), rdi);
1151 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 1150 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex);
1152 __ movp(rbx, FieldOperand(rdi, i)); 1151 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister);
1153 __ movp(FieldOperand(rax, i), rbx); 1152 __ movp(FieldOperand(rax, JSObject::kElementsOffset), kScratchRegister);
1154 }
1155 1153
1156 // Get the length (smi tagged) and set that as an in-object property too. 1154 // Get the length (smi tagged) and set that as an in-object property too.
1157 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); 1155 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
1158 __ movp(rcx, args.GetArgumentOperand(2)); 1156 __ movp(rcx, args.GetArgumentOperand(2));
1159 __ movp(FieldOperand(rax, JSObject::kHeaderSize + 1157 __ movp(FieldOperand(rax, JSObject::kHeaderSize +
1160 Heap::kArgumentsLengthIndex * kPointerSize), 1158 Heap::kArgumentsLengthIndex * kPointerSize),
1161 rcx); 1159 rcx);
1162 1160
1163 // If there are no actual arguments, we're done. 1161 // If there are no actual arguments, we're done.
1164 Label done; 1162 Label done;
(...skipping 3776 matching lines...) Expand 10 before | Expand all | Expand 10 after
4941 return_value_operand, 4939 return_value_operand,
4942 NULL); 4940 NULL);
4943 } 4941 }
4944 4942
4945 4943
4946 #undef __ 4944 #undef __
4947 4945
4948 } } // namespace v8::internal 4946 } } // namespace v8::internal
4949 4947
4950 #endif // V8_TARGET_ARCH_X64 4948 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698