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

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

Issue 150913002: MIPS: crankshaft support for api method calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | « no previous file | src/mips/macro-assembler-mips.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 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 a0, // receiver 437 a0, // receiver
438 }; 438 };
439 static Representation representations[] = { 439 static Representation representations[] = {
440 Representation::Tagged(), // context 440 Representation::Tagged(), // context
441 Representation::Tagged(), // receiver 441 Representation::Tagged(), // receiver
442 }; 442 };
443 descriptor->register_param_count_ = 2; 443 descriptor->register_param_count_ = 2;
444 descriptor->register_params_ = registers; 444 descriptor->register_params_ = registers;
445 descriptor->param_representations_ = representations; 445 descriptor->param_representations_ = representations;
446 } 446 }
447 {
448 CallInterfaceDescriptor* descriptor =
449 isolate->call_descriptor(Isolate::ApiFunctionCall);
450 static Register registers[] = { a0, // callee
451 t0, // call_data
452 a2, // holder
453 a1, // api_function_address
454 cp, // context
455 };
456 static Representation representations[] = {
457 Representation::Tagged(), // callee
458 Representation::Tagged(), // call_data
459 Representation::Tagged(), // holder
460 Representation::External(), // api_function_address
461 Representation::Tagged(), // context
462 };
463 descriptor->register_param_count_ = 5;
464 descriptor->register_params_ = registers;
465 descriptor->param_representations_ = representations;
466 }
447 } 467 }
448 468
449 469
450 #define __ ACCESS_MASM(masm) 470 #define __ ACCESS_MASM(masm)
451 471
452 472
453 static void EmitIdenticalObjectComparison(MacroAssembler* masm, 473 static void EmitIdenticalObjectComparison(MacroAssembler* masm,
454 Label* slow, 474 Label* slow,
455 Condition cc); 475 Condition cc);
456 static void EmitSmiNonsmiComparison(MacroAssembler* masm, 476 static void EmitSmiNonsmiComparison(MacroAssembler* masm,
(...skipping 5097 matching lines...) Expand 10 before | Expand all | Expand 10 after
5554 __ bind(&fast_elements_case); 5574 __ bind(&fast_elements_case);
5555 GenerateCase(masm, FAST_ELEMENTS); 5575 GenerateCase(masm, FAST_ELEMENTS);
5556 } 5576 }
5557 5577
5558 5578
5559 void CallApiFunctionStub::Generate(MacroAssembler* masm) { 5579 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5560 // ----------- S t a t e ------------- 5580 // ----------- S t a t e -------------
5561 // -- a0 : callee 5581 // -- a0 : callee
5562 // -- t0 : call_data 5582 // -- t0 : call_data
5563 // -- a2 : holder 5583 // -- a2 : holder
5564 // -- a3 : api_function_address 5584 // -- a1 : api_function_address
5565 // -- a1 : thunk_arg
5566 // -- cp : context 5585 // -- cp : context
5567 // -- 5586 // --
5568 // -- sp[0] : last argument 5587 // -- sp[0] : last argument
5569 // -- ... 5588 // -- ...
5570 // -- sp[(argc - 1)* 4] : first argument 5589 // -- sp[(argc - 1)* 4] : first argument
5571 // -- sp[argc * 4] : receiver 5590 // -- sp[argc * 4] : receiver
5572 // ----------------------------------- 5591 // -----------------------------------
5573 5592
5574 Register callee = a0; 5593 Register callee = a0;
5575 Register call_data = t0; 5594 Register call_data = t0;
5576 Register holder = a2; 5595 Register holder = a2;
5577 Register api_function_address = a3; 5596 Register api_function_address = a1;
5578 Register thunk_arg = a1;
5579 Register context = cp; 5597 Register context = cp;
5580 5598
5581 int argc = ArgumentBits::decode(bit_field_); 5599 int argc = ArgumentBits::decode(bit_field_);
5582 bool restore_context = RestoreContextBits::decode(bit_field_); 5600 bool restore_context = RestoreContextBits::decode(bit_field_);
5583 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); 5601 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
5584 5602
5585 typedef FunctionCallbackArguments FCA; 5603 typedef FunctionCallbackArguments FCA;
5586 5604
5587 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5605 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5588 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5606 STATIC_ASSERT(FCA::kCalleeIndex == 5);
(...skipping 25 matching lines...) Expand all
5614 // Prepare arguments. 5632 // Prepare arguments.
5615 __ mov(scratch, sp); 5633 __ mov(scratch, sp);
5616 5634
5617 // Allocate the v8::Arguments structure in the arguments' space since 5635 // Allocate the v8::Arguments structure in the arguments' space since
5618 // it's not controlled by GC. 5636 // it's not controlled by GC.
5619 const int kApiStackSpace = 4; 5637 const int kApiStackSpace = 4;
5620 5638
5621 FrameScope frame_scope(masm, StackFrame::MANUAL); 5639 FrameScope frame_scope(masm, StackFrame::MANUAL);
5622 __ EnterExitFrame(false, kApiStackSpace); 5640 __ EnterExitFrame(false, kApiStackSpace);
5623 5641
5624 ASSERT(!thunk_arg.is(a0) && !api_function_address.is(a0) && !scratch.is(a0)); 5642 ASSERT(!api_function_address.is(a0) && !scratch.is(a0));
5625 // a0 = FunctionCallbackInfo& 5643 // a0 = FunctionCallbackInfo&
5626 // Arguments is after the return address. 5644 // Arguments is after the return address.
5627 __ Addu(a0, sp, Operand(1 * kPointerSize)); 5645 __ Addu(a0, sp, Operand(1 * kPointerSize));
5628 // FunctionCallbackInfo::implicit_args_ 5646 // FunctionCallbackInfo::implicit_args_
5629 __ sw(scratch, MemOperand(a0, 0 * kPointerSize)); 5647 __ sw(scratch, MemOperand(a0, 0 * kPointerSize));
5630 // FunctionCallbackInfo::values_ 5648 // FunctionCallbackInfo::values_
5631 __ Addu(at, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize)); 5649 __ Addu(at, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize));
5632 __ sw(at, MemOperand(a0, 1 * kPointerSize)); 5650 __ sw(at, MemOperand(a0, 1 * kPointerSize));
5633 // FunctionCallbackInfo::length_ = argc 5651 // FunctionCallbackInfo::length_ = argc
5634 __ li(at, Operand(argc)); 5652 __ li(at, Operand(argc));
5635 __ sw(at, MemOperand(a0, 2 * kPointerSize)); 5653 __ sw(at, MemOperand(a0, 2 * kPointerSize));
5636 // FunctionCallbackInfo::is_construct_call = 0 5654 // FunctionCallbackInfo::is_construct_call = 0
5637 __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize)); 5655 __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize));
5638 5656
5639 const int kStackUnwindSpace = argc + FCA::kArgsLength + 1; 5657 const int kStackUnwindSpace = argc + FCA::kArgsLength + 1;
5640 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 5658 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
5641 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; 5659 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
5642 ApiFunction thunk_fun(thunk_address); 5660 ApiFunction thunk_fun(thunk_address);
5643 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 5661 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
5644 masm->isolate()); 5662 masm->isolate());
5645 5663
5646 AllowExternalCallThatCantCauseGC scope(masm); 5664 AllowExternalCallThatCantCauseGC scope(masm);
5647 MemOperand context_restore_operand( 5665 MemOperand context_restore_operand(
5648 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5666 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5649 MemOperand return_value_operand(fp, 5667 MemOperand return_value_operand(fp,
5650 (2 + FCA::kReturnValueOffset) * kPointerSize); 5668 (2 + FCA::kReturnValueOffset) * kPointerSize);
5651 5669
5652 __ CallApiFunctionAndReturn(api_function_address, 5670 __ CallApiFunctionAndReturn(api_function_address,
5653 thunk_ref, 5671 thunk_ref,
5654 thunk_arg,
5655 kStackUnwindSpace, 5672 kStackUnwindSpace,
5656 return_value_operand, 5673 return_value_operand,
5657 restore_context ? 5674 restore_context ?
5658 &context_restore_operand : NULL); 5675 &context_restore_operand : NULL);
5659 } 5676 }
5660 5677
5661 5678
5662 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5679 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5663 // ----------- S t a t e ------------- 5680 // ----------- S t a t e -------------
5664 // -- sp[0] : name 5681 // -- sp[0] : name
5665 // -- sp[4 - kArgsLength*4] : PropertyCallbackArguments object 5682 // -- sp[4 - kArgsLength*4] : PropertyCallbackArguments object
5666 // -- ... 5683 // -- ...
5667 // -- a3 : api_function_address 5684 // -- a2 : api_function_address
5668 // -- a2 : thunk_last_arg
5669 // ----------------------------------- 5685 // -----------------------------------
5670 5686
5671 Register api_function_address = a3; 5687 Register api_function_address = a2;
5672 Register thunk_last_arg = a2;
5673 5688
5674 __ mov(a0, sp); // a0 = Handle<Name> 5689 __ mov(a0, sp); // a0 = Handle<Name>
5675 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = PCA 5690 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = PCA
5676 5691
5677 const int kApiStackSpace = 1; 5692 const int kApiStackSpace = 1;
5678 FrameScope frame_scope(masm, StackFrame::MANUAL); 5693 FrameScope frame_scope(masm, StackFrame::MANUAL);
5679 __ EnterExitFrame(false, kApiStackSpace); 5694 __ EnterExitFrame(false, kApiStackSpace);
5680 5695
5681 // Create PropertyAccessorInfo instance on the stack above the exit frame with 5696 // Create PropertyAccessorInfo instance on the stack above the exit frame with
5682 // a1 (internal::Object** args_) as the data. 5697 // a1 (internal::Object** args_) as the data.
5683 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); 5698 __ sw(a1, MemOperand(sp, 1 * kPointerSize));
5684 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo& 5699 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = AccessorInfo&
5685 5700
5686 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5701 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5687 5702
5688 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 5703 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
5689 ExternalReference::Type thunk_type = 5704 ExternalReference::Type thunk_type =
5690 ExternalReference::PROFILING_GETTER_CALL; 5705 ExternalReference::PROFILING_GETTER_CALL;
5691 ApiFunction thunk_fun(thunk_address); 5706 ApiFunction thunk_fun(thunk_address);
5692 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 5707 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
5693 masm->isolate()); 5708 masm->isolate());
5694 __ CallApiFunctionAndReturn(api_function_address, 5709 __ CallApiFunctionAndReturn(api_function_address,
5695 thunk_ref, 5710 thunk_ref,
5696 thunk_last_arg,
5697 kStackUnwindSpace, 5711 kStackUnwindSpace,
5698 MemOperand(fp, 6 * kPointerSize), 5712 MemOperand(fp, 6 * kPointerSize),
5699 NULL); 5713 NULL);
5700 } 5714 }
5701 5715
5702 5716
5703 #undef __ 5717 #undef __
5704 5718
5705 } } // namespace v8::internal 5719 } } // namespace v8::internal
5706 5720
5707 #endif // V8_TARGET_ARCH_MIPS 5721 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698