| 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/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/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 3333 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
| 3334 bool can_invoke_directly = | 3334 bool can_invoke_directly = |
| 3335 dont_adapt_arguments || formal_parameter_count == arity; | 3335 dont_adapt_arguments || formal_parameter_count == arity; |
| 3336 | 3336 |
| 3337 Register function_reg = edi; | 3337 Register function_reg = edi; |
| 3338 | 3338 |
| 3339 if (can_invoke_directly) { | 3339 if (can_invoke_directly) { |
| 3340 // Change context. | 3340 // Change context. |
| 3341 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); | 3341 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); |
| 3342 | 3342 |
| 3343 // Set eax to arguments count if adaption is not needed. Assumes that eax | 3343 // Always initialize eax to the number of actual arguments. |
| 3344 // is available to write to at this point. | 3344 __ mov(eax, arity); |
| 3345 if (dont_adapt_arguments) { | |
| 3346 __ mov(eax, arity); | |
| 3347 } | |
| 3348 | 3345 |
| 3349 // Invoke function directly. | 3346 // Invoke function directly. |
| 3350 if (function.is_identical_to(info()->closure())) { | 3347 if (function.is_identical_to(info()->closure())) { |
| 3351 __ CallSelf(); | 3348 __ CallSelf(); |
| 3352 } else { | 3349 } else { |
| 3353 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3350 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); |
| 3354 } | 3351 } |
| 3355 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3352 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
| 3356 } else { | 3353 } else { |
| 3357 // We need to adapt arguments. | 3354 // We need to adapt arguments. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3399 } | 3396 } |
| 3400 generator.AfterCall(); | 3397 generator.AfterCall(); |
| 3401 } | 3398 } |
| 3402 } | 3399 } |
| 3403 | 3400 |
| 3404 | 3401 |
| 3405 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3402 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
| 3406 DCHECK(ToRegister(instr->function()).is(edi)); | 3403 DCHECK(ToRegister(instr->function()).is(edi)); |
| 3407 DCHECK(ToRegister(instr->result()).is(eax)); | 3404 DCHECK(ToRegister(instr->result()).is(eax)); |
| 3408 | 3405 |
| 3409 if (instr->hydrogen()->pass_argument_count()) { | 3406 __ mov(eax, instr->arity()); |
| 3410 __ mov(eax, instr->arity()); | |
| 3411 } | |
| 3412 | 3407 |
| 3413 // Change context. | 3408 // Change context. |
| 3414 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 3409 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 3415 | 3410 |
| 3416 bool is_self_call = false; | 3411 bool is_self_call = false; |
| 3417 if (instr->hydrogen()->function()->IsConstant()) { | 3412 if (instr->hydrogen()->function()->IsConstant()) { |
| 3418 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | 3413 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
| 3419 Handle<JSFunction> jsfun = | 3414 Handle<JSFunction> jsfun = |
| 3420 Handle<JSFunction>::cast(fun_const->handle(isolate())); | 3415 Handle<JSFunction>::cast(fun_const->handle(isolate())); |
| 3421 is_self_call = jsfun.is_identical_to(info()->closure()); | 3416 is_self_call = jsfun.is_identical_to(info()->closure()); |
| (...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5754 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5749 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5755 } | 5750 } |
| 5756 | 5751 |
| 5757 | 5752 |
| 5758 #undef __ | 5753 #undef __ |
| 5759 | 5754 |
| 5760 } // namespace internal | 5755 } // namespace internal |
| 5761 } // namespace v8 | 5756 } // namespace v8 |
| 5762 | 5757 |
| 5763 #endif // V8_TARGET_ARCH_IA32 | 5758 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |