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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.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 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 3284 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
3285 bool can_invoke_directly = | 3285 bool can_invoke_directly = |
3286 dont_adapt_arguments || formal_parameter_count == arity; | 3286 dont_adapt_arguments || formal_parameter_count == arity; |
3287 | 3287 |
3288 Register function_reg = edi; | 3288 Register function_reg = edi; |
3289 | 3289 |
3290 if (can_invoke_directly) { | 3290 if (can_invoke_directly) { |
3291 // Change context. | 3291 // Change context. |
3292 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); | 3292 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); |
3293 | 3293 |
3294 // Always initialize eax to the number of actual arguments. | 3294 // Always initialize new target and number of actual arguments. |
| 3295 __ mov(edx, factory()->undefined_value()); |
3295 __ mov(eax, arity); | 3296 __ mov(eax, arity); |
3296 | 3297 |
3297 // Invoke function directly. | 3298 // Invoke function directly. |
3298 if (function.is_identical_to(info()->closure())) { | 3299 if (function.is_identical_to(info()->closure())) { |
3299 __ CallSelf(); | 3300 __ CallSelf(); |
3300 } else { | 3301 } else { |
3301 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3302 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3302 } | 3303 } |
3303 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3304 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3304 } else { | 3305 } else { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 } | 3348 } |
3348 generator.AfterCall(); | 3349 generator.AfterCall(); |
3349 } | 3350 } |
3350 } | 3351 } |
3351 | 3352 |
3352 | 3353 |
3353 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3354 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3354 DCHECK(ToRegister(instr->function()).is(edi)); | 3355 DCHECK(ToRegister(instr->function()).is(edi)); |
3355 DCHECK(ToRegister(instr->result()).is(eax)); | 3356 DCHECK(ToRegister(instr->result()).is(eax)); |
3356 | 3357 |
3357 __ mov(eax, instr->arity()); | |
3358 | |
3359 // Change context. | 3358 // Change context. |
3360 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 3359 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
3361 | 3360 |
| 3361 // Always initialize new target and number of actual arguments. |
| 3362 __ mov(edx, factory()->undefined_value()); |
| 3363 __ mov(eax, instr->arity()); |
| 3364 |
3362 bool is_self_call = false; | 3365 bool is_self_call = false; |
3363 if (instr->hydrogen()->function()->IsConstant()) { | 3366 if (instr->hydrogen()->function()->IsConstant()) { |
3364 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | 3367 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
3365 Handle<JSFunction> jsfun = | 3368 Handle<JSFunction> jsfun = |
3366 Handle<JSFunction>::cast(fun_const->handle(isolate())); | 3369 Handle<JSFunction>::cast(fun_const->handle(isolate())); |
3367 is_self_call = jsfun.is_identical_to(info()->closure()); | 3370 is_self_call = jsfun.is_identical_to(info()->closure()); |
3368 } | 3371 } |
3369 | 3372 |
3370 if (is_self_call) { | 3373 if (is_self_call) { |
3371 __ CallSelf(); | 3374 __ CallSelf(); |
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5651 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5654 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5652 } | 5655 } |
5653 | 5656 |
5654 | 5657 |
5655 #undef __ | 5658 #undef __ |
5656 | 5659 |
5657 } // namespace internal | 5660 } // namespace internal |
5658 } // namespace v8 | 5661 } // namespace v8 |
5659 | 5662 |
5660 #endif // V8_TARGET_ARCH_IA32 | 5663 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |