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

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.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 | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 3361
3362 __ bind(&runtime); 3362 __ bind(&runtime);
3363 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3363 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3364 3364
3365 __ bind(&done); 3365 __ bind(&done);
3366 context()->Plug(v0); 3366 context()->Plug(v0);
3367 } 3367 }
3368 3368
3369 3369
3370 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3370 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3371 // Push function.
3372 __ LoadNativeContextSlot(expr->context_index(), v0);
3373 PushOperand(v0);
3374
3371 // Push undefined as the receiver. 3375 // Push undefined as the receiver.
3372 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 3376 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
3373 PushOperand(v0); 3377 PushOperand(v0);
3374
3375 __ LoadNativeContextSlot(expr->context_index(), v0);
3376 } 3378 }
3377 3379
3378 3380
3379 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3381 void FullCodeGenerator::EmitCallJSRuntimeFunction(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 SetCallPosition(expr); 3385 SetCallPosition(expr);
3384 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3386 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3385 __ li(a0, Operand(arg_count)); 3387 __ li(a0, Operand(arg_count));
3386 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3388 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3387 RelocInfo::CODE_TARGET); 3389 RelocInfo::CODE_TARGET);
3388 OperandStackDepthDecrement(arg_count + 1); 3390 OperandStackDepthDecrement(arg_count + 1);
3389 } 3391 }
3390 3392
3391 3393
3392 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3394 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3393 ZoneList<Expression*>* args = expr->arguments(); 3395 ZoneList<Expression*>* args = expr->arguments();
3394 int arg_count = args->length(); 3396 int arg_count = args->length();
3395 3397
3396 if (expr->is_jsruntime()) { 3398 if (expr->is_jsruntime()) {
3397 Comment cmnt(masm_, "[ CallRuntime"); 3399 Comment cmnt(masm_, "[ CallRuntime");
3398 EmitLoadJSRuntimeFunction(expr); 3400 EmitLoadJSRuntimeFunction(expr);
3399 3401
3400 // Push the target function under the receiver.
3401 __ ld(at, MemOperand(sp, 0));
3402 PushOperand(at);
3403 __ sd(v0, MemOperand(sp, kPointerSize));
3404
3405 // Push the arguments ("left-to-right"). 3402 // Push the arguments ("left-to-right").
3406 for (int i = 0; i < arg_count; i++) { 3403 for (int i = 0; i < arg_count; i++) {
3407 VisitForStackValue(args->at(i)); 3404 VisitForStackValue(args->at(i));
3408 } 3405 }
3409 3406
3410 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3407 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3411 EmitCallJSRuntimeFunction(expr); 3408 EmitCallJSRuntimeFunction(expr);
3412 3409
3413 // Restore context register. 3410 // Restore context register.
3414 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3411 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
4171 reinterpret_cast<uint64_t>( 4168 reinterpret_cast<uint64_t>(
4172 isolate->builtins()->OnStackReplacement()->entry())); 4169 isolate->builtins()->OnStackReplacement()->entry()));
4173 return ON_STACK_REPLACEMENT; 4170 return ON_STACK_REPLACEMENT;
4174 } 4171 }
4175 4172
4176 4173
4177 } // namespace internal 4174 } // namespace internal
4178 } // namespace v8 4175 } // namespace v8
4179 4176
4180 #endif // V8_TARGET_ARCH_MIPS64 4177 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698