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

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

Issue 1325573004: [runtime] Replace many buggy uses of %_CallFunction with %_Call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address feedback. Created 5 years, 3 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 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 VisitForAccumulatorValue(args->at(1)); 4071 VisitForAccumulatorValue(args->at(1));
4072 4072
4073 __ pop(a1); 4073 __ pop(a1);
4074 __ mov(a0, result_register()); // StringAddStub requires args in a0, a1. 4074 __ mov(a0, result_register()); // StringAddStub requires args in a0, a1.
4075 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); 4075 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED);
4076 __ CallStub(&stub); 4076 __ CallStub(&stub);
4077 context()->Plug(v0); 4077 context()->Plug(v0);
4078 } 4078 }
4079 4079
4080 4080
4081 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
4082 ZoneList<Expression*>* args = expr->arguments();
4083 DCHECK_LE(2, args->length());
4084 // Push target, receiver and arguments onto the stack.
4085 for (Expression* const arg : *args) {
4086 VisitForStackValue(arg);
4087 }
4088 // Move target to a1.
4089 int const argc = args->length() - 2;
4090 __ lw(a1, MemOperand(sp, (argc + 1) * kPointerSize));
4091 // Call the target.
4092 __ li(a0, Operand(argc));
4093 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
4094 // Restore context register.
4095 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4096 // Discard the function left on TOS.
4097 context()->DropAndPlug(1, v0);
4098 }
4099
4100
4081 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 4101 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
4082 ZoneList<Expression*>* args = expr->arguments(); 4102 ZoneList<Expression*>* args = expr->arguments();
4083 DCHECK(args->length() >= 2); 4103 DCHECK(args->length() >= 2);
4084 4104
4085 int arg_count = args->length() - 2; // 2 ~ receiver and function. 4105 int arg_count = args->length() - 2; // 2 ~ receiver and function.
4086 for (int i = 0; i < arg_count + 1; i++) { 4106 for (int i = 0; i < arg_count + 1; i++) {
4087 VisitForStackValue(args->at(i)); 4107 VisitForStackValue(args->at(i));
4088 } 4108 }
4089 VisitForAccumulatorValue(args->last()); // Function. 4109 VisitForAccumulatorValue(args->last()); // Function.
4090 4110
4091 Label runtime, done; 4111 Label runtime, done;
4092 // Check for non-function argument (including proxy). 4112 // Check for non-function argument (including proxy).
4093 __ JumpIfSmi(v0, &runtime); 4113 __ JumpIfSmi(v0, &runtime);
4094 __ GetObjectType(v0, a1, a1); 4114 __ GetObjectType(v0, a1, a1);
4095 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); 4115 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE));
4096 4116
4097 // InvokeFunction requires the function in a1. Move it in there. 4117 // InvokeFunction requires the function in a1. Move it in there.
4098 __ mov(a1, result_register()); 4118 __ mov(a1, result_register());
4099 ParameterCount count(arg_count); 4119 ParameterCount count(arg_count);
4100 __ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper()); 4120 __ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper());
4101 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4121 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4102 __ jmp(&done); 4122 __ jmp(&done);
4103 4123
4104 __ bind(&runtime); 4124 __ bind(&runtime);
4105 __ push(v0); 4125 __ push(v0);
4106 __ CallRuntime(Runtime::kCall, args->length()); 4126 __ CallRuntime(Runtime::kCallFunction, args->length());
4107 __ bind(&done); 4127 __ bind(&done);
4108 4128
4109 context()->Plug(v0); 4129 context()->Plug(v0);
4110 } 4130 }
4111 4131
4112 4132
4113 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4133 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
4114 ZoneList<Expression*>* args = expr->arguments(); 4134 ZoneList<Expression*>* args = expr->arguments();
4115 DCHECK(args->length() == 2); 4135 DCHECK(args->length() == 2);
4116 4136
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
5318 reinterpret_cast<uint32_t>( 5338 reinterpret_cast<uint32_t>(
5319 isolate->builtins()->OsrAfterStackCheck()->entry())); 5339 isolate->builtins()->OsrAfterStackCheck()->entry()));
5320 return OSR_AFTER_STACK_CHECK; 5340 return OSR_AFTER_STACK_CHECK;
5321 } 5341 }
5322 5342
5323 5343
5324 } // namespace internal 5344 } // namespace internal
5325 } // namespace v8 5345 } // namespace v8
5326 5346
5327 #endif // V8_TARGET_ARCH_MIPS 5347 #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