Reviewers: jochen (OOO from March 1), ulan,

Description:
A64: Minor improvement in FullCodeGenerator::VisitObjectLiteral.

This patch avoid to push some values on the stack when it's not needed.

[email protected], [email protected]

Please review this at https://codereview.chromium.org/183193005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+12, -13 lines):
  M src/a64/full-codegen-a64.cc


Index: src/a64/full-codegen-a64.cc
diff --git a/src/a64/full-codegen-a64.cc b/src/a64/full-codegen-a64.cc
index 41ee16e1a92be4aadaed95a3435e2722c9524890..fbefe049fcaeba4fca1a105e61cd8a8e3d766d96 100644
--- a/src/a64/full-codegen-a64.cc
+++ b/src/a64/full-codegen-a64.cc
@@ -1690,30 +1690,29 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
           }
           break;
         }
-        // Duplicate receiver on stack.
-        __ Peek(x0, 0);
-        __ Push(x0);
-        VisitForStackValue(key);
-        VisitForStackValue(value);
         if (property->emit_store()) {
+          // Duplicate receiver on stack.
+          __ Peek(x0, 0);
+          __ Push(x0);
+          VisitForStackValue(key);
+          VisitForStackValue(value);
           __ Mov(x0, Operand(Smi::FromInt(NONE)));  // PropertyAttributes
           __ Push(x0);
           __ CallRuntime(Runtime::kSetProperty, 4);
         } else {
-          __ Drop(3);
+          VisitForEffect(key);
+          VisitForEffect(value);
         }
         break;
       case ObjectLiteral::Property::PROTOTYPE:
-        // Duplicate receiver on stack.
-        __ Peek(x0, 0);
- // TODO(jbramley): This push shouldn't be necessary if we don't call the
-        // runtime below. In that case, skip it.
-        __ Push(x0);
-        VisitForStackValue(value);
         if (property->emit_store()) {
+          // Duplicate receiver on stack.
+          __ Peek(x0, 0);
+          __ Push(x0);
+          VisitForStackValue(value);
           __ CallRuntime(Runtime::kSetPrototype, 2);
         } else {
-          __ Drop(2);
+          VisitForEffect(value);
         }
         break;
       case ObjectLiteral::Property::GETTER:


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to