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

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 880333003: Load API accessor from descriptor instead of embedding it in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 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/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 124 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), 125 __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()),
126 NamedLoadHandlerCompiler::kInterceptorArgsLength); 126 NamedLoadHandlerCompiler::kInterceptorArgsLength);
127 } 127 }
128 128
129 129
130 // Generate call to api function. 130 // Generate call to api function.
131 void PropertyHandlerCompiler::GenerateApiAccessorCall( 131 void PropertyHandlerCompiler::GenerateApiAccessorCall(
132 MacroAssembler* masm, const CallOptimization& optimization, 132 MacroAssembler* masm, const CallOptimization& optimization,
133 Handle<Map> receiver_map, Register receiver, Register scratch_in, 133 Handle<Map> receiver_map, Register receiver, Register scratch_in,
134 bool is_store, Register store_parameter) { 134 bool is_store, Register store_parameter, Register accessor_holder,
135 int accessor_index) {
136 DCHECK(!accessor_holder.is(scratch_in));
135 DCHECK(optimization.is_simple_api_call()); 137 DCHECK(optimization.is_simple_api_call());
136 138
137 __ PopReturnAddressTo(scratch_in); 139 __ PopReturnAddressTo(scratch_in);
138 // receiver 140 // receiver
139 __ Push(receiver); 141 __ Push(receiver);
140 // Write the arguments to stack frame. 142 // Write the arguments to stack frame.
141 if (is_store) { 143 if (is_store) {
142 DCHECK(!receiver.is(store_parameter)); 144 DCHECK(!receiver.is(store_parameter));
143 DCHECK(!scratch_in.is(store_parameter)); 145 DCHECK(!scratch_in.is(store_parameter));
144 __ Push(store_parameter); 146 __ Push(store_parameter);
145 } 147 }
146 __ PushReturnAddressFrom(scratch_in); 148 __ PushReturnAddressFrom(scratch_in);
147 // Stack now matches JSFunction abi. 149 // Stack now matches JSFunction abi.
148 150
149 // Abi for CallApiFunctionStub. 151 // Abi for CallApiFunctionStub.
150 Register callee = rdi; 152 Register callee = rdi;
151 Register call_data = rbx; 153 Register call_data = rbx;
152 Register holder = rcx; 154 Register holder = rcx;
153 Register api_function_address = rdx; 155 Register api_function_address = rdx;
154 Register scratch = rax; // scratch_in is no longer valid. 156 Register scratch = rax; // scratch_in is no longer valid.
155 157
158 // Put callee in place.
159 __ LoadAccessor(callee, accessor_holder, accessor_index,
160 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
161
156 // Put holder in place. 162 // Put holder in place.
157 CallOptimization::HolderLookup holder_lookup; 163 CallOptimization::HolderLookup holder_lookup;
158 Handle<JSObject> api_holder = 164 Handle<JSObject> api_holder =
159 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); 165 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
160 switch (holder_lookup) { 166 switch (holder_lookup) {
161 case CallOptimization::kHolderIsReceiver: 167 case CallOptimization::kHolderIsReceiver:
162 __ Move(holder, receiver); 168 __ Move(holder, receiver);
163 break; 169 break;
164 case CallOptimization::kHolderFound: 170 case CallOptimization::kHolderFound:
165 __ Move(holder, api_holder); 171 __ Move(holder, api_holder);
166 break; 172 break;
167 case CallOptimization::kHolderNotFound: 173 case CallOptimization::kHolderNotFound:
168 UNREACHABLE(); 174 UNREACHABLE();
169 break; 175 break;
170 } 176 }
171 177
172 Isolate* isolate = masm->isolate(); 178 Isolate* isolate = masm->isolate();
173 Handle<JSFunction> function = optimization.constant_function();
174 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 179 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
175 Handle<Object> call_data_obj(api_call_info->data(), isolate); 180 Handle<Object> call_data_obj(api_call_info->data(), isolate);
176 181
177 // Put callee in place.
178 __ Move(callee, function);
179
180 bool call_data_undefined = false; 182 bool call_data_undefined = false;
181 // Put call_data in place. 183 // Put call_data in place.
182 if (isolate->heap()->InNewSpace(*call_data_obj)) { 184 if (isolate->heap()->InNewSpace(*call_data_obj)) {
183 __ Move(scratch, api_call_info); 185 __ Move(scratch, api_call_info);
184 __ movp(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset)); 186 __ movp(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
185 } else if (call_data_obj->IsUndefined()) { 187 } else if (call_data_obj->IsUndefined()) {
186 call_data_undefined = true; 188 call_data_undefined = true;
187 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 189 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
188 } else { 190 } else {
189 __ Move(call_data, call_data_obj); 191 __ Move(call_data, call_data_obj);
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // Return the generated code. 745 // Return the generated code.
744 return GetCode(kind(), Code::NORMAL, name); 746 return GetCode(kind(), Code::NORMAL, name);
745 } 747 }
746 748
747 749
748 #undef __ 750 #undef __
749 } 751 }
750 } // namespace v8::internal 752 } // namespace v8::internal
751 753
752 #endif // V8_TARGET_ARCH_X64 754 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/handler-compiler-mips64.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698