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 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 bool can_invoke_directly = | 3357 bool can_invoke_directly = |
3358 dont_adapt_arguments || formal_parameter_count == arity; | 3358 dont_adapt_arguments || formal_parameter_count == arity; |
3359 | 3359 |
3360 Register function_reg = a1; | 3360 Register function_reg = a1; |
3361 LPointerMap* pointers = instr->pointer_map(); | 3361 LPointerMap* pointers = instr->pointer_map(); |
3362 | 3362 |
3363 if (can_invoke_directly) { | 3363 if (can_invoke_directly) { |
3364 // Change context. | 3364 // Change context. |
3365 __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3365 __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
3366 | 3366 |
3367 // Always initialize a0 to the number of actual arguments. | 3367 // Always initialize new target and number of actual arguments. |
| 3368 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
3368 __ li(a0, Operand(arity)); | 3369 __ li(a0, Operand(arity)); |
3369 | 3370 |
3370 // Invoke function. | 3371 // Invoke function. |
3371 __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3372 __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3372 __ Call(at); | 3373 __ Call(at); |
3373 | 3374 |
3374 // Set up deoptimization. | 3375 // Set up deoptimization. |
3375 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3376 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3376 } else { | 3377 } else { |
3377 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3378 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3765 } | 3766 } |
3766 generator.AfterCall(); | 3767 generator.AfterCall(); |
3767 } | 3768 } |
3768 } | 3769 } |
3769 | 3770 |
3770 | 3771 |
3771 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3772 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3772 DCHECK(ToRegister(instr->function()).is(a1)); | 3773 DCHECK(ToRegister(instr->function()).is(a1)); |
3773 DCHECK(ToRegister(instr->result()).is(v0)); | 3774 DCHECK(ToRegister(instr->result()).is(v0)); |
3774 | 3775 |
3775 __ li(a0, Operand(instr->arity())); | |
3776 | |
3777 // Change context. | 3776 // Change context. |
3778 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3777 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3779 | 3778 |
| 3779 // Always initialize new target and number of actual arguments. |
| 3780 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
| 3781 __ li(a0, Operand(instr->arity())); |
| 3782 |
3780 // Load the code entry address | 3783 // Load the code entry address |
3781 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3784 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3782 __ Call(at); | 3785 __ Call(at); |
3783 | 3786 |
3784 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3787 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3785 } | 3788 } |
3786 | 3789 |
3787 | 3790 |
3788 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3791 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3789 DCHECK(ToRegister(instr->context()).is(cp)); | 3792 DCHECK(ToRegister(instr->context()).is(cp)); |
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5828 __ Push(at, ToRegister(instr->function())); | 5831 __ Push(at, ToRegister(instr->function())); |
5829 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5832 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5830 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5833 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5831 } | 5834 } |
5832 | 5835 |
5833 | 5836 |
5834 #undef __ | 5837 #undef __ |
5835 | 5838 |
5836 } // namespace internal | 5839 } // namespace internal |
5837 } // namespace v8 | 5840 } // namespace v8 |
OLD | NEW |