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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.cc

Issue 1811563002: [fullcodegen] Avoid arguments juggling when calling a JS runtime function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@call-js-runtime
Patch Set: Created 4 years, 9 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/full-codegen/arm64/full-codegen-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 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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 3348
3349 __ bind(&runtime); 3349 __ bind(&runtime);
3350 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3350 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3351 3351
3352 __ bind(&done); 3352 __ bind(&done);
3353 context()->Plug(r0); 3353 context()->Plug(r0);
3354 } 3354 }
3355 3355
3356 3356
3357 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3357 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3358 // Push function.
3359 __ LoadNativeContextSlot(expr->context_index(), r0);
3360 PushOperand(r0);
3361
3358 // Push undefined as the receiver. 3362 // Push undefined as the receiver.
3359 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 3363 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
3360 PushOperand(r0); 3364 PushOperand(r0);
3361
3362 __ LoadNativeContextSlot(expr->context_index(), r0);
3363 } 3365 }
3364 3366
3365 3367
3366 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3368 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
3367 ZoneList<Expression*>* args = expr->arguments(); 3369 ZoneList<Expression*>* args = expr->arguments();
3368 int arg_count = args->length(); 3370 int arg_count = args->length();
3369 3371
3370 SetCallPosition(expr); 3372 SetCallPosition(expr);
3371 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3373 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3372 __ mov(r0, Operand(arg_count)); 3374 __ mov(r0, Operand(arg_count));
3373 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3375 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3374 RelocInfo::CODE_TARGET); 3376 RelocInfo::CODE_TARGET);
3375 OperandStackDepthDecrement(arg_count + 1); 3377 OperandStackDepthDecrement(arg_count + 1);
3376 } 3378 }
3377 3379
3378 3380
3379 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3381 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3380 ZoneList<Expression*>* args = expr->arguments(); 3382 ZoneList<Expression*>* args = expr->arguments();
3381 int arg_count = args->length(); 3383 int arg_count = args->length();
3382 3384
3383 if (expr->is_jsruntime()) { 3385 if (expr->is_jsruntime()) {
3384 Comment cmnt(masm_, "[ CallRuntime"); 3386 Comment cmnt(masm_, "[ CallRuntime");
3385 EmitLoadJSRuntimeFunction(expr); 3387 EmitLoadJSRuntimeFunction(expr);
3386 3388
3387 // Push the target function under the receiver.
3388 __ ldr(ip, MemOperand(sp, 0));
3389 PushOperand(ip);
3390 __ str(r0, MemOperand(sp, kPointerSize));
3391
3392 // Push the arguments ("left-to-right"). 3389 // Push the arguments ("left-to-right").
3393 for (int i = 0; i < arg_count; i++) { 3390 for (int i = 0; i < arg_count; i++) {
3394 VisitForStackValue(args->at(i)); 3391 VisitForStackValue(args->at(i));
3395 } 3392 }
3396 3393
3397 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3394 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3398 EmitCallJSRuntimeFunction(expr); 3395 EmitCallJSRuntimeFunction(expr);
3399 3396
3400 // Restore context register. 3397 // Restore context register.
3401 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3398 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 DCHECK(interrupt_address == 4215 DCHECK(interrupt_address ==
4219 isolate->builtins()->OnStackReplacement()->entry()); 4216 isolate->builtins()->OnStackReplacement()->entry());
4220 return ON_STACK_REPLACEMENT; 4217 return ON_STACK_REPLACEMENT;
4221 } 4218 }
4222 4219
4223 4220
4224 } // namespace internal 4221 } // namespace internal
4225 } // namespace v8 4222 } // namespace v8
4226 4223
4227 #endif // V8_TARGET_ARCH_ARM 4224 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698