Two small fixes for the Math.sin and Math.cos optimizations.
authorager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 15 Jun 2009 12:55:48 +0000 (12:55 +0000)
committerager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 15 Jun 2009 12:55:48 +0000 (12:55 +0000)
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
src/ia32/codegen-ia32.cc

index 9b45bfedbb1d17988f358d7977f3d2bec6e95ec1..7744c13fa352b85d8b8360f4e6601ee2aed22890 100644 (file)
@@ -3416,7 +3416,7 @@ void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
 
 void CodeGenerator::GenerateFastMathOp(MathOp op, ZoneList<Expression*>* args) {
   VirtualFrame::SpilledScope spilled_scope;
-  Load(args->at(0));
+  LoadAndSpill(args->at(0));
   switch (op) {
     case SIN:
       __ CallRuntime(Runtime::kMath_sin, 1);
index bf022aecb41fe2add5f36a0a0b30639fe0d68ecb..8faec95ad9c613c8330395d1941544fa76ca7cce 100644 (file)
@@ -4995,11 +4995,8 @@ void CodeGenerator::GenerateFastMathOp(MathOp op, ZoneList<Expression*>* 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();