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

Side by Side Diff: src/mips/lithium-codegen-mips.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/mips/lithium-codegen-mips.h ('k') | src/mips64/lithium-codegen-mips64.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.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3535 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 DCHECK(ToRegister(instr->context()).is(cp)); 3546 DCHECK(ToRegister(instr->context()).is(cp));
3547 __ li(scratch0(), instr->hydrogen()->pairs()); 3547 __ li(scratch0(), instr->hydrogen()->pairs());
3548 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); 3548 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
3549 // The context is the first argument. 3549 // The context is the first argument.
3550 __ Push(cp, scratch0(), scratch1()); 3550 __ Push(cp, scratch0(), scratch1());
3551 CallRuntime(Runtime::kDeclareGlobals, 3, instr); 3551 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3552 } 3552 }
3553 3553
3554 3554
3555 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3555 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3556 int formal_parameter_count, 3556 int formal_parameter_count, int arity,
3557 int arity, 3557 LInstruction* instr) {
3558 LInstruction* instr,
3559 A1State a1_state) {
3560 bool dont_adapt_arguments = 3558 bool dont_adapt_arguments =
3561 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3559 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3562 bool can_invoke_directly = 3560 bool can_invoke_directly =
3563 dont_adapt_arguments || formal_parameter_count == arity; 3561 dont_adapt_arguments || formal_parameter_count == arity;
3564 3562
3563 Register function_reg = a1;
3565 LPointerMap* pointers = instr->pointer_map(); 3564 LPointerMap* pointers = instr->pointer_map();
3566 3565
3567 if (can_invoke_directly) { 3566 if (can_invoke_directly) {
3568 if (a1_state == A1_UNINITIALIZED) {
3569 __ li(a1, function);
3570 }
3571
3572 // Change context. 3567 // Change context.
3573 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 3568 __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
3574 3569
3575 // Set r0 to arguments count if adaption is not needed. Assumes that r0 3570 // Set r0 to arguments count if adaption is not needed. Assumes that r0
3576 // is available to write to at this point. 3571 // is available to write to at this point.
3577 if (dont_adapt_arguments) { 3572 if (dont_adapt_arguments) {
3578 __ li(a0, Operand(arity)); 3573 __ li(a0, Operand(arity));
3579 } 3574 }
3580 3575
3581 // Invoke function. 3576 // Invoke function.
3582 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 3577 __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset));
3583 __ Call(at); 3578 __ Call(at);
3584 3579
3585 // Set up deoptimization. 3580 // Set up deoptimization.
3586 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3581 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3587 } else { 3582 } else {
3588 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3583 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3589 ParameterCount count(arity); 3584 ParameterCount count(arity);
3590 ParameterCount expected(formal_parameter_count); 3585 ParameterCount expected(formal_parameter_count);
3591 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3586 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
3592 } 3587 }
3593 } 3588 }
3594 3589
3595 3590
3596 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3591 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3597 DCHECK(instr->context() != NULL); 3592 DCHECK(instr->context() != NULL);
3598 DCHECK(ToRegister(instr->context()).is(cp)); 3593 DCHECK(ToRegister(instr->context()).is(cp));
3599 Register input = ToRegister(instr->value()); 3594 Register input = ToRegister(instr->value());
3600 Register result = ToRegister(instr->result()); 3595 Register result = ToRegister(instr->result());
3601 Register scratch = scratch0(); 3596 Register scratch = scratch0();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3928 3923
3929 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); 3924 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3930 if (known_function.is_null()) { 3925 if (known_function.is_null()) {
3931 LPointerMap* pointers = instr->pointer_map(); 3926 LPointerMap* pointers = instr->pointer_map();
3932 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3927 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3933 ParameterCount count(instr->arity()); 3928 ParameterCount count(instr->arity());
3934 __ InvokeFunction(a1, count, CALL_FUNCTION, generator); 3929 __ InvokeFunction(a1, count, CALL_FUNCTION, generator);
3935 } else { 3930 } else {
3936 CallKnownFunction(known_function, 3931 CallKnownFunction(known_function,
3937 instr->hydrogen()->formal_parameter_count(), 3932 instr->hydrogen()->formal_parameter_count(),
3938 instr->arity(), 3933 instr->arity(), instr);
3939 instr,
3940 A1_CONTAINS_TARGET);
3941 } 3934 }
3942 } 3935 }
3943 3936
3944 3937
3945 void LCodeGen::DoTailCallThroughMegamorphicCache( 3938 void LCodeGen::DoTailCallThroughMegamorphicCache(
3946 LTailCallThroughMegamorphicCache* instr) { 3939 LTailCallThroughMegamorphicCache* instr) {
3947 Register receiver = ToRegister(instr->receiver()); 3940 Register receiver = ToRegister(instr->receiver());
3948 Register name = ToRegister(instr->name()); 3941 Register name = ToRegister(instr->name());
3949 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); 3942 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister()));
3950 DCHECK(name.is(LoadDescriptor::NameRegister())); 3943 DCHECK(name.is(LoadDescriptor::NameRegister()));
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
5961 __ li(at, scope_info); 5954 __ li(at, scope_info);
5962 __ Push(at, ToRegister(instr->function())); 5955 __ Push(at, ToRegister(instr->function()));
5963 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5956 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5964 RecordSafepoint(Safepoint::kNoLazyDeopt); 5957 RecordSafepoint(Safepoint::kNoLazyDeopt);
5965 } 5958 }
5966 5959
5967 5960
5968 #undef __ 5961 #undef __
5969 5962
5970 } } // namespace v8::internal 5963 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips64/lithium-codegen-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698