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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.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 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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 3358
3359 __ bind(&runtime); 3359 __ bind(&runtime);
3360 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3360 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3361 3361
3362 __ bind(&done); 3362 __ bind(&done);
3363 context()->Plug(v0); 3363 context()->Plug(v0);
3364 } 3364 }
3365 3365
3366 3366
3367 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3367 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3368 // Push function.
3369 __ LoadNativeContextSlot(expr->context_index(), v0);
3370 PushOperand(v0);
3371
3368 // Push undefined as the receiver. 3372 // Push undefined as the receiver.
3369 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 3373 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
3370 PushOperand(v0); 3374 PushOperand(v0);
3371
3372 __ LoadNativeContextSlot(expr->context_index(), v0);
3373 } 3375 }
3374 3376
3375 3377
3376 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3378 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
3377 ZoneList<Expression*>* args = expr->arguments(); 3379 ZoneList<Expression*>* args = expr->arguments();
3378 int arg_count = args->length(); 3380 int arg_count = args->length();
3379 3381
3380 SetCallPosition(expr); 3382 SetCallPosition(expr);
3381 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3383 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3382 __ li(a0, Operand(arg_count)); 3384 __ li(a0, Operand(arg_count));
3383 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3385 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3384 RelocInfo::CODE_TARGET); 3386 RelocInfo::CODE_TARGET);
3385 OperandStackDepthDecrement(arg_count + 1); 3387 OperandStackDepthDecrement(arg_count + 1);
3386 } 3388 }
3387 3389
3388 3390
3389 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3391 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3390 ZoneList<Expression*>* args = expr->arguments(); 3392 ZoneList<Expression*>* args = expr->arguments();
3391 int arg_count = args->length(); 3393 int arg_count = args->length();
3392 3394
3393 if (expr->is_jsruntime()) { 3395 if (expr->is_jsruntime()) {
3394 Comment cmnt(masm_, "[ CallRuntime"); 3396 Comment cmnt(masm_, "[ CallRuntime");
3395 EmitLoadJSRuntimeFunction(expr); 3397 EmitLoadJSRuntimeFunction(expr);
3396 3398
3397 // Push the target function under the receiver.
3398 __ lw(at, MemOperand(sp, 0));
3399 PushOperand(at);
3400 __ sw(v0, MemOperand(sp, kPointerSize));
3401
3402 // Push the arguments ("left-to-right"). 3399 // Push the arguments ("left-to-right").
3403 for (int i = 0; i < arg_count; i++) { 3400 for (int i = 0; i < arg_count; i++) {
3404 VisitForStackValue(args->at(i)); 3401 VisitForStackValue(args->at(i));
3405 } 3402 }
3406 3403
3407 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3404 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3408 EmitCallJSRuntimeFunction(expr); 3405 EmitCallJSRuntimeFunction(expr);
3409 3406
3410 // Restore context register. 3407 // Restore context register.
3411 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3408 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
4163 reinterpret_cast<uint32_t>( 4160 reinterpret_cast<uint32_t>(
4164 isolate->builtins()->OnStackReplacement()->entry())); 4161 isolate->builtins()->OnStackReplacement()->entry()));
4165 return ON_STACK_REPLACEMENT; 4162 return ON_STACK_REPLACEMENT;
4166 } 4163 }
4167 4164
4168 4165
4169 } // namespace internal 4166 } // namespace internal
4170 } // namespace v8 4167 } // namespace v8
4171 4168
4172 #endif // V8_TARGET_ARCH_MIPS 4169 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698