Revision: 12903
Author:   [email protected]
Date:     Thu Nov  8 06:40:55 2012
Log: Reshuffle an if() condition to not depend on an uninitialized value.

Node::class_id_ contains garbage for newly allocated (FREE) nodes. This patch
changes the code to first test the node state_, then (for non-FREE nodes),
class_id_, and not the other way around.

This does not affect the branch taken (i.e. the current code is correct),
but makes Valgrind and MSan happy.

Review URL: https://codereview.chromium.org/11362158
Patch from Evgeniy Stepanov <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12903

Modified:
 /branches/bleeding_edge/src/global-handles.cc

=======================================
--- /branches/bleeding_edge/src/global-handles.cc       Tue Nov  6 09:32:15 2012
+++ /branches/bleeding_edge/src/global-handles.cc       Thu Nov  8 06:40:55 2012
@@ -633,7 +633,7 @@

 void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) {
   for (NodeIterator it(this); !it.done(); it.Advance()) {
-    if (it.node()->has_wrapper_class_id() && it.node()->IsRetainer()) {
+    if (it.node()->IsRetainer() && it.node()->has_wrapper_class_id()) {
       v->VisitEmbedderReference(it.node()->location(),
                                 it.node()->wrapper_class_id());
     }

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

Reply via email to