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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2299 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
feng@chromium.org 2009-06-29 21:15:03 +00:00
parent f9dc709c72
commit 9f252dad52
2 changed files with 45 additions and 16 deletions

View File

@ -1257,28 +1257,49 @@ bool Heap::CreateApiObjects() {
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();
}

View File

@ -920,7 +920,15 @@ class Heap : public AllStatic {
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);