Chromium Code Reviews

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

Issue 836093007: split api call stubs into accessor and function call stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arm Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/ic/handler-compiler.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 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_ARM 7 #if V8_TARGET_ARCH_ARM
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 211 matching lines...)
222 static void CompileCallLoadPropertyWithInterceptor( 222 static void CompileCallLoadPropertyWithInterceptor(
223 MacroAssembler* masm, Register receiver, Register holder, Register name, 223 MacroAssembler* masm, Register receiver, Register holder, Register name,
224 Handle<JSObject> holder_obj, IC::UtilityId id) { 224 Handle<JSObject> holder_obj, IC::UtilityId id) {
225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 225 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 226 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()),
227 NamedLoadHandlerCompiler::kInterceptorArgsLength); 227 NamedLoadHandlerCompiler::kInterceptorArgsLength);
228 } 228 }
229 229
230 230
231 // Generate call to api function. 231 // Generate call to api function.
232 void PropertyHandlerCompiler::GenerateFastApiCall( 232 void PropertyHandlerCompiler::GenerateApiAccessorCall(
233 MacroAssembler* masm, const CallOptimization& optimization, 233 MacroAssembler* masm, const CallOptimization& optimization,
234 Handle<Map> receiver_map, Register receiver, Register scratch_in, 234 Handle<Map> receiver_map, Register receiver, Register scratch_in,
235 bool is_store, int argc, Register* values) { 235 bool is_store, Register store_parameter) {
236 DCHECK(!receiver.is(scratch_in)); 236 DCHECK(!receiver.is(scratch_in));
237 __ push(receiver); 237 __ push(receiver);
238 // Write the arguments to stack frame. 238 // Write the arguments to stack frame.
239 for (int i = 0; i < argc; i++) { 239 if (is_store) {
240 Register arg = values[argc - 1 - i]; 240 DCHECK(!receiver.is(store_parameter));
241 DCHECK(!receiver.is(arg)); 241 DCHECK(!scratch_in.is(store_parameter));
242 DCHECK(!scratch_in.is(arg)); 242 __ push(store_parameter);
243 __ push(arg);
244 } 243 }
245 DCHECK(optimization.is_simple_api_call()); 244 DCHECK(optimization.is_simple_api_call());
246 245
247 // Abi for CallApiFunctionStub. 246 // Abi for CallApiFunctionStub.
248 Register callee = r0; 247 Register callee = r0;
249 Register call_data = r4; 248 Register call_data = r4;
250 Register holder = r2; 249 Register holder = r2;
251 Register api_function_address = r1; 250 Register api_function_address = r1;
252 251
253 // Put holder in place. 252 // Put holder in place.
(...skipping 13 matching lines...)
267 } 266 }
268 267
269 Isolate* isolate = masm->isolate(); 268 Isolate* isolate = masm->isolate();
270 Handle<JSFunction> function = optimization.constant_function(); 269 Handle<JSFunction> function = optimization.constant_function();
271 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 270 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
272 Handle<Object> call_data_obj(api_call_info->data(), isolate); 271 Handle<Object> call_data_obj(api_call_info->data(), isolate);
273 272
274 // Put callee in place. 273 // Put callee in place.
275 __ Move(callee, function); 274 __ Move(callee, function);
276 275
276 // Put call_data in place.
277 bool call_data_undefined = false; 277 bool call_data_undefined = false;
jochen (gone - plz use gerrit) 2015/01/15 19:28:24 nit. undo this change
278 // Put call_data in place.
279 if (isolate->heap()->InNewSpace(*call_data_obj)) { 278 if (isolate->heap()->InNewSpace(*call_data_obj)) {
280 __ Move(call_data, api_call_info); 279 __ Move(call_data, api_call_info);
281 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); 280 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
282 } else if (call_data_obj->IsUndefined()) { 281 } else if (call_data_obj->IsUndefined()) {
283 call_data_undefined = true; 282 call_data_undefined = true;
284 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 283 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
285 } else { 284 } else {
286 __ Move(call_data, call_data_obj); 285 __ Move(call_data, call_data_obj);
287 } 286 }
288 287
289 // Put api_function_address in place. 288 // Put api_function_address in place.
290 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 289 Address function_address = v8::ToCData<Address>(api_call_info->callback());
291 ApiFunction fun(function_address); 290 ApiFunction fun(function_address);
292 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; 291 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
293 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); 292 ExternalReference ref = ExternalReference(&fun, type, masm->isolate());
294 __ mov(api_function_address, Operand(ref)); 293 __ mov(api_function_address, Operand(ref));
295 294
296 // Jump to stub. 295 // Jump to stub.
297 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc); 296 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
298 __ TailCallStub(&stub); 297 __ TailCallStub(&stub);
299 } 298 }
300 299
301 300
302 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { 301 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
303 // Push receiver, key and value for runtime call. 302 // Push receiver, key and value for runtime call.
304 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 303 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
305 StoreDescriptor::ValueRegister()); 304 StoreDescriptor::ValueRegister());
306 305
307 // The slow case calls into the runtime to complete the store without causing 306 // The slow case calls into the runtime to complete the store without causing
(...skipping 419 matching lines...)
727 // Return the generated code. 726 // Return the generated code.
728 return GetCode(kind(), Code::NORMAL, name); 727 return GetCode(kind(), Code::NORMAL, name);
729 } 728 }
730 729
731 730
732 #undef __ 731 #undef __
733 } 732 }
734 } // namespace v8::internal 733 } // namespace v8::internal
735 734
736 #endif // V8_TARGET_ARCH_ARM 735 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/ic/handler-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine