Reviewers: Vyacheslav Egorov,

Description:
Generalize fix for overflowing of the frame-element constant pool.

BUG=74627

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

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

Affected files:
  M src/ia32/virtual-frame-ia32.h
  M src/ia32/virtual-frame-ia32.cc
  M src/virtual-frame-heavy-inl.h
  M src/x64/codegen-x64.cc
  M src/x64/virtual-frame-x64.h
  M src/x64/virtual-frame-x64.cc


Index: src/ia32/virtual-frame-ia32.cc
diff --git a/src/ia32/virtual-frame-ia32.cc b/src/ia32/virtual-frame-ia32.cc
index 5e2cbeec4afafb898462526b000d822b4d9cea4f..93d711e9362b03cc9967491af063f43a2e7a1179 100644
--- a/src/ia32/virtual-frame-ia32.cc
+++ b/src/ia32/virtual-frame-ia32.cc
@@ -1339,6 +1339,20 @@ void VirtualFrame::Push(Expression* expr) {
 }


+void VirtualFrame::Push(Handle<Object> value) {
+  if (ConstantPoolOverflowed()) {
+    Result temp = cgen()->allocator()->Allocate();
+    ASSERT(temp.is_valid());
+    __ Set(temp.reg(), Immediate(value));
+    Push(&temp);
+  } else {
+    FrameElement element =
+        FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED);
+    elements_.Add(element);
+  }
+}
+
+
 #undef __

 } }  // namespace v8::internal
Index: src/ia32/virtual-frame-ia32.h
diff --git a/src/ia32/virtual-frame-ia32.h b/src/ia32/virtual-frame-ia32.h
index f5d0e8d660220eab0c205bedb887a79e21a6fe71..51874309d5c5ad1452b4f4ab5f0dc6fc2672f5d8 100644
--- a/src/ia32/virtual-frame-ia32.h
+++ b/src/ia32/virtual-frame-ia32.h
@@ -422,8 +422,8 @@ class VirtualFrame: public ZoneObject {
   inline bool ConstantPoolOverflowed();

   // Push an element on the virtual frame.
+  void Push(Handle<Object> value);
   inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown());
-  inline void Push(Handle<Object> value);
   inline void Push(Smi* value);

   void PushUntaggedElement(Handle<Object> value);
Index: src/virtual-frame-heavy-inl.h
diff --git a/src/virtual-frame-heavy-inl.h b/src/virtual-frame-heavy-inl.h
index ac844b44c7aa2e681059c6ec0a421a2b169962cb..cf12eca62320d2711f051d88a14a7dc95141922f 100644
--- a/src/virtual-frame-heavy-inl.h
+++ b/src/virtual-frame-heavy-inl.h
@@ -87,14 +87,6 @@ bool VirtualFrame::ConstantPoolOverflowed() {
 }


-void VirtualFrame::Push(Handle<Object> value) {
-  ASSERT(!ConstantPoolOverflowed());
-  FrameElement element =
-      FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED);
-  elements_.Add(element);
-}
-
-
 bool VirtualFrame::Equals(VirtualFrame* other) {
 #ifdef DEBUG
   for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) {
Index: src/x64/codegen-x64.cc
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index 6a71e6f57535be9f09718bd7a6e94d06d3f0bf64..ad114c243108bbf89e2e336f873398a8ddfcfea5 100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -4696,18 +4696,7 @@ void CodeGenerator::VisitVariableProxy(VariableProxy* node) {

 void CodeGenerator::VisitLiteral(Literal* node) {
   Comment cmnt(masm_, "[ Literal");
-  if (frame_->ConstantPoolOverflowed()) {
-    Result temp = allocator_->Allocate();
-    ASSERT(temp.is_valid());
-    if (node->handle()->IsSmi()) {
-      __ Move(temp.reg(), Smi::cast(*node->handle()));
-    } else {
-      __ movq(temp.reg(), node->handle(), RelocInfo::EMBEDDED_OBJECT);
-    }
-    frame_->Push(&temp);
-  } else {
-    frame_->Push(node->handle());
-  }
+  frame_->Push(node->handle());
 }


Index: src/x64/virtual-frame-x64.cc
diff --git a/src/x64/virtual-frame-x64.cc b/src/x64/virtual-frame-x64.cc
index 1787044cdd5bbb6b9066662bf5b9e9d66586ca6a..c4d7e65663e76a197df1ca2c280ac7ae9229e8d1 100644
--- a/src/x64/virtual-frame-x64.cc
+++ b/src/x64/virtual-frame-x64.cc
@@ -274,6 +274,24 @@ void VirtualFrame::Push(Expression* expr) {
 }


+void VirtualFrame::Push(Handle<Object> value) {
+  if (ConstantPoolOverflowed()) {
+    Result temp = cgen()->allocator()->Allocate();
+    ASSERT(temp.is_valid());
+    if (value->IsSmi()) {
+      __ Move(temp.reg(), Smi::cast(*value));
+    } else {
+      __ movq(temp.reg(), value, RelocInfo::EMBEDDED_OBJECT);
+    }
+    Push(&temp);
+  } else {
+    FrameElement element =
+        FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED);
+    elements_.Add(element);
+  }
+}
+
+
 void VirtualFrame::Drop(int count) {
   ASSERT(count >= 0);
   ASSERT(height() >= count);
Index: src/x64/virtual-frame-x64.h
diff --git a/src/x64/virtual-frame-x64.h b/src/x64/virtual-frame-x64.h
index b568a7858698167714b3f321c35f48b240d8b032..7396db17f6c7cd94a1a30da721ae940d1009f4f4 100644
--- a/src/x64/virtual-frame-x64.h
+++ b/src/x64/virtual-frame-x64.h
@@ -403,8 +403,8 @@ class VirtualFrame : public ZoneObject {
   inline bool ConstantPoolOverflowed();

   // Push an element on the virtual frame.
+  void Push(Handle<Object> value);
   inline void Push(Register reg, TypeInfo info = TypeInfo::Unknown());
-  inline void Push(Handle<Object> value);
   inline void Push(Smi* value);

   // Pushing a result invalidates it (its contents become owned by the


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

Reply via email to