From c1d0401b3de838cd4a83bad16d5d2a0c72bedb44 Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Mon, 15 Jun 2009 12:55:48 +0000 Subject: [PATCH] Two small fixes for the Math.sin and Math.cos optimizations. Review URL: http://codereview.chromium.org/125122 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2167 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/codegen-arm.cc | 2 +- src/ia32/codegen-ia32.cc | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index 9b45bfe..7744c13 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -3416,7 +3416,7 @@ void CodeGenerator::GenerateRandomPositiveSmi(ZoneList* args) { void CodeGenerator::GenerateFastMathOp(MathOp op, ZoneList* args) { VirtualFrame::SpilledScope spilled_scope; - Load(args->at(0)); + LoadAndSpill(args->at(0)); switch (op) { case SIN: __ CallRuntime(Runtime::kMath_sin, 1); diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc index bf022ae..8faec95 100644 --- a/src/ia32/codegen-ia32.cc +++ b/src/ia32/codegen-ia32.cc @@ -4995,11 +4995,8 @@ void CodeGenerator::GenerateFastMathOp(MathOp op, ZoneList* args) { // Store the result in the allocated heap number. __ fstp_d(FieldOperand(heap_number.reg(), HeapNumber::kValueOffset)); - // Pop the extra copy of the argument. - frame_->Pop(); - // Push the result on the frame. - frame_->Push(&heap_number); - heap_number.Unuse(); + // Replace the extra copy of the argument with the result. + frame_->SetElementAt(0, &heap_number); done.Jump(); call_runtime.Bind(); -- 2.7.4