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

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

Issue 149133004: A64: Synchronize with r17807. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/version.cc ('k') | src/x64/deoptimizer-x64.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Isolate* isolate, 107 Isolate* isolate,
108 CodeStubInterfaceDescriptor* descriptor) { 108 CodeStubInterfaceDescriptor* descriptor) {
109 static Register registers[] = { rdx, rax }; 109 static Register registers[] = { rdx, rax };
110 descriptor->register_param_count_ = 2; 110 descriptor->register_param_count_ = 2;
111 descriptor->register_params_ = registers; 111 descriptor->register_params_ = registers;
112 descriptor->deoptimization_handler_ = 112 descriptor->deoptimization_handler_ =
113 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 113 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
114 } 114 }
115 115
116 116
117 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor(
118 Isolate* isolate,
119 CodeStubInterfaceDescriptor* descriptor) {
120 static Register registers[] = { rdx, rax };
121 descriptor->register_param_count_ = 2;
122 descriptor->register_params_ = registers;
123 descriptor->deoptimization_handler_ =
124 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
125 }
126
127
117 void LoadFieldStub::InitializeInterfaceDescriptor( 128 void LoadFieldStub::InitializeInterfaceDescriptor(
118 Isolate* isolate, 129 Isolate* isolate,
119 CodeStubInterfaceDescriptor* descriptor) { 130 CodeStubInterfaceDescriptor* descriptor) {
120 static Register registers[] = { rax }; 131 static Register registers[] = { rax };
121 descriptor->register_param_count_ = 1; 132 descriptor->register_param_count_ = 1;
122 descriptor->register_params_ = registers; 133 descriptor->register_params_ = registers;
123 descriptor->deoptimization_handler_ = NULL; 134 descriptor->deoptimization_handler_ = NULL;
124 } 135 }
125 136
126 137
127 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( 138 void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
128 Isolate* isolate, 139 Isolate* isolate,
129 CodeStubInterfaceDescriptor* descriptor) { 140 CodeStubInterfaceDescriptor* descriptor) {
130 static Register registers[] = { rdx }; 141 static Register registers[] = { rdx };
131 descriptor->register_param_count_ = 1; 142 descriptor->register_param_count_ = 1;
132 descriptor->register_params_ = registers; 143 descriptor->register_params_ = registers;
133 descriptor->deoptimization_handler_ = NULL; 144 descriptor->deoptimization_handler_ = NULL;
134 } 145 }
135 146
136 147
148 void KeyedArrayCallStub::InitializeInterfaceDescriptor(
149 Isolate* isolate,
150 CodeStubInterfaceDescriptor* descriptor) {
151 static Register registers[] = { rcx };
152 descriptor->register_param_count_ = 1;
153 descriptor->register_params_ = registers;
154 descriptor->continuation_type_ = TAIL_CALL_CONTINUATION;
155 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
156 descriptor->deoptimization_handler_ =
157 FUNCTION_ADDR(KeyedCallIC_MissFromStubFailure);
158 }
159
160
137 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( 161 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
138 Isolate* isolate, 162 Isolate* isolate,
139 CodeStubInterfaceDescriptor* descriptor) { 163 CodeStubInterfaceDescriptor* descriptor) {
140 static Register registers[] = { rdx, rcx, rax }; 164 static Register registers[] = { rdx, rcx, rax };
141 descriptor->register_param_count_ = 3; 165 descriptor->register_param_count_ = 3;
142 descriptor->register_params_ = registers; 166 descriptor->register_params_ = registers;
143 descriptor->deoptimization_handler_ = 167 descriptor->deoptimization_handler_ =
144 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); 168 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure);
145 } 169 }
146 170
(...skipping 22 matching lines...) Expand all
169 193
170 194
171 static void InitializeArrayConstructorDescriptor( 195 static void InitializeArrayConstructorDescriptor(
172 Isolate* isolate, 196 Isolate* isolate,
173 CodeStubInterfaceDescriptor* descriptor, 197 CodeStubInterfaceDescriptor* descriptor,
174 int constant_stack_parameter_count) { 198 int constant_stack_parameter_count) {
175 // register state 199 // register state
176 // rax -- number of arguments 200 // rax -- number of arguments
177 // rdi -- function 201 // rdi -- function
178 // rbx -- type info cell with elements kind 202 // rbx -- type info cell with elements kind
179 static Register registers[] = { rdi, rbx }; 203 static Register registers_variable_args[] = { rdi, rbx, rax };
180 descriptor->register_param_count_ = 2; 204 static Register registers_no_args[] = { rdi, rbx };
181 if (constant_stack_parameter_count != 0) { 205
206 if (constant_stack_parameter_count == 0) {
207 descriptor->register_param_count_ = 2;
208 descriptor->register_params_ = registers_no_args;
209 } else {
182 // stack param count needs (constructor pointer, and single argument) 210 // stack param count needs (constructor pointer, and single argument)
211 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
183 descriptor->stack_parameter_count_ = rax; 212 descriptor->stack_parameter_count_ = rax;
213 descriptor->register_param_count_ = 3;
214 descriptor->register_params_ = registers_variable_args;
184 } 215 }
216
185 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 217 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
186 descriptor->register_params_ = registers;
187 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 218 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
188 descriptor->deoptimization_handler_ = 219 descriptor->deoptimization_handler_ =
189 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; 220 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
190 } 221 }
191 222
192 223
193 static void InitializeInternalArrayConstructorDescriptor( 224 static void InitializeInternalArrayConstructorDescriptor(
194 Isolate* isolate, 225 Isolate* isolate,
195 CodeStubInterfaceDescriptor* descriptor, 226 CodeStubInterfaceDescriptor* descriptor,
196 int constant_stack_parameter_count) { 227 int constant_stack_parameter_count) {
197 // register state 228 // register state
198 // rax -- number of arguments 229 // rax -- number of arguments
199 // rdi -- constructor function 230 // rdi -- constructor function
200 static Register registers[] = { rdi }; 231 static Register registers_variable_args[] = { rdi, rax };
201 descriptor->register_param_count_ = 1; 232 static Register registers_no_args[] = { rdi };
202 233
203 if (constant_stack_parameter_count != 0) { 234 if (constant_stack_parameter_count == 0) {
235 descriptor->register_param_count_ = 1;
236 descriptor->register_params_ = registers_no_args;
237 } else {
204 // stack param count needs (constructor pointer, and single argument) 238 // stack param count needs (constructor pointer, and single argument)
239 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
205 descriptor->stack_parameter_count_ = rax; 240 descriptor->stack_parameter_count_ = rax;
241 descriptor->register_param_count_ = 2;
242 descriptor->register_params_ = registers_variable_args;
206 } 243 }
244
207 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 245 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
208 descriptor->register_params_ = registers;
209 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 246 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
210 descriptor->deoptimization_handler_ = 247 descriptor->deoptimization_handler_ =
211 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; 248 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
212 } 249 }
213 250
214 251
215 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 252 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
216 Isolate* isolate, 253 Isolate* isolate,
217 CodeStubInterfaceDescriptor* descriptor) { 254 CodeStubInterfaceDescriptor* descriptor) {
218 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); 255 InitializeArrayConstructorDescriptor(isolate, descriptor, 0);
(...skipping 3985 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 __ j(less, &copy_routine); 4241 __ j(less, &copy_routine);
4205 // Allocate new sliced string. At this point we do not reload the instance 4242 // Allocate new sliced string. At this point we do not reload the instance
4206 // type including the string encoding because we simply rely on the info 4243 // type including the string encoding because we simply rely on the info
4207 // provided by the original string. It does not matter if the original 4244 // provided by the original string. It does not matter if the original
4208 // string's encoding is wrong because we always have to recheck encoding of 4245 // string's encoding is wrong because we always have to recheck encoding of
4209 // the newly created string's parent anyways due to externalized strings. 4246 // the newly created string's parent anyways due to externalized strings.
4210 Label two_byte_slice, set_slice_header; 4247 Label two_byte_slice, set_slice_header;
4211 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); 4248 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0);
4212 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 4249 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
4213 __ testb(rbx, Immediate(kStringEncodingMask)); 4250 __ testb(rbx, Immediate(kStringEncodingMask));
4214 // Make long jumps when allocations tracking is on due to 4251 __ j(zero, &two_byte_slice, Label::kNear);
4215 // RecordObjectAllocation inside MacroAssembler::Allocate.
4216 Label::Distance jump_distance =
4217 masm->isolate()->heap_profiler()->is_tracking_allocations()
4218 ? Label::kFar
4219 : Label::kNear;
4220 __ j(zero, &two_byte_slice, jump_distance);
4221 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); 4252 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime);
4222 __ jmp(&set_slice_header, jump_distance); 4253 __ jmp(&set_slice_header, Label::kNear);
4223 __ bind(&two_byte_slice); 4254 __ bind(&two_byte_slice);
4224 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); 4255 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime);
4225 __ bind(&set_slice_header); 4256 __ bind(&set_slice_header);
4226 __ Integer32ToSmi(rcx, rcx); 4257 __ Integer32ToSmi(rcx, rcx);
4227 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); 4258 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx);
4228 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), 4259 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset),
4229 Immediate(String::kEmptyHashField)); 4260 Immediate(String::kEmptyHashField));
4230 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); 4261 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi);
4231 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); 4262 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx);
4232 __ IncrementCounter(counters->sub_string_native(), 1); 4263 __ IncrementCounter(counters->sub_string_native(), 1);
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
5438 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 5469 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
5439 __ PopReturnAddressTo(rcx); 5470 __ PopReturnAddressTo(rcx);
5440 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE 5471 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
5441 ? kPointerSize 5472 ? kPointerSize
5442 : 0; 5473 : 0;
5443 __ lea(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); 5474 __ lea(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset));
5444 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. 5475 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack.
5445 } 5476 }
5446 5477
5447 5478
5479 void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) {
5480 CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs);
5481 __ Call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET);
5482 __ movq(rdi, rax);
5483 int parameter_count_offset =
5484 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
5485 __ movq(rax, MemOperand(rbp, parameter_count_offset));
5486 // The parameter count above includes the receiver for the arguments passed to
5487 // the deoptimization handler. Subtract the receiver for the parameter count
5488 // for the call.
5489 __ subl(rax, Immediate(1));
5490 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
5491 ParameterCount argument_count(rax);
5492 __ InvokeFunction(
5493 rdi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
5494 }
5495
5496
5448 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 5497 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
5449 if (masm->isolate()->function_entry_hook() != NULL) { 5498 if (masm->isolate()->function_entry_hook() != NULL) {
5450 // It's always safe to call the entry hook stub, as the hook itself 5499 // It's always safe to call the entry hook stub, as the hook itself
5451 // is not allowed to call back to V8. 5500 // is not allowed to call back to V8.
5452 AllowStubCallsScope allow_stub_calls(masm, true); 5501 AllowStubCallsScope allow_stub_calls(masm, true);
5453 5502
5454 ProfileEntryHookStub stub; 5503 ProfileEntryHookStub stub;
5455 masm->CallStub(&stub); 5504 masm->CallStub(&stub);
5456 } 5505 }
5457 } 5506 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5573 // Fix kind and retry (only if we have an allocation site in the cell). 5622 // Fix kind and retry (only if we have an allocation site in the cell).
5574 __ incl(rdx); 5623 __ incl(rdx);
5575 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); 5624 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset));
5576 if (FLAG_debug_code) { 5625 if (FLAG_debug_code) {
5577 Handle<Map> allocation_site_map = 5626 Handle<Map> allocation_site_map =
5578 masm->isolate()->factory()->allocation_site_map(); 5627 masm->isolate()->factory()->allocation_site_map();
5579 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); 5628 __ Cmp(FieldOperand(rcx, 0), allocation_site_map);
5580 __ Assert(equal, kExpectedAllocationSiteInCell); 5629 __ Assert(equal, kExpectedAllocationSiteInCell);
5581 } 5630 }
5582 5631
5583 // Save the resulting elements kind in type info 5632 // Save the resulting elements kind in type info. We can't just store r3
5584 __ Integer32ToSmi(rdx, rdx); 5633 // in the AllocationSite::transition_info field because elements kind is
5585 __ movq(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), rdx); 5634 // restricted to a portion of the field...upper bits need to be left alone.
5586 __ SmiToInteger32(rdx, rdx); 5635 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5636 __ SmiAddConstant(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset),
5637 Smi::FromInt(kFastElementsKindPackedToHoley));
5587 5638
5588 __ bind(&normal_sequence); 5639 __ bind(&normal_sequence);
5589 int last_index = GetSequenceIndexFromFastElementsKind( 5640 int last_index = GetSequenceIndexFromFastElementsKind(
5590 TERMINAL_FAST_ELEMENTS_KIND); 5641 TERMINAL_FAST_ELEMENTS_KIND);
5591 for (int i = 0; i <= last_index; ++i) { 5642 for (int i = 0; i <= last_index; ++i) {
5592 Label next; 5643 Label next;
5593 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5644 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5594 __ cmpl(rdx, Immediate(kind)); 5645 __ cmpl(rdx, Immediate(kind));
5595 __ j(not_equal, &next); 5646 __ j(not_equal, &next);
5596 ArraySingleArgumentConstructorStub stub(kind); 5647 ArraySingleArgumentConstructorStub stub(kind);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5718 Label no_info; 5769 Label no_info;
5719 // If the type cell is undefined, or contains anything other than an 5770 // If the type cell is undefined, or contains anything other than an
5720 // AllocationSite, call an array constructor that doesn't use AllocationSites. 5771 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5721 __ Cmp(rbx, undefined_sentinel); 5772 __ Cmp(rbx, undefined_sentinel);
5722 __ j(equal, &no_info); 5773 __ j(equal, &no_info);
5723 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset)); 5774 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset));
5724 __ Cmp(FieldOperand(rdx, 0), 5775 __ Cmp(FieldOperand(rdx, 0),
5725 masm->isolate()->factory()->allocation_site_map()); 5776 masm->isolate()->factory()->allocation_site_map());
5726 __ j(not_equal, &no_info); 5777 __ j(not_equal, &no_info);
5727 5778
5779 // Only look at the lower 16 bits of the transition info.
5728 __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset)); 5780 __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset));
5729 __ SmiToInteger32(rdx, rdx); 5781 __ SmiToInteger32(rdx, rdx);
5782 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5783 __ and_(rdx, Immediate(AllocationSite::ElementsKindBits::kMask));
5730 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5784 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5731 5785
5732 __ bind(&no_info); 5786 __ bind(&no_info);
5733 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5787 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5734 } 5788 }
5735 5789
5736 5790
5737 void InternalArrayConstructorStub::GenerateCase( 5791 void InternalArrayConstructorStub::GenerateCase(
5738 MacroAssembler* masm, ElementsKind kind) { 5792 MacroAssembler* masm, ElementsKind kind) {
5739 Label not_zero_case, not_one_case; 5793 Label not_zero_case, not_one_case;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 __ bind(&fast_elements_case); 5876 __ bind(&fast_elements_case);
5823 GenerateCase(masm, FAST_ELEMENTS); 5877 GenerateCase(masm, FAST_ELEMENTS);
5824 } 5878 }
5825 5879
5826 5880
5827 #undef __ 5881 #undef __
5828 5882
5829 } } // namespace v8::internal 5883 } } // namespace v8::internal
5830 5884
5831 #endif // V8_TARGET_ARCH_X64 5885 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/deoptimizer-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698