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

Side by Side Diff: src/full-codegen/ppc/full-codegen-ppc.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
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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
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 3332 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 3343
3344 __ bind(&runtime); 3344 __ bind(&runtime);
3345 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3345 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3346 3346
3347 __ bind(&done); 3347 __ bind(&done);
3348 context()->Plug(r3); 3348 context()->Plug(r3);
3349 } 3349 }
3350 3350
3351 3351
3352 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3352 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3353 // Push function.
3354 __ LoadNativeContextSlot(expr->context_index(), r3);
3355 PushOperand(r3);
3356
3353 // Push undefined as the receiver. 3357 // Push undefined as the receiver.
3354 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); 3358 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
3355 PushOperand(r3); 3359 PushOperand(r3);
3356
3357 __ LoadNativeContextSlot(expr->context_index(), r3);
3358 } 3360 }
3359 3361
3360 3362
3361 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3363 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
3362 ZoneList<Expression*>* args = expr->arguments(); 3364 ZoneList<Expression*>* args = expr->arguments();
3363 int arg_count = args->length(); 3365 int arg_count = args->length();
3364 3366
3365 SetCallPosition(expr); 3367 SetCallPosition(expr);
3366 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); 3368 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
3367 __ mov(r3, Operand(arg_count)); 3369 __ mov(r3, Operand(arg_count));
3368 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3370 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3369 RelocInfo::CODE_TARGET); 3371 RelocInfo::CODE_TARGET);
3370 OperandStackDepthDecrement(arg_count + 1); 3372 OperandStackDepthDecrement(arg_count + 1);
3371 } 3373 }
3372 3374
3373 3375
3374 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3376 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3375 ZoneList<Expression*>* args = expr->arguments(); 3377 ZoneList<Expression*>* args = expr->arguments();
3376 int arg_count = args->length(); 3378 int arg_count = args->length();
3377 3379
3378 if (expr->is_jsruntime()) { 3380 if (expr->is_jsruntime()) {
3379 Comment cmnt(masm_, "[ CallRuntime"); 3381 Comment cmnt(masm_, "[ CallRuntime");
3380 EmitLoadJSRuntimeFunction(expr); 3382 EmitLoadJSRuntimeFunction(expr);
3381 3383
3382 // Push the target function under the receiver.
3383 __ LoadP(ip, MemOperand(sp, 0));
3384 PushOperand(ip);
3385 __ StoreP(r3, MemOperand(sp, kPointerSize));
3386
3387 // Push the arguments ("left-to-right"). 3384 // Push the arguments ("left-to-right").
3388 for (int i = 0; i < arg_count; i++) { 3385 for (int i = 0; i < arg_count; i++) {
3389 VisitForStackValue(args->at(i)); 3386 VisitForStackValue(args->at(i));
3390 } 3387 }
3391 3388
3392 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3389 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3393 EmitCallJSRuntimeFunction(expr); 3390 EmitCallJSRuntimeFunction(expr);
3394 3391
3395 // Restore context register. 3392 // Restore context register.
3396 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3393 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 4134
4138 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); 4135 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address)));
4139 4136
4140 DCHECK(interrupt_address == 4137 DCHECK(interrupt_address ==
4141 isolate->builtins()->OnStackReplacement()->entry()); 4138 isolate->builtins()->OnStackReplacement()->entry());
4142 return ON_STACK_REPLACEMENT; 4139 return ON_STACK_REPLACEMENT;
4143 } 4140 }
4144 } // namespace internal 4141 } // namespace internal
4145 } // namespace v8 4142 } // namespace v8
4146 #endif // V8_TARGET_ARCH_PPC 4143 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/full-codegen/s390/full-codegen-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698