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

Side by Side Diff: src/ia32/code-stubs-ia32.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/ia32/builtins-ia32.cc ('k') | src/mips/builtins-mips.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_IA32 5 #if V8_TARGET_ARCH_IA32
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5668 matching lines...) Expand 10 before | Expand all | Expand 10 after
5679 5679
5680 typedef FunctionCallbackArguments FCA; 5680 typedef FunctionCallbackArguments FCA;
5681 5681
5682 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5682 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5683 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5683 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5684 STATIC_ASSERT(FCA::kDataIndex == 4); 5684 STATIC_ASSERT(FCA::kDataIndex == 4);
5685 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5685 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5686 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5686 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5687 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5687 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5688 STATIC_ASSERT(FCA::kHolderIndex == 0); 5688 STATIC_ASSERT(FCA::kHolderIndex == 0);
5689 STATIC_ASSERT(FCA::kArgsLength == 7); 5689 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5690 STATIC_ASSERT(FCA::kArgsLength == 8);
5690 5691
5691 __ pop(return_address); 5692 __ pop(return_address);
5693
5694 // new target
5695 __ PushRoot(Heap::kUndefinedValueRootIndex);
5696
5692 // context save. 5697 // context save.
5693 __ push(context); 5698 __ push(context);
5694 5699
5695 // callee 5700 // callee
5696 __ push(callee); 5701 __ push(callee);
5697 5702
5698 // call data 5703 // call data
5699 __ push(call_data); 5704 __ push(call_data);
5700 5705
5701 Register scratch = call_data; 5706 Register scratch = call_data;
(...skipping 24 matching lines...) Expand all
5726 } 5731 }
5727 5732
5728 // API function gets reference to the v8::Arguments. If CPU profiler 5733 // API function gets reference to the v8::Arguments. If CPU profiler
5729 // is enabled wrapper function will be called and we need to pass 5734 // is enabled wrapper function will be called and we need to pass
5730 // address of the callback as additional parameter, always allocate 5735 // address of the callback as additional parameter, always allocate
5731 // space for it. 5736 // space for it.
5732 const int kApiArgc = 1 + 1; 5737 const int kApiArgc = 1 + 1;
5733 5738
5734 // Allocate the v8::Arguments structure in the arguments' space since 5739 // Allocate the v8::Arguments structure in the arguments' space since
5735 // it's not controlled by GC. 5740 // it's not controlled by GC.
5736 const int kApiStackSpace = 4; 5741 const int kApiStackSpace = 3;
5737 5742
5738 PrepareCallApiFunction(masm, kApiArgc + kApiStackSpace); 5743 PrepareCallApiFunction(masm, kApiArgc + kApiStackSpace);
5739 5744
5740 // FunctionCallbackInfo::implicit_args_. 5745 // FunctionCallbackInfo::implicit_args_.
5741 __ mov(ApiParameterOperand(2), scratch); 5746 __ mov(ApiParameterOperand(2), scratch);
5742 __ add(scratch, Immediate((argc() + FCA::kArgsLength - 1) * kPointerSize)); 5747 __ add(scratch, Immediate((argc() + FCA::kArgsLength - 1) * kPointerSize));
5743 // FunctionCallbackInfo::values_. 5748 // FunctionCallbackInfo::values_.
5744 __ mov(ApiParameterOperand(3), scratch); 5749 __ mov(ApiParameterOperand(3), scratch);
5745 // FunctionCallbackInfo::length_. 5750 // FunctionCallbackInfo::length_.
5746 __ Move(ApiParameterOperand(4), Immediate(argc())); 5751 __ Move(ApiParameterOperand(4), Immediate(argc()));
5747 // FunctionCallbackInfo::is_construct_call_.
5748 __ Move(ApiParameterOperand(5), Immediate(0));
5749 5752
5750 // v8::InvocationCallback's argument. 5753 // v8::InvocationCallback's argument.
5751 __ lea(scratch, ApiParameterOperand(2)); 5754 __ lea(scratch, ApiParameterOperand(2));
5752 __ mov(ApiParameterOperand(0), scratch); 5755 __ mov(ApiParameterOperand(0), scratch);
5753 5756
5754 ExternalReference thunk_ref = 5757 ExternalReference thunk_ref =
5755 ExternalReference::invoke_function_callback(masm->isolate()); 5758 ExternalReference::invoke_function_callback(masm->isolate());
5756 5759
5757 Operand context_restore_operand(ebp, 5760 Operand context_restore_operand(ebp,
5758 (2 + FCA::kContextSaveIndex) * kPointerSize); 5761 (2 + FCA::kContextSaveIndex) * kPointerSize);
5759 // Stores return the first js argument 5762 // Stores return the first js argument
5760 int return_value_offset = 0; 5763 int return_value_offset = 0;
5761 if (is_store()) { 5764 if (is_store()) {
5762 return_value_offset = 2 + FCA::kArgsLength; 5765 return_value_offset = 2 + FCA::kArgsLength;
5763 } else { 5766 } else {
5764 return_value_offset = 2 + FCA::kReturnValueOffset; 5767 return_value_offset = 2 + FCA::kReturnValueOffset;
5765 } 5768 }
5766 Operand return_value_operand(ebp, return_value_offset * kPointerSize); 5769 Operand return_value_operand(ebp, return_value_offset * kPointerSize);
5767 int stack_space = 0; 5770 int stack_space = 0;
5768 Operand is_construct_call_operand = ApiParameterOperand(5); 5771 Operand length_operand = ApiParameterOperand(4);
5769 Operand* stack_space_operand = &is_construct_call_operand; 5772 Operand* stack_space_operand = &length_operand;
5770 stack_space = argc() + FCA::kArgsLength + 1; 5773 stack_space = argc() + FCA::kArgsLength + 1;
5771 stack_space_operand = nullptr; 5774 stack_space_operand = nullptr;
5772 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5775 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5773 ApiParameterOperand(1), stack_space, 5776 ApiParameterOperand(1), stack_space,
5774 stack_space_operand, return_value_operand, 5777 stack_space_operand, return_value_operand,
5775 &context_restore_operand); 5778 &context_restore_operand);
5776 } 5779 }
5777 5780
5778 5781
5779 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5782 void CallApiGetterStub::Generate(MacroAssembler* masm) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
5846 kStackUnwindSpace, nullptr, return_value_operand, 5849 kStackUnwindSpace, nullptr, return_value_operand,
5847 NULL); 5850 NULL);
5848 } 5851 }
5849 5852
5850 #undef __ 5853 #undef __
5851 5854
5852 } // namespace internal 5855 } // namespace internal
5853 } // namespace v8 5856 } // namespace v8
5854 5857
5855 #endif // V8_TARGET_ARCH_IA32 5858 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698