Chromium Code Reviews| Index: src/x64/full-codegen-x64.cc |
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
| index a55788d10668a6ee9a97d57d3789f4ed5e5867c8..cebc09f778d6909d56d2402687320b68a5a97b4d 100644 |
| --- a/src/x64/full-codegen-x64.cc |
| +++ b/src/x64/full-codegen-x64.cc |
| @@ -222,7 +222,7 @@ void FullCodeGenerator::Generate() { |
| __ lea(rdx, |
| Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
| __ push(rdx); |
| - __ Push(Smi::FromInt(num_parameters)); |
| + __ SafePush(Smi::FromInt(num_parameters)); |
| // Arguments to ArgumentsAccessStub: |
| // function, receiver address, parameter count. |
| // The stub will rewrite receiver and parameter count if the previous |
| @@ -504,12 +504,20 @@ void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { |
| void FullCodeGenerator::AccumulatorValueContext::Plug( |
| Handle<Object> lit) const { |
| - __ Move(result_register(), lit); |
| + if (lit->IsSmi()) { |
| + __ SafeMove(result_register(), Smi::cast(*lit)); |
| + } else { |
| + __ Move(result_register(), lit); |
| + } |
| } |
| void FullCodeGenerator::StackValueContext::Plug(Handle<Object> lit) const { |
| - __ Push(lit); |
| + if (lit->IsSmi()) { |
| + __ SafePush(Smi::cast(*lit)); |
| + } else { |
| + __ Push(lit); |
| + } |
| } |
| @@ -2455,7 +2463,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| SetSourcePosition(expr->position()); |
| // Load function and argument count into rdi and rax. |
| - __ Set(rax, arg_count); |
| + __ SafeSet(rax, arg_count); |
| __ movq(rdi, Operand(rsp, arg_count * kPointerSize)); |
| // Record call targets in unoptimized code, but not in the snapshot. |
| @@ -2812,7 +2820,7 @@ void FullCodeGenerator::EmitArguments(CallRuntime* expr) { |
| // parameter count in rax. |
| VisitForAccumulatorValue(args->at(0)); |
| __ movq(rdx, rax); |
| - __ Move(rax, Smi::FromInt(info_->scope()->num_parameters())); |
| + __ SafeMove(rax, Smi::FromInt(info_->scope()->num_parameters())); |
|
Erik Corry
2012/06/26 12:26:40
Can this ever make a difference when kMaxNumFuncti
|
| ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT); |
| __ CallStub(&stub); |
| context()->Plug(rax); |
| @@ -2824,7 +2832,7 @@ void FullCodeGenerator::EmitArgumentsLength(CallRuntime* expr) { |
| Label exit; |
| // Get the number of formal parameters. |
| - __ Move(rax, Smi::FromInt(info_->scope()->num_parameters())); |
| + __ SafeMove(rax, Smi::FromInt(info_->scope()->num_parameters())); |
| // Check if the calling frame is an arguments adaptor frame. |
| __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |