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

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

Issue 1910253005: [api] Expose FunctionCallbackInfo::NewTarget (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a TODO Created 4 years, 7 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/mips64/builtins-mips64.cc ('k') | src/x64/builtins-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 5618 matching lines...) Expand 10 before | Expand all | Expand 10 after
5629 5629
5630 typedef FunctionCallbackArguments FCA; 5630 typedef FunctionCallbackArguments FCA;
5631 5631
5632 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5632 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5633 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5633 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5634 STATIC_ASSERT(FCA::kDataIndex == 4); 5634 STATIC_ASSERT(FCA::kDataIndex == 4);
5635 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5635 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5636 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5636 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5637 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5637 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5638 STATIC_ASSERT(FCA::kHolderIndex == 0); 5638 STATIC_ASSERT(FCA::kHolderIndex == 0);
5639 STATIC_ASSERT(FCA::kArgsLength == 7); 5639 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5640 STATIC_ASSERT(FCA::kArgsLength == 8);
5641
5642 // new target
5643 __ PushRoot(Heap::kUndefinedValueRootIndex);
5640 5644
5641 // Save context, callee and call data. 5645 // Save context, callee and call data.
5642 __ Push(context, callee, call_data); 5646 __ Push(context, callee, call_data);
5643 if (!is_lazy()) { 5647 if (!is_lazy()) {
5644 // Load context from callee. 5648 // Load context from callee.
5645 __ ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); 5649 __ ld(context, FieldMemOperand(callee, JSFunction::kContextOffset));
5646 } 5650 }
5647 5651
5648 Register scratch = call_data; 5652 Register scratch = call_data;
5649 if (!call_data_undefined()) { 5653 if (!call_data_undefined()) {
5650 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 5654 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5651 } 5655 }
5652 // Push return value and default return value. 5656 // Push return value and default return value.
5653 __ Push(scratch, scratch); 5657 __ Push(scratch, scratch);
5654 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 5658 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
5655 // Push isolate and holder. 5659 // Push isolate and holder.
5656 __ Push(scratch, holder); 5660 __ Push(scratch, holder);
5657 5661
5658 // Prepare arguments. 5662 // Prepare arguments.
5659 __ mov(scratch, sp); 5663 __ mov(scratch, sp);
5660 5664
5661 // Allocate the v8::Arguments structure in the arguments' space since 5665 // Allocate the v8::Arguments structure in the arguments' space since
5662 // it's not controlled by GC. 5666 // it's not controlled by GC.
5663 const int kApiStackSpace = 4; 5667 const int kApiStackSpace = 3;
5664 5668
5665 FrameScope frame_scope(masm, StackFrame::MANUAL); 5669 FrameScope frame_scope(masm, StackFrame::MANUAL);
5666 __ EnterExitFrame(false, kApiStackSpace); 5670 __ EnterExitFrame(false, kApiStackSpace);
5667 5671
5668 DCHECK(!api_function_address.is(a0) && !scratch.is(a0)); 5672 DCHECK(!api_function_address.is(a0) && !scratch.is(a0));
5669 // a0 = FunctionCallbackInfo& 5673 // a0 = FunctionCallbackInfo&
5670 // Arguments is after the return address. 5674 // Arguments is after the return address.
5671 __ Daddu(a0, sp, Operand(1 * kPointerSize)); 5675 __ Daddu(a0, sp, Operand(1 * kPointerSize));
5672 // FunctionCallbackInfo::implicit_args_ 5676 // FunctionCallbackInfo::implicit_args_
5673 __ sd(scratch, MemOperand(a0, 0 * kPointerSize)); 5677 __ sd(scratch, MemOperand(a0, 0 * kPointerSize));
5674 // FunctionCallbackInfo::values_ 5678 // FunctionCallbackInfo::values_
5675 __ Daddu(at, scratch, 5679 __ Daddu(at, scratch,
5676 Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); 5680 Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize));
5677 __ sd(at, MemOperand(a0, 1 * kPointerSize)); 5681 __ sd(at, MemOperand(a0, 1 * kPointerSize));
5678 // FunctionCallbackInfo::length_ = argc 5682 // FunctionCallbackInfo::length_ = argc
5679 // Stored as int field, 32-bit integers within struct on stack always left 5683 // Stored as int field, 32-bit integers within struct on stack always left
5680 // justified by n64 ABI. 5684 // justified by n64 ABI.
5681 __ li(at, Operand(argc())); 5685 __ li(at, Operand(argc()));
5682 __ sw(at, MemOperand(a0, 2 * kPointerSize)); 5686 __ sw(at, MemOperand(a0, 2 * kPointerSize));
5683 // FunctionCallbackInfo::is_construct_call_ = 0
5684 __ sw(zero_reg, MemOperand(a0, 2 * kPointerSize + kIntSize));
5685 5687
5686 ExternalReference thunk_ref = 5688 ExternalReference thunk_ref =
5687 ExternalReference::invoke_function_callback(masm->isolate()); 5689 ExternalReference::invoke_function_callback(masm->isolate());
5688 5690
5689 AllowExternalCallThatCantCauseGC scope(masm); 5691 AllowExternalCallThatCantCauseGC scope(masm);
5690 MemOperand context_restore_operand( 5692 MemOperand context_restore_operand(
5691 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5693 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5692 // Stores return the first js argument. 5694 // Stores return the first js argument.
5693 int return_value_offset = 0; 5695 int return_value_offset = 0;
5694 if (is_store()) { 5696 if (is_store()) {
5695 return_value_offset = 2 + FCA::kArgsLength; 5697 return_value_offset = 2 + FCA::kArgsLength;
5696 } else { 5698 } else {
5697 return_value_offset = 2 + FCA::kReturnValueOffset; 5699 return_value_offset = 2 + FCA::kReturnValueOffset;
5698 } 5700 }
5699 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5701 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5700 int stack_space = 0; 5702 int stack_space = 0;
5701 int32_t stack_space_offset = 4 * kPointerSize; 5703 int32_t stack_space_offset = 3 * kPointerSize;
5702 stack_space = argc() + FCA::kArgsLength + 1; 5704 stack_space = argc() + FCA::kArgsLength + 1;
5705 // TODO(adamk): Why are we clobbering this immediately?
5703 stack_space_offset = kInvalidStackOffset; 5706 stack_space_offset = kInvalidStackOffset;
5704 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5707 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5705 stack_space_offset, return_value_operand, 5708 stack_space_offset, return_value_operand,
5706 &context_restore_operand); 5709 &context_restore_operand);
5707 } 5710 }
5708 5711
5709 5712
5710 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5713 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5711 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property 5714 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
5712 // name below the exit frame to make GC aware of them. 5715 // name below the exit frame to make GC aware of them.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5769 kStackUnwindSpace, kInvalidStackOffset, 5772 kStackUnwindSpace, kInvalidStackOffset,
5770 return_value_operand, NULL); 5773 return_value_operand, NULL);
5771 } 5774 }
5772 5775
5773 #undef __ 5776 #undef __
5774 5777
5775 } // namespace internal 5778 } // namespace internal
5776 } // namespace v8 5779 } // namespace v8
5777 5780
5778 #endif // V8_TARGET_ARCH_MIPS64 5781 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698