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

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

Issue 148333003: crankshaft support for api method calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase 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 | « no previous file | src/arm/macro-assembler-arm.h » ('j') | src/stub-cache.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 }; 435 };
436 static Representation representations[] = { 436 static Representation representations[] = {
437 Representation::Tagged(), // context 437 Representation::Tagged(), // context
438 Representation::Tagged(), // receiver 438 Representation::Tagged(), // receiver
439 }; 439 };
440 descriptor->register_param_count_ = 2; 440 descriptor->register_param_count_ = 2;
441 descriptor->register_params_ = registers; 441 descriptor->register_params_ = registers;
442 descriptor->param_representations_ = representations; 442 descriptor->param_representations_ = representations;
443 descriptor->platform_specific_descriptor_ = &default_descriptor; 443 descriptor->platform_specific_descriptor_ = &default_descriptor;
444 } 444 }
445 {
446 CallInterfaceDescriptor* descriptor =
447 isolate->call_descriptor(Isolate::ApiFunctionCall);
448 static Register registers[] = { r0, // callee
449 r4, // call_data
450 r2, // holder
451 r1, // api_function_address
452 cp, // context
453 };
454 static Representation representations[] = {
455 Representation::Tagged(), // callee
456 Representation::Tagged(), // call_data
457 Representation::Tagged(), // holder
458 Representation::External(), // api_function_address
459 Representation::Tagged(), // context
460 };
461 descriptor->register_param_count_ = 5;
462 descriptor->register_params_ = registers;
463 descriptor->param_representations_ = representations;
464 descriptor->platform_specific_descriptor_ = &default_descriptor;
465 }
445 } 466 }
446 467
447 468
448 #define __ ACCESS_MASM(masm) 469 #define __ ACCESS_MASM(masm)
449 470
450 471
451 static void EmitIdenticalObjectComparison(MacroAssembler* masm, 472 static void EmitIdenticalObjectComparison(MacroAssembler* masm,
452 Label* slow, 473 Label* slow,
453 Condition cond); 474 Condition cond);
454 static void EmitSmiNonsmiComparison(MacroAssembler* masm, 475 static void EmitSmiNonsmiComparison(MacroAssembler* masm,
(...skipping 4996 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 __ bind(&fast_elements_case); 5472 __ bind(&fast_elements_case);
5452 GenerateCase(masm, FAST_ELEMENTS); 5473 GenerateCase(masm, FAST_ELEMENTS);
5453 } 5474 }
5454 5475
5455 5476
5456 void CallApiFunctionStub::Generate(MacroAssembler* masm) { 5477 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5457 // ----------- S t a t e ------------- 5478 // ----------- S t a t e -------------
5458 // -- r0 : callee 5479 // -- r0 : callee
5459 // -- r4 : call_data 5480 // -- r4 : call_data
5460 // -- r2 : holder 5481 // -- r2 : holder
5461 // -- r3 : api_function_address 5482 // -- r1 : api_function_address
5462 // -- r1 : thunk_arg
5463 // -- cp : context 5483 // -- cp : context
5464 // -- 5484 // --
5465 // -- esp[0] : last argument 5485 // -- esp[0] : last argument
5466 // -- ... 5486 // -- ...
5467 // -- esp[(argc - 1)* 4] : first argument 5487 // -- esp[(argc - 1)* 4] : first argument
5468 // -- esp[argc * 4] : receiver 5488 // -- esp[argc * 4] : receiver
5469 // ----------------------------------- 5489 // -----------------------------------
5470 5490
5471 Register callee = r0; 5491 Register callee = r0;
5472 Register call_data = r4; 5492 Register call_data = r4;
5473 Register holder = r2; 5493 Register holder = r2;
5474 Register api_function_address = r3; 5494 Register api_function_address = r1;
5475 Register thunk_arg = r1;
5476 Register context = cp; 5495 Register context = cp;
5477 5496
5478 int argc = ArgumentBits::decode(bit_field_); 5497 int argc = ArgumentBits::decode(bit_field_);
5479 bool restore_context = RestoreContextBits::decode(bit_field_); 5498 bool restore_context = RestoreContextBits::decode(bit_field_);
5480 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); 5499 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
5481 5500
5482 typedef FunctionCallbackArguments FCA; 5501 typedef FunctionCallbackArguments FCA;
5483 5502
5484 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5503 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5485 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5504 STATIC_ASSERT(FCA::kCalleeIndex == 5);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 // Prepare arguments. 5540 // Prepare arguments.
5522 __ mov(scratch, sp); 5541 __ mov(scratch, sp);
5523 5542
5524 // Allocate the v8::Arguments structure in the arguments' space since 5543 // Allocate the v8::Arguments structure in the arguments' space since
5525 // it's not controlled by GC. 5544 // it's not controlled by GC.
5526 const int kApiStackSpace = 4; 5545 const int kApiStackSpace = 4;
5527 5546
5528 FrameScope frame_scope(masm, StackFrame::MANUAL); 5547 FrameScope frame_scope(masm, StackFrame::MANUAL);
5529 __ EnterExitFrame(false, kApiStackSpace); 5548 __ EnterExitFrame(false, kApiStackSpace);
5530 5549
5531 ASSERT(!thunk_arg.is(r0) && !api_function_address.is(r0) && !scratch.is(r0)); 5550 ASSERT(!api_function_address.is(r0) && !scratch.is(r0));
5532 // r0 = FunctionCallbackInfo& 5551 // r0 = FunctionCallbackInfo&
5533 // Arguments is after the return address. 5552 // Arguments is after the return address.
5534 __ add(r0, sp, Operand(1 * kPointerSize)); 5553 __ add(r0, sp, Operand(1 * kPointerSize));
5535 // FunctionCallbackInfo::implicit_args_ 5554 // FunctionCallbackInfo::implicit_args_
5536 __ str(scratch, MemOperand(r0, 0 * kPointerSize)); 5555 __ str(scratch, MemOperand(r0, 0 * kPointerSize));
5537 // FunctionCallbackInfo::values_ 5556 // FunctionCallbackInfo::values_
5538 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize)); 5557 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize));
5539 __ str(ip, MemOperand(r0, 1 * kPointerSize)); 5558 __ str(ip, MemOperand(r0, 1 * kPointerSize));
5540 // FunctionCallbackInfo::length_ = argc 5559 // FunctionCallbackInfo::length_ = argc
5541 __ mov(ip, Operand(argc)); 5560 __ mov(ip, Operand(argc));
(...skipping 10 matching lines...) Expand all
5552 masm->isolate()); 5571 masm->isolate());
5553 5572
5554 AllowExternalCallThatCantCauseGC scope(masm); 5573 AllowExternalCallThatCantCauseGC scope(masm);
5555 MemOperand context_restore_operand( 5574 MemOperand context_restore_operand(
5556 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5575 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5557 MemOperand return_value_operand(fp, 5576 MemOperand return_value_operand(fp,
5558 (2 + FCA::kReturnValueOffset) * kPointerSize); 5577 (2 + FCA::kReturnValueOffset) * kPointerSize);
5559 5578
5560 __ CallApiFunctionAndReturn(api_function_address, 5579 __ CallApiFunctionAndReturn(api_function_address,
5561 thunk_ref, 5580 thunk_ref,
5562 thunk_arg,
5563 kStackUnwindSpace, 5581 kStackUnwindSpace,
5564 return_value_operand, 5582 return_value_operand,
5565 restore_context ? 5583 restore_context ?
5566 &context_restore_operand : NULL); 5584 &context_restore_operand : NULL);
5567 } 5585 }
5568 5586
5569 5587
5570 #undef __ 5588 #undef __
5571 5589
5572 } } // namespace v8::internal 5590 } } // namespace v8::internal
5573 5591
5574 #endif // V8_TARGET_ARCH_ARM 5592 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | src/stub-cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698