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

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

Issue 883253002: Load API call data from function instead of embedding it in handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename scratch_in 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/ic/arm64/handler-compiler-arm64.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_ARM 7 #if V8_TARGET_ARCH_ARM
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Write the arguments to stack frame. 249 // Write the arguments to stack frame.
250 if (is_store) { 250 if (is_store) {
251 DCHECK(!receiver.is(store_parameter)); 251 DCHECK(!receiver.is(store_parameter));
252 DCHECK(!scratch_in.is(store_parameter)); 252 DCHECK(!scratch_in.is(store_parameter));
253 __ push(store_parameter); 253 __ push(store_parameter);
254 } 254 }
255 DCHECK(optimization.is_simple_api_call()); 255 DCHECK(optimization.is_simple_api_call());
256 256
257 // Abi for CallApiFunctionStub. 257 // Abi for CallApiFunctionStub.
258 Register callee = r0; 258 Register callee = r0;
259 Register call_data = r4; 259 Register data = r4;
260 Register holder = r2; 260 Register holder = r2;
261 Register api_function_address = r1; 261 Register api_function_address = r1;
262 262
263 // Put callee in place. 263 // Put callee in place.
264 __ LoadAccessor(callee, accessor_holder, accessor_index, 264 __ LoadAccessor(callee, accessor_holder, accessor_index,
265 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); 265 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
266 266
267 // Put holder in place. 267 // Put holder in place.
268 CallOptimization::HolderLookup holder_lookup; 268 CallOptimization::HolderLookup holder_lookup;
269 Handle<JSObject> api_holder = 269 Handle<JSObject> api_holder =
270 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); 270 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
271 switch (holder_lookup) { 271 switch (holder_lookup) {
272 case CallOptimization::kHolderIsReceiver: 272 case CallOptimization::kHolderIsReceiver:
273 __ Move(holder, receiver); 273 __ Move(holder, receiver);
274 break; 274 break;
275 case CallOptimization::kHolderFound: 275 case CallOptimization::kHolderFound:
276 __ Move(holder, api_holder); 276 __ Move(holder, api_holder);
277 break; 277 break;
278 case CallOptimization::kHolderNotFound: 278 case CallOptimization::kHolderNotFound:
279 UNREACHABLE(); 279 UNREACHABLE();
280 break; 280 break;
281 } 281 }
282 282
283 Isolate* isolate = masm->isolate(); 283 Isolate* isolate = masm->isolate();
284 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 284 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
285 Handle<Object> call_data_obj(api_call_info->data(), isolate);
286
287 bool call_data_undefined = false; 285 bool call_data_undefined = false;
288 // Put call_data in place. 286 // Put call data in place.
289 if (isolate->heap()->InNewSpace(*call_data_obj)) { 287 if (api_call_info->data()->IsUndefined()) {
290 __ Move(call_data, api_call_info);
291 __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
292 } else if (call_data_obj->IsUndefined()) {
293 call_data_undefined = true; 288 call_data_undefined = true;
294 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 289 __ LoadRoot(data, Heap::kUndefinedValueRootIndex);
295 } else { 290 } else {
296 __ Move(call_data, call_data_obj); 291 __ ldr(data,
292 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
293 __ ldr(data,
294 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
295 __ ldr(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
296 __ ldr(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
297 } 297 }
298 298
299 // Put api_function_address in place. 299 // Put api_function_address in place.
300 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 300 Address function_address = v8::ToCData<Address>(api_call_info->callback());
301 ApiFunction fun(function_address); 301 ApiFunction fun(function_address);
302 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; 302 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
303 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); 303 ExternalReference ref = ExternalReference(&fun, type, masm->isolate());
304 __ mov(api_function_address, Operand(ref)); 304 __ mov(api_function_address, Operand(ref));
305 305
306 // Jump to stub. 306 // Jump to stub.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 // Return the generated code. 741 // Return the generated code.
742 return GetCode(kind(), Code::NORMAL, name); 742 return GetCode(kind(), Code::NORMAL, name);
743 } 743 }
744 744
745 745
746 #undef __ 746 #undef __
747 } 747 }
748 } // namespace v8::internal 748 } // namespace v8::internal
749 749
750 #endif // V8_TARGET_ARCH_ARM 750 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ic/arm64/handler-compiler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698