Reviewers: Mads Ager,

Description:
Reporting -1 as the size of an ILLEGAL reference which actually has
size 0 was too cute.

Please review this at http://codereview.chromium.org/9689

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

Affected files:
   M     src/codegen-arm.h
   M     src/codegen-arm.cc
   M     src/codegen-ia32.h
   M     src/codegen-ia32.cc


Index: src/codegen-ia32.h
===================================================================
--- src/codegen-ia32.h  (revision 706)
+++ src/codegen-ia32.h  (working copy)
@@ -121,8 +121,8 @@
      type_ = value;
    }

-  // The size of the reference or -1 if the reference is illegal.
-  int size() const { return type_; }
+  // The size the reference takes up on the stack.
+  int size() const { return (type_ == ILLEGAL) ? 0 : type_; }

    bool is_illegal() const { return type_ == ILLEGAL; }
    bool is_slot() const { return type_ == SLOT; }
Index: src/codegen-arm.cc
===================================================================
--- src/codegen-arm.cc  (revision 706)
+++ src/codegen-arm.cc  (working copy)
@@ -569,9 +569,7 @@
    // Pop a reference from the stack while preserving TOS.
    Comment cmnt(masm_, "[ UnloadReference");
    int size = ref->size();
-  if (size <= 0) {
-    // Do nothing. No popping is necessary.
-  } else {
+  if (size > 0) {
      frame_->Pop(r0);
      frame_->Drop(size);
      frame_->Push(r0);
Index: src/codegen-arm.h
===================================================================
--- src/codegen-arm.h   (revision 706)
+++ src/codegen-arm.h   (working copy)
@@ -117,8 +117,8 @@
      type_ = value;
    }

-  // The size of the reference or -1 if the reference is illegal.
-  int size() const { return type_; }
+  // The size the reference takes up on the stack.
+  int size() const { return (type_ == ILLEGAL) ? 0 : type_; }

    bool is_illegal() const { return type_ == ILLEGAL; }
    bool is_slot() const { return type_ == SLOT; }
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 706)
+++ src/codegen-ia32.cc (working copy)
@@ -607,12 +607,10 @@
    // Pop a reference from the stack while preserving TOS.
    Comment cmnt(masm_, "[ UnloadReference");
    int size = ref->size();
-  if (size <= 0) {
-    // Do nothing. No popping is necessary.
-  } else if (size == 1) {
+  if (size == 1) {
      frame_->Pop(eax);
      __ mov(frame_->Top(), eax);
-  } else {
+  } else if (size > 1) {
      frame_->Pop(eax);
      frame_->Drop(size);
      frame_->Push(eax);



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to