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

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

Issue 871063002: Use a trampoline stub to load the type feedback vector for CallICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. 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 | « src/interface-descriptors.h ('k') | src/x64/full-codegen-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 2052 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2053 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); 2053 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset));
2054 __ movp(vector, FieldOperand(vector, 2054 __ movp(vector, FieldOperand(vector,
2055 SharedFunctionInfo::kFeedbackVectorOffset)); 2055 SharedFunctionInfo::kFeedbackVectorOffset));
2056 } 2056 }
2057 2057
2058 2058
2059 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { 2059 void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
2060 // rdi - function 2060 // rdi - function
2061 // rdx - slot id (as integer) 2061 // rdx - slot id (as integer)
2062 // rbx - vector
2062 Label miss; 2063 Label miss;
2063 int argc = arg_count(); 2064 int argc = arg_count();
2064 ParameterCount actual(argc); 2065 ParameterCount actual(argc);
2065 2066
2066 EmitLoadTypeFeedbackVector(masm, rbx);
2067 __ SmiToInteger32(rdx, rdx); 2067 __ SmiToInteger32(rdx, rdx);
2068 2068
2069 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); 2069 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx);
2070 __ cmpp(rdi, rcx); 2070 __ cmpp(rdi, rcx);
2071 __ j(not_equal, &miss); 2071 __ j(not_equal, &miss);
2072 2072
2073 __ movp(rax, Immediate(arg_count())); 2073 __ movp(rax, Immediate(arg_count()));
2074 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, 2074 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size,
2075 FixedArray::kHeaderSize)); 2075 FixedArray::kHeaderSize));
2076 // Verify that ecx contains an AllocationSite 2076 // Verify that ecx contains an AllocationSite
(...skipping 16 matching lines...) Expand all
2093 CallAsMethod()); 2093 CallAsMethod());
2094 2094
2095 // Unreachable. 2095 // Unreachable.
2096 __ int3(); 2096 __ int3();
2097 } 2097 }
2098 2098
2099 2099
2100 void CallICStub::Generate(MacroAssembler* masm) { 2100 void CallICStub::Generate(MacroAssembler* masm) {
2101 // rdi - function 2101 // rdi - function
2102 // rdx - slot id 2102 // rdx - slot id
2103 // rbx - vector
2103 Isolate* isolate = masm->isolate(); 2104 Isolate* isolate = masm->isolate();
2104 const int with_types_offset = 2105 const int with_types_offset =
2105 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); 2106 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
2106 const int generic_offset = 2107 const int generic_offset =
2107 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); 2108 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
2108 Label extra_checks_or_miss, slow_start; 2109 Label extra_checks_or_miss, slow_start;
2109 Label slow, non_function, wrap, cont; 2110 Label slow, non_function, wrap, cont;
2110 Label have_js_function; 2111 Label have_js_function;
2111 int argc = arg_count(); 2112 int argc = arg_count();
2112 StackArgumentsAccessor args(rsp, argc); 2113 StackArgumentsAccessor args(rsp, argc);
2113 ParameterCount actual(argc); 2114 ParameterCount actual(argc);
2114 2115
2115 EmitLoadTypeFeedbackVector(masm, rbx);
2116
2117 // The checks. First, does rdi match the recorded monomorphic target? 2116 // The checks. First, does rdi match the recorded monomorphic target?
2118 __ SmiToInteger32(rdx, rdx); 2117 __ SmiToInteger32(rdx, rdx);
2119 __ cmpp(rdi, FieldOperand(rbx, rdx, times_pointer_size, 2118 __ cmpp(rdi, FieldOperand(rbx, rdx, times_pointer_size,
2120 FixedArray::kHeaderSize)); 2119 FixedArray::kHeaderSize));
2121 __ j(not_equal, &extra_checks_or_miss); 2120 __ j(not_equal, &extra_checks_or_miss);
2122 2121
2123 __ bind(&have_js_function); 2122 __ bind(&have_js_function);
2124 if (CallAsMethod()) { 2123 if (CallAsMethod()) {
2125 EmitContinueIfStrictOrNative(masm, &cont); 2124 EmitContinueIfStrictOrNative(masm, &cont);
2126 2125
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 } 4258 }
4260 4259
4261 4260
4262 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { 4261 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
4263 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); 4262 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister());
4264 VectorKeyedLoadStub stub(isolate()); 4263 VectorKeyedLoadStub stub(isolate());
4265 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); 4264 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
4266 } 4265 }
4267 4266
4268 4267
4268 void CallICTrampolineStub::Generate(MacroAssembler* masm) {
4269 EmitLoadTypeFeedbackVector(masm, rbx);
4270 CallICStub stub(isolate(), state());
4271 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
4272 }
4273
4274
4275 void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
4276 EmitLoadTypeFeedbackVector(masm, rbx);
4277 CallIC_ArrayStub stub(isolate(), state());
4278 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
4279 }
4280
4281
4269 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 4282 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
4270 if (masm->isolate()->function_entry_hook() != NULL) { 4283 if (masm->isolate()->function_entry_hook() != NULL) {
4271 ProfileEntryHookStub stub(masm->isolate()); 4284 ProfileEntryHookStub stub(masm->isolate());
4272 masm->CallStub(&stub); 4285 masm->CallStub(&stub);
4273 } 4286 }
4274 } 4287 }
4275 4288
4276 4289
4277 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { 4290 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
4278 // This stub can be called from essentially anywhere, so it needs to save 4291 // This stub can be called from essentially anywhere, so it needs to save
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
5026 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, 5039 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg,
5027 kStackSpace, nullptr, return_value_operand, NULL); 5040 kStackSpace, nullptr, return_value_operand, NULL);
5028 } 5041 }
5029 5042
5030 5043
5031 #undef __ 5044 #undef __
5032 5045
5033 } } // namespace v8::internal 5046 } } // namespace v8::internal
5034 5047
5035 #endif // V8_TARGET_ARCH_X64 5048 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/interface-descriptors.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698