Fix static const weirdness in both gcc and msvs compatible way.

Afterpatch for r9985.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9986 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2011-11-14 11:36:04 +00:00
parent 007ad200f8
commit d771d09d23

View File

@ -205,13 +205,6 @@ MaybeObject* Object::GetPropertyWithReceiver(Object* receiver,
} }
// This may seem strange but the standard requires inline static const
// definition, and w/o these the code doesn't link when being built in debug
// mode using gcc.
const int JSObject::kGetterIndex;
const int JSObject::kSetterIndex;
MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver, MaybeObject* JSObject::GetPropertyWithCallback(Object* receiver,
Object* structure, Object* structure,
String* name) { String* name) {
@ -4638,7 +4631,11 @@ Object* JSObject::LookupAccessor(String* name, bool is_getter) {
} }
// Make the lookup and include prototypes. // Make the lookup and include prototypes.
int accessor_index = is_getter ? kGetterIndex : kSetterIndex; // Introducing constants below makes static constants usage purely static
// and avoids linker errors in debug build using gcc.
const int getter_index = kGetterIndex;
const int setter_index = kSetterIndex;
int accessor_index = is_getter ? getter_index : setter_index;
uint32_t index = 0; uint32_t index = 0;
if (name->AsArrayIndex(&index)) { if (name->AsArrayIndex(&index)) {
for (Object* obj = this; for (Object* obj = this;