Author: f...@chromium.org
Date: Mon Jun 29 14:15:03 2009
New Revision: 2299

Modified:
    branches/bleeding_edge/src/heap.cc
    branches/bleeding_edge/src/heap.h

Log:
Workaround a gcc 4.4 bug.

Gcc generates wrong vtable entries for certain code pattern. The change in  
heap.cc has detailed explanation.

Review URL: http://codereview.chromium.org/147022

Modified: branches/bleeding_edge/src/heap.cc
==============================================================================
--- branches/bleeding_edge/src/heap.cc  (original)
+++ branches/bleeding_edge/src/heap.cc  Mon Jun 29 14:15:03 2009
@@ -1257,28 +1257,49 @@
    return true;
  }

+
+void Heap::CreateCEntryStub() {
+  CEntryStub stub;
+  c_entry_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateCEntryDebugBreakStub() {
+  CEntryDebugBreakStub stub;
+  c_entry_debug_break_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateJSEntryStub() {
+  JSEntryStub stub;
+  js_entry_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateJSConstructEntryStub() {
+  JSConstructEntryStub stub;
+  js_construct_entry_code_ = *stub.GetCode();
+}
+
+
  void Heap::CreateFixedStubs() {
    // Here we create roots for fixed stubs. They are needed at GC
    // for cooking and uncooking (check out frames.cc).
    // The eliminates the need for doing dictionary lookup in the
    // stub cache for these stubs.
    HandleScope scope;
-  {
-    CEntryStub stub;
-    c_entry_code_ = *stub.GetCode();
-  }
-  {
-    CEntryDebugBreakStub stub;
-    c_entry_debug_break_code_ = *stub.GetCode();
-  }
-  {
-    JSEntryStub stub;
-    js_entry_code_ = *stub.GetCode();
-  }
-  {
-    JSConstructEntryStub stub;
-    js_construct_entry_code_ = *stub.GetCode();
-  }
+  // gcc-4.4 has problem generating correct code of following snippet:
+  // {  CEntryStub stub;
+  //    c_entry_code_ = *stub.GetCode();
+  // }
+  // {  CEntryDebugBreakStub stub;
+  //    c_entry_debug_break_code_ = *stub.GetCode();
+  // }
+  // To workaround the problem, make separate functions without inlining.
+  Heap::CreateCEntryStub();
+  Heap::CreateCEntryDebugBreakStub();
+  Heap::CreateJSEntryStub();
+  Heap::CreateJSConstructEntryStub();
  }



Modified: branches/bleeding_edge/src/heap.h
==============================================================================
--- branches/bleeding_edge/src/heap.h   (original)
+++ branches/bleeding_edge/src/heap.h   Mon Jun 29 14:15:03 2009
@@ -920,7 +920,15 @@

    static bool CreateInitialMaps();
    static bool CreateInitialObjects();
+
+  // These four Create*EntryStub functions are here because of a gcc-4.4  
bug
+  // that assigns wrong vtable entries.
+  static void CreateCEntryStub();
+  static void CreateCEntryDebugBreakStub();
+  static void CreateJSEntryStub();
+  static void CreateJSConstructEntryStub();
    static void CreateFixedStubs();
+
    static Object* CreateOddball(Map* map,
                                 const char* to_string,
                                 Object* to_number);

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to