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

Side by Side Diff: src/mips64/lithium-codegen-mips64.cc

Issue 817483005: LCodeGen::CallKnownFunction gets the function in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm Created 5 years, 11 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/mips64/lithium-codegen-mips64.h ('k') | src/x64/lithium-codegen-x64.h » ('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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/hydrogen-osr.h" 9 #include "src/hydrogen-osr.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 3564 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 DCHECK(ToRegister(instr->context()).is(cp)); 3575 DCHECK(ToRegister(instr->context()).is(cp));
3576 __ li(scratch0(), instr->hydrogen()->pairs()); 3576 __ li(scratch0(), instr->hydrogen()->pairs());
3577 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); 3577 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3578 // The context is the first argument. 3578 // The context is the first argument.
3579 __ Push(cp, scratch0(), scratch1()); 3579 __ Push(cp, scratch0(), scratch1());
3580 CallRuntime(Runtime::kDeclareGlobals, 3, instr); 3580 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3581 } 3581 }
3582 3582
3583 3583
3584 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3584 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3585 int formal_parameter_count, 3585 int formal_parameter_count, int arity,
3586 int arity, 3586 LInstruction* instr) {
3587 LInstruction* instr,
3588 A1State a1_state) {
3589 bool dont_adapt_arguments = 3587 bool dont_adapt_arguments =
3590 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3588 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3591 bool can_invoke_directly = 3589 bool can_invoke_directly =
3592 dont_adapt_arguments || formal_parameter_count == arity; 3590 dont_adapt_arguments || formal_parameter_count == arity;
3593 3591
3592 Register function_reg = a1;
3594 LPointerMap* pointers = instr->pointer_map(); 3593 LPointerMap* pointers = instr->pointer_map();
3595 3594
3596 if (can_invoke_directly) { 3595 if (can_invoke_directly) {
3597 if (a1_state == A1_UNINITIALIZED) {
3598 __ li(a1, function);
3599 }
3600
3601 // Change context. 3596 // Change context.
3602 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 3597 __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
3603 3598
3604 // Set r0 to arguments count if adaption is not needed. Assumes that r0 3599 // Set r0 to arguments count if adaption is not needed. Assumes that r0
3605 // is available to write to at this point. 3600 // is available to write to at this point.
3606 if (dont_adapt_arguments) { 3601 if (dont_adapt_arguments) {
3607 __ li(a0, Operand(arity)); 3602 __ li(a0, Operand(arity));
3608 } 3603 }
3609 3604
3610 // Invoke function. 3605 // Invoke function.
3611 __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 3606 __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset));
3612 __ Call(at); 3607 __ Call(at);
3613 3608
3614 // Set up deoptimization. 3609 // Set up deoptimization.
3615 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3610 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3616 } else { 3611 } else {
3617 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3612 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3618 ParameterCount count(arity); 3613 ParameterCount count(arity);
3619 ParameterCount expected(formal_parameter_count); 3614 ParameterCount expected(formal_parameter_count);
3620 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3615 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
3621 } 3616 }
3622 } 3617 }
3623 3618
3624 3619
3625 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3620 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3626 DCHECK(instr->context() != NULL); 3621 DCHECK(instr->context() != NULL);
3627 DCHECK(ToRegister(instr->context()).is(cp)); 3622 DCHECK(ToRegister(instr->context()).is(cp));
3628 Register input = ToRegister(instr->value()); 3623 Register input = ToRegister(instr->value());
3629 Register result = ToRegister(instr->result()); 3624 Register result = ToRegister(instr->result());
3630 Register scratch = scratch0(); 3625 Register scratch = scratch0();
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3960 3955
3961 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); 3956 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3962 if (known_function.is_null()) { 3957 if (known_function.is_null()) {
3963 LPointerMap* pointers = instr->pointer_map(); 3958 LPointerMap* pointers = instr->pointer_map();
3964 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3959 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3965 ParameterCount count(instr->arity()); 3960 ParameterCount count(instr->arity());
3966 __ InvokeFunction(a1, count, CALL_FUNCTION, generator); 3961 __ InvokeFunction(a1, count, CALL_FUNCTION, generator);
3967 } else { 3962 } else {
3968 CallKnownFunction(known_function, 3963 CallKnownFunction(known_function,
3969 instr->hydrogen()->formal_parameter_count(), 3964 instr->hydrogen()->formal_parameter_count(),
3970 instr->arity(), 3965 instr->arity(), instr);
3971 instr,
3972 A1_CONTAINS_TARGET);
3973 } 3966 }
3974 } 3967 }
3975 3968
3976 3969
3977 void LCodeGen::DoTailCallThroughMegamorphicCache( 3970 void LCodeGen::DoTailCallThroughMegamorphicCache(
3978 LTailCallThroughMegamorphicCache* instr) { 3971 LTailCallThroughMegamorphicCache* instr) {
3979 Register receiver = ToRegister(instr->receiver()); 3972 Register receiver = ToRegister(instr->receiver());
3980 Register name = ToRegister(instr->name()); 3973 Register name = ToRegister(instr->name());
3981 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); 3974 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister()));
3982 DCHECK(name.is(LoadDescriptor::NameRegister())); 3975 DCHECK(name.is(LoadDescriptor::NameRegister()));
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
5991 __ li(at, scope_info); 5984 __ li(at, scope_info);
5992 __ Push(at, ToRegister(instr->function())); 5985 __ Push(at, ToRegister(instr->function()));
5993 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5986 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5994 RecordSafepoint(Safepoint::kNoLazyDeopt); 5987 RecordSafepoint(Safepoint::kNoLazyDeopt);
5995 } 5988 }
5996 5989
5997 5990
5998 #undef __ 5991 #undef __
5999 5992
6000 } } // namespace v8::internal 5993 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698