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

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 883253002: Load API call data from function instead of embedding it in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename scratch_in Created 5 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
« no previous file with comments | « src/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 Handle<JSObject> holder_obj, IC::UtilityId id) { 123 Handle<JSObject> holder_obj, IC::UtilityId id) {
124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()),
126 NamedLoadHandlerCompiler::kInterceptorArgsLength); 126 NamedLoadHandlerCompiler::kInterceptorArgsLength);
127 } 127 }
128 128
129 129
130 // Generate call to api function. 130 // Generate call to api function.
131 void PropertyHandlerCompiler::GenerateApiAccessorCall( 131 void PropertyHandlerCompiler::GenerateApiAccessorCall(
132 MacroAssembler* masm, const CallOptimization& optimization, 132 MacroAssembler* masm, const CallOptimization& optimization,
133 Handle<Map> receiver_map, Register receiver, Register scratch_in, 133 Handle<Map> receiver_map, Register receiver, Register scratch,
134 bool is_store, Register store_parameter, Register accessor_holder, 134 bool is_store, Register store_parameter, Register accessor_holder,
135 int accessor_index) { 135 int accessor_index) {
136 DCHECK(!accessor_holder.is(scratch_in)); 136 DCHECK(!accessor_holder.is(scratch));
137 DCHECK(optimization.is_simple_api_call()); 137 DCHECK(optimization.is_simple_api_call());
138 138
139 __ PopReturnAddressTo(scratch_in); 139 __ PopReturnAddressTo(scratch);
140 // receiver 140 // receiver
141 __ Push(receiver); 141 __ Push(receiver);
142 // Write the arguments to stack frame. 142 // Write the arguments to stack frame.
143 if (is_store) { 143 if (is_store) {
144 DCHECK(!receiver.is(store_parameter)); 144 DCHECK(!receiver.is(store_parameter));
145 DCHECK(!scratch_in.is(store_parameter)); 145 DCHECK(!scratch.is(store_parameter));
146 __ Push(store_parameter); 146 __ Push(store_parameter);
147 } 147 }
148 __ PushReturnAddressFrom(scratch_in); 148 __ PushReturnAddressFrom(scratch);
149 // Stack now matches JSFunction abi. 149 // Stack now matches JSFunction abi.
150 150
151 // Abi for CallApiFunctionStub. 151 // Abi for CallApiFunctionStub.
152 Register callee = rdi; 152 Register callee = rdi;
153 Register call_data = rbx; 153 Register data = rbx;
154 Register holder = rcx; 154 Register holder = rcx;
155 Register api_function_address = rdx; 155 Register api_function_address = rdx;
156 Register scratch = rax; // scratch_in is no longer valid. 156 scratch = no_reg;
157 157
158 // Put callee in place. 158 // Put callee in place.
159 __ LoadAccessor(callee, accessor_holder, accessor_index, 159 __ LoadAccessor(callee, accessor_holder, accessor_index,
160 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); 160 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
161 161
162 // Put holder in place. 162 // Put holder in place.
163 CallOptimization::HolderLookup holder_lookup; 163 CallOptimization::HolderLookup holder_lookup;
164 Handle<JSObject> api_holder = 164 Handle<JSObject> api_holder =
165 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); 165 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
166 switch (holder_lookup) { 166 switch (holder_lookup) {
167 case CallOptimization::kHolderIsReceiver: 167 case CallOptimization::kHolderIsReceiver:
168 __ Move(holder, receiver); 168 __ Move(holder, receiver);
169 break; 169 break;
170 case CallOptimization::kHolderFound: 170 case CallOptimization::kHolderFound:
171 __ Move(holder, api_holder); 171 __ Move(holder, api_holder);
172 break; 172 break;
173 case CallOptimization::kHolderNotFound: 173 case CallOptimization::kHolderNotFound:
174 UNREACHABLE(); 174 UNREACHABLE();
175 break; 175 break;
176 } 176 }
177 177
178 Isolate* isolate = masm->isolate(); 178 Isolate* isolate = masm->isolate();
179 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 179 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
180 Handle<Object> call_data_obj(api_call_info->data(), isolate);
181
182 bool call_data_undefined = false; 180 bool call_data_undefined = false;
183 // Put call_data in place. 181 // Put call data in place.
184 if (isolate->heap()->InNewSpace(*call_data_obj)) { 182 if (api_call_info->data()->IsUndefined()) {
185 __ Move(scratch, api_call_info);
186 __ movp(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
187 } else if (call_data_obj->IsUndefined()) {
188 call_data_undefined = true; 183 call_data_undefined = true;
189 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 184 __ LoadRoot(data, Heap::kUndefinedValueRootIndex);
190 } else { 185 } else {
191 __ Move(call_data, call_data_obj); 186 __ movp(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
187 __ movp(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
188 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
189 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
192 } 190 }
193 191
194 // Put api_function_address in place. 192 // Put api_function_address in place.
195 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 193 Address function_address = v8::ToCData<Address>(api_call_info->callback());
196 __ Move(api_function_address, function_address, 194 __ Move(api_function_address, function_address,
197 RelocInfo::EXTERNAL_REFERENCE); 195 RelocInfo::EXTERNAL_REFERENCE);
198 196
199 // Jump to stub. 197 // Jump to stub.
200 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); 198 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
201 __ TailCallStub(&stub); 199 __ TailCallStub(&stub);
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // Return the generated code. 752 // Return the generated code.
755 return GetCode(kind(), Code::NORMAL, name); 753 return GetCode(kind(), Code::NORMAL, name);
756 } 754 }
757 755
758 756
759 #undef __ 757 #undef __
760 } 758 }
761 } // namespace v8::internal 759 } // namespace v8::internal
762 760
763 #endif // V8_TARGET_ARCH_X64 761 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698