From: kmillikin@chromium.org Date: Fri, 7 Nov 2008 08:58:23 +0000 (+0000) Subject: Reporting -1 as the size of an ILLEGAL reference which actually has X-Git-Tag: upstream/4.7.83~25036 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6edea51f89082421dfc4e1500a81e96af941f6d9;p=platform%2Fupstream%2Fv8.git Reporting -1 as the size of an ILLEGAL reference which actually has size 0 was too cute. Review URL: http://codereview.chromium.org/9689 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@709 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc index 4d2cf2d26..fae227016 100644 --- a/src/codegen-arm.cc +++ b/src/codegen-arm.cc @@ -569,9 +569,7 @@ void CodeGenerator::UnloadReference(Reference* ref) { // 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); diff --git a/src/codegen-arm.h b/src/codegen-arm.h index 8d0269127..50f1906b3 100644 --- a/src/codegen-arm.h +++ b/src/codegen-arm.h @@ -117,8 +117,8 @@ class Reference BASE_EMBEDDED { 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; } diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc index a29153e75..22f35232b 100644 --- a/src/codegen-ia32.cc +++ b/src/codegen-ia32.cc @@ -607,12 +607,10 @@ void CodeGenerator::UnloadReference(Reference* ref) { // 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); diff --git a/src/codegen-ia32.h b/src/codegen-ia32.h index 39eea1b09..cb1c1855d 100644 --- a/src/codegen-ia32.h +++ b/src/codegen-ia32.h @@ -121,8 +121,8 @@ class Reference BASE_EMBEDDED { 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; }