OLD | NEW |
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 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 bool can_invoke_directly = | 3406 bool can_invoke_directly = |
3407 dont_adapt_arguments || formal_parameter_count == arity; | 3407 dont_adapt_arguments || formal_parameter_count == arity; |
3408 | 3408 |
3409 Register function_reg = a1; | 3409 Register function_reg = a1; |
3410 LPointerMap* pointers = instr->pointer_map(); | 3410 LPointerMap* pointers = instr->pointer_map(); |
3411 | 3411 |
3412 if (can_invoke_directly) { | 3412 if (can_invoke_directly) { |
3413 // Change context. | 3413 // Change context. |
3414 __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3414 __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
3415 | 3415 |
3416 // Set r0 to arguments count if adaption is not needed. Assumes that r0 | 3416 // Always initialize a0 to the number of actual arguments. |
3417 // is available to write to at this point. | 3417 __ li(a0, Operand(arity)); |
3418 if (dont_adapt_arguments) { | |
3419 __ li(a0, Operand(arity)); | |
3420 } | |
3421 | 3418 |
3422 // Invoke function. | 3419 // Invoke function. |
3423 __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3420 __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3424 __ Call(at); | 3421 __ Call(at); |
3425 | 3422 |
3426 // Set up deoptimization. | 3423 // Set up deoptimization. |
3427 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3424 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3428 } else { | 3425 } else { |
3429 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3426 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3430 ParameterCount count(arity); | 3427 ParameterCount count(arity); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3817 } | 3814 } |
3818 generator.AfterCall(); | 3815 generator.AfterCall(); |
3819 } | 3816 } |
3820 } | 3817 } |
3821 | 3818 |
3822 | 3819 |
3823 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3820 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3824 DCHECK(ToRegister(instr->function()).is(a1)); | 3821 DCHECK(ToRegister(instr->function()).is(a1)); |
3825 DCHECK(ToRegister(instr->result()).is(v0)); | 3822 DCHECK(ToRegister(instr->result()).is(v0)); |
3826 | 3823 |
3827 if (instr->hydrogen()->pass_argument_count()) { | 3824 __ li(a0, Operand(instr->arity())); |
3828 __ li(a0, Operand(instr->arity())); | |
3829 } | |
3830 | 3825 |
3831 // Change context. | 3826 // Change context. |
3832 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3827 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3833 | 3828 |
3834 // Load the code entry address | 3829 // Load the code entry address |
3835 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3830 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3836 __ Call(at); | 3831 __ Call(at); |
3837 | 3832 |
3838 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3833 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3839 } | 3834 } |
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 __ Push(at, ToRegister(instr->function())); | 5924 __ Push(at, ToRegister(instr->function())); |
5930 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5925 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5931 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5926 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5932 } | 5927 } |
5933 | 5928 |
5934 | 5929 |
5935 #undef __ | 5930 #undef __ |
5936 | 5931 |
5937 } // namespace internal | 5932 } // namespace internal |
5938 } // namespace v8 | 5933 } // namespace v8 |
OLD | NEW |