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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3555 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 3555 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
3556 bool can_invoke_directly = | 3556 bool can_invoke_directly = |
3557 dont_adapt_arguments || formal_parameter_count == arity; | 3557 dont_adapt_arguments || formal_parameter_count == arity; |
3558 | 3558 |
3559 Register function_reg = edi; | 3559 Register function_reg = edi; |
3560 | 3560 |
3561 if (can_invoke_directly) { | 3561 if (can_invoke_directly) { |
3562 // Change context. | 3562 // Change context. |
3563 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); | 3563 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); |
3564 | 3564 |
3565 // Always initialize eax to the number of actual arguments. | 3565 // Always initialize new target and number of actual arguments. |
| 3566 __ mov(edx, factory()->undefined_value()); |
3566 __ mov(eax, arity); | 3567 __ mov(eax, arity); |
3567 | 3568 |
3568 // Invoke function directly. | 3569 // Invoke function directly. |
3569 if (function.is_identical_to(info()->closure())) { | 3570 if (function.is_identical_to(info()->closure())) { |
3570 __ CallSelf(); | 3571 __ CallSelf(); |
3571 } else { | 3572 } else { |
3572 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3573 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3573 } | 3574 } |
3574 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3575 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3575 } else { | 3576 } else { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3618 } | 3619 } |
3619 generator.AfterCall(); | 3620 generator.AfterCall(); |
3620 } | 3621 } |
3621 } | 3622 } |
3622 | 3623 |
3623 | 3624 |
3624 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3625 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3625 DCHECK(ToRegister(instr->function()).is(edi)); | 3626 DCHECK(ToRegister(instr->function()).is(edi)); |
3626 DCHECK(ToRegister(instr->result()).is(eax)); | 3627 DCHECK(ToRegister(instr->result()).is(eax)); |
3627 | 3628 |
3628 __ mov(eax, instr->arity()); | |
3629 | |
3630 // Change context. | 3629 // Change context. |
3631 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 3630 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
3632 | 3631 |
| 3632 // Always initialize new target and number of actual arguments. |
| 3633 __ mov(edx, factory()->undefined_value()); |
| 3634 __ mov(eax, instr->arity()); |
| 3635 |
3633 bool is_self_call = false; | 3636 bool is_self_call = false; |
3634 if (instr->hydrogen()->function()->IsConstant()) { | 3637 if (instr->hydrogen()->function()->IsConstant()) { |
3635 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | 3638 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
3636 Handle<JSFunction> jsfun = | 3639 Handle<JSFunction> jsfun = |
3637 Handle<JSFunction>::cast(fun_const->handle(isolate())); | 3640 Handle<JSFunction>::cast(fun_const->handle(isolate())); |
3638 is_self_call = jsfun.is_identical_to(info()->closure()); | 3641 is_self_call = jsfun.is_identical_to(info()->closure()); |
3639 } | 3642 } |
3640 | 3643 |
3641 if (is_self_call) { | 3644 if (is_self_call) { |
3642 __ CallSelf(); | 3645 __ CallSelf(); |
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6266 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6269 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6267 } | 6270 } |
6268 | 6271 |
6269 | 6272 |
6270 #undef __ | 6273 #undef __ |
6271 | 6274 |
6272 } // namespace internal | 6275 } // namespace internal |
6273 } // namespace v8 | 6276 } // namespace v8 |
6274 | 6277 |
6275 #endif // V8_TARGET_ARCH_X87 | 6278 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |