Reviewers: ulan,

Description:
Loosen up code logging test that was sensitive to GC timing.

Please review this at https://chromiumcodereview.appspot.com/10918096/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     test/cctest/test-api.cc


Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc     (revision 12443)
+++ test/cctest/test-api.cc     (working copy)
@@ -11130,18 +11130,25 @@
         ++move_events;

         uint32_t hash = i::ComputePointerHash(event->code_start);
-        // We should never see code move that we haven't seen before.
+ // We would like to never see code move that we haven't seen before, + // but the code creation event does not happen until the line endings + // have been calculated (this is so that we can report the line in the
+        // script at which the function source is found, see
+        // Compiler::RecordFunctionCompilation) and the line endings
+ // calculations can cause a GC, which can move the newly created code
+        // before its existence can be logged.
         i::HashMap::Entry* entry =
             code_map->Lookup(event->code_start, hash, false);
-        CHECK(entry != NULL);
-        CHECK_EQ(reinterpret_cast<void*>(event->code_len), entry->value);
-        code_map->Remove(event->code_start, hash);
+        if (entry != NULL) {
+          CHECK_EQ(reinterpret_cast<void*>(event->code_len), entry->value);
+          code_map->Remove(event->code_start, hash);

-        entry = code_map->Lookup(event->new_code_start,
- i::ComputePointerHash(event->new_code_start),
-                                 true);
-        CHECK(entry != NULL);
-        entry->value = reinterpret_cast<void*>(event->code_len);
+          entry = code_map->Lookup(event->new_code_start,
+ i::ComputePointerHash(event->new_code_start),
+                                   true);
+          CHECK(entry != NULL);
+          entry->value = reinterpret_cast<void*>(event->code_len);
+        }
       }
       break;



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

Reply via email to