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

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

Issue 883613003: fix performance regression on intel call api stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | src/ia32/interface-descriptors-ia32.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4858 matching lines...) Expand 10 before | Expand all | Expand 10 after
4869 __ mov(eax, edi); 4869 __ mov(eax, edi);
4870 __ jmp(&leave_exit_frame); 4870 __ jmp(&leave_exit_frame);
4871 } 4871 }
4872 4872
4873 4873
4874 static void CallApiFunctionStubHelper(MacroAssembler* masm, 4874 static void CallApiFunctionStubHelper(MacroAssembler* masm,
4875 const ParameterCount& argc, 4875 const ParameterCount& argc,
4876 bool return_first_arg, 4876 bool return_first_arg,
4877 bool call_data_undefined) { 4877 bool call_data_undefined) {
4878 // ----------- S t a t e ------------- 4878 // ----------- S t a t e -------------
4879 // -- eax : callee 4879 // -- edi : callee
4880 // -- ebx : call_data 4880 // -- ebx : call_data
4881 // -- ecx : holder 4881 // -- ecx : holder
4882 // -- edx : api_function_address 4882 // -- edx : api_function_address
4883 // -- esi : context 4883 // -- esi : context
4884 // -- edi : number of arguments if argc is a register 4884 // -- eax : number of arguments if argc is a register
4885 // -- 4885 // --
4886 // -- esp[0] : return address 4886 // -- esp[0] : return address
4887 // -- esp[4] : last argument 4887 // -- esp[4] : last argument
4888 // -- ... 4888 // -- ...
4889 // -- esp[argc * 4] : first argument 4889 // -- esp[argc * 4] : first argument
4890 // -- esp[(argc + 1) * 4] : receiver 4890 // -- esp[(argc + 1) * 4] : receiver
4891 // ----------------------------------- 4891 // -----------------------------------
4892 4892
4893 Register callee = eax; 4893 Register callee = edi;
4894 Register call_data = ebx; 4894 Register call_data = ebx;
4895 Register holder = ecx; 4895 Register holder = ecx;
4896 Register api_function_address = edx; 4896 Register api_function_address = edx;
4897 Register context = esi; 4897 Register context = esi;
4898 Register return_address = eax;
4898 4899
4899 typedef FunctionCallbackArguments FCA; 4900 typedef FunctionCallbackArguments FCA;
4900 4901
4901 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 4902 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
4902 STATIC_ASSERT(FCA::kCalleeIndex == 5); 4903 STATIC_ASSERT(FCA::kCalleeIndex == 5);
4903 STATIC_ASSERT(FCA::kDataIndex == 4); 4904 STATIC_ASSERT(FCA::kDataIndex == 4);
4904 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 4905 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
4905 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 4906 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
4906 STATIC_ASSERT(FCA::kIsolateIndex == 1); 4907 STATIC_ASSERT(FCA::kIsolateIndex == 1);
4907 STATIC_ASSERT(FCA::kHolderIndex == 0); 4908 STATIC_ASSERT(FCA::kHolderIndex == 0);
4908 STATIC_ASSERT(FCA::kArgsLength == 7); 4909 STATIC_ASSERT(FCA::kArgsLength == 7);
4909 4910
4910 DCHECK(argc.is_immediate() || edi.is(argc.reg())); 4911 DCHECK(argc.is_immediate() || eax.is(argc.reg()));
4911 4912
4912 // pop return address and save context 4913 if (argc.is_immediate()) {
4913 __ xchg(context, Operand(esp, 0)); 4914 __ pop(return_address);
4915 // context save.
4916 __ push(context);
4917 } else {
4918 // pop return address and save context
4919 __ xchg(context, Operand(esp, 0));
4920 return_address = context;
4921 }
4914 4922
4915 // callee 4923 // callee
4916 __ push(callee); 4924 __ push(callee);
4917 4925
4918 // call data 4926 // call data
4919 __ push(call_data); 4927 __ push(call_data);
4920 4928
4921 Register scratch = call_data; 4929 Register scratch = call_data;
4922 if (!call_data_undefined) { 4930 if (!call_data_undefined) {
4923 // return value 4931 // return value
4924 __ push(Immediate(masm->isolate()->factory()->undefined_value())); 4932 __ push(Immediate(masm->isolate()->factory()->undefined_value()));
4925 // return value default 4933 // return value default
4926 __ push(Immediate(masm->isolate()->factory()->undefined_value())); 4934 __ push(Immediate(masm->isolate()->factory()->undefined_value()));
4927 } else { 4935 } else {
4928 // return value 4936 // return value
4929 __ push(scratch); 4937 __ push(scratch);
4930 // return value default 4938 // return value default
4931 __ push(scratch); 4939 __ push(scratch);
4932 } 4940 }
4933 // isolate 4941 // isolate
4934 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); 4942 __ push(Immediate(reinterpret_cast<int>(masm->isolate())));
4935 // holder 4943 // holder
4936 __ push(holder); 4944 __ push(holder);
4937 4945
4938 __ mov(scratch, esp); 4946 __ mov(scratch, esp);
4939 4947
4940 // push return address 4948 // push return address
4941 __ push(context); 4949 __ push(return_address);
4942 4950
4943 // load context from callee 4951 // load context from callee
4944 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); 4952 __ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
4945 4953
4946 // API function gets reference to the v8::Arguments. If CPU profiler 4954 // API function gets reference to the v8::Arguments. If CPU profiler
4947 // is enabled wrapper function will be called and we need to pass 4955 // is enabled wrapper function will be called and we need to pass
4948 // address of the callback as additional parameter, always allocate 4956 // address of the callback as additional parameter, always allocate
4949 // space for it. 4957 // space for it.
4950 const int kApiArgc = 1 + 1; 4958 const int kApiArgc = 1 + 1;
4951 4959
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 stack_space_operand = nullptr; 5012 stack_space_operand = nullptr;
5005 } 5013 }
5006 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5014 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5007 ApiParameterOperand(1), stack_space, 5015 ApiParameterOperand(1), stack_space,
5008 stack_space_operand, return_value_operand, 5016 stack_space_operand, return_value_operand,
5009 &context_restore_operand); 5017 &context_restore_operand);
5010 } 5018 }
5011 5019
5012 5020
5013 void CallApiFunctionStub::Generate(MacroAssembler* masm) { 5021 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5014 // TODO(dcarney): make eax contain the function address.
5015 bool call_data_undefined = this->call_data_undefined(); 5022 bool call_data_undefined = this->call_data_undefined();
5016 CallApiFunctionStubHelper(masm, ParameterCount(edi), false, 5023 CallApiFunctionStubHelper(masm, ParameterCount(eax), false,
5017 call_data_undefined); 5024 call_data_undefined);
5018 } 5025 }
5019 5026
5020 5027
5021 void CallApiAccessorStub::Generate(MacroAssembler* masm) { 5028 void CallApiAccessorStub::Generate(MacroAssembler* masm) {
5022 bool is_store = this->is_store(); 5029 bool is_store = this->is_store();
5023 int argc = this->argc(); 5030 int argc = this->argc();
5024 bool call_data_undefined = this->call_data_undefined(); 5031 bool call_data_undefined = this->call_data_undefined();
5025 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, 5032 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store,
5026 call_data_undefined); 5033 call_data_undefined);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 ApiParameterOperand(2), kStackSpace, nullptr, 5069 ApiParameterOperand(2), kStackSpace, nullptr,
5063 Operand(ebp, 7 * kPointerSize), NULL); 5070 Operand(ebp, 7 * kPointerSize), NULL);
5064 } 5071 }
5065 5072
5066 5073
5067 #undef __ 5074 #undef __
5068 5075
5069 } } // namespace v8::internal 5076 } } // namespace v8::internal
5070 5077
5071 #endif // V8_TARGET_ARCH_IA32 5078 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698