Fix static const weirdness in both gcc and msvs compatible way.
authormikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Nov 2011 11:36:04 +0000 (11:36 +0000)
committermikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Nov 2011 11:36:04 +0000 (11:36 +0000)
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

src/objects.cc

index 88efc3c181d34eea15eed03fb9b964f8211a0585..0a3508dcccabf243d24dd5789a784cf73abeb544 100644 (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,
                                                Object* structure,
                                                String* name) {
@@ -4638,7 +4631,11 @@ Object* JSObject::LookupAccessor(String* name, bool is_getter) {
   }
 
   // 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;
   if (name->AsArrayIndex(&index)) {
     for (Object* obj = this;