Revision: 9986
Author:   [email protected]
Date:     Mon Nov 14 03:36:04 2011
Log:      Fix static const weirdness in both gcc and msvs compatible way.

Afterpatch for r9985.

Review URL: http://codereview.chromium.org/8565005
http://code.google.com/p/v8/source/detail?r=9986

Modified:
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Nov 14 03:13:29 2011
+++ /branches/bleeding_edge/src/objects.cc      Mon Nov 14 03:36:04 2011
@@ -203,13 +203,6 @@
   ASSERT(*attributes <= ABSENT);
   return value;
 }
-
-
-// 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,
@@ -4638,7 +4631,11 @@
   }

   // 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;

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

Reply via email to