| OLD | NEW |
| 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/arm/lithium-codegen-arm.h" | 5 #include "src/arm/lithium-codegen-arm.h" |
| 6 #include "src/arm/lithium-gap-resolver-arm.h" | 6 #include "src/arm/lithium-gap-resolver-arm.h" |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 dont_adapt_arguments || formal_parameter_count == arity; | 3457 dont_adapt_arguments || formal_parameter_count == arity; |
| 3458 | 3458 |
| 3459 Register function_reg = r1; | 3459 Register function_reg = r1; |
| 3460 | 3460 |
| 3461 LPointerMap* pointers = instr->pointer_map(); | 3461 LPointerMap* pointers = instr->pointer_map(); |
| 3462 | 3462 |
| 3463 if (can_invoke_directly) { | 3463 if (can_invoke_directly) { |
| 3464 // Change context. | 3464 // Change context. |
| 3465 __ ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3465 __ ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
| 3466 | 3466 |
| 3467 // Set r0 to arguments count if adaption is not needed. Assumes that r0 | 3467 // Always initialize r0 to the number of actual arguments. |
| 3468 // is available to write to at this point. | 3468 __ mov(r0, Operand(arity)); |
| 3469 if (dont_adapt_arguments) { | |
| 3470 __ mov(r0, Operand(arity)); | |
| 3471 } | |
| 3472 | 3469 |
| 3473 // Invoke function. | 3470 // Invoke function. |
| 3474 __ ldr(ip, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3471 __ ldr(ip, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
| 3475 __ Call(ip); | 3472 __ Call(ip); |
| 3476 | 3473 |
| 3477 // Set up deoptimization. | 3474 // Set up deoptimization. |
| 3478 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3475 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
| 3479 } else { | 3476 } else { |
| 3480 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3477 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3481 ParameterCount count(arity); | 3478 ParameterCount count(arity); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3842 } | 3839 } |
| 3843 generator.AfterCall(); | 3840 generator.AfterCall(); |
| 3844 } | 3841 } |
| 3845 } | 3842 } |
| 3846 | 3843 |
| 3847 | 3844 |
| 3848 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3845 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
| 3849 DCHECK(ToRegister(instr->function()).is(r1)); | 3846 DCHECK(ToRegister(instr->function()).is(r1)); |
| 3850 DCHECK(ToRegister(instr->result()).is(r0)); | 3847 DCHECK(ToRegister(instr->result()).is(r0)); |
| 3851 | 3848 |
| 3852 if (instr->hydrogen()->pass_argument_count()) { | 3849 __ mov(r0, Operand(instr->arity())); |
| 3853 __ mov(r0, Operand(instr->arity())); | |
| 3854 } | |
| 3855 | 3850 |
| 3856 // Change context. | 3851 // Change context. |
| 3857 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 3852 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 3858 | 3853 |
| 3859 // Load the code entry address | 3854 // Load the code entry address |
| 3860 __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 3855 __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 3861 __ Call(ip); | 3856 __ Call(ip); |
| 3862 | 3857 |
| 3863 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3858 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
| 3864 } | 3859 } |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5875 __ push(ToRegister(instr->function())); | 5870 __ push(ToRegister(instr->function())); |
| 5876 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5871 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5877 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5872 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5878 } | 5873 } |
| 5879 | 5874 |
| 5880 | 5875 |
| 5881 #undef __ | 5876 #undef __ |
| 5882 | 5877 |
| 5883 } // namespace internal | 5878 } // namespace internal |
| 5884 } // namespace v8 | 5879 } // namespace v8 |
| OLD | NEW |