[V8] Update expected results of V8's cctests
authorPeter Varga <pvarga@inf.u-szeged.hu>
Fri, 18 May 2012 14:06:54 +0000 (16:06 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 21 May 2012 07:04:51 +0000 (09:04 +0200)
Expected results need to be updated for snapshot build due to the change
in src/bootstrapper.cc performed by "[V8] Introduce a QML compilation
mode" patch.

Change-Id: Ie067b53dde6c885a25ee434a82816439f2a75bfd
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/3rdparty/v8/test/cctest/test-api.cc
src/3rdparty/v8/test/cctest/test-heap-profiler.cc
src/3rdparty/v8/test/cctest/test-heap.cc

index b1a23c1..c013150 100644 (file)
@@ -14319,6 +14319,7 @@ TEST(Regress528) {
   v8::Persistent<Context> context;
   v8::Persistent<Context> other_context;
   int gc_count;
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
 
   // Create a context used to keep the code from aging in the compilation
   // cache.
@@ -14343,10 +14344,10 @@ TEST(Regress528) {
     CompileRun(source_simple);
     other_context->Exit();
     HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
-    if (GetGlobalObjectsCount() == 1) break;
+    if (GetGlobalObjectsCount() == (snapshot_enabled ? 2 : 1)) break;
   }
   CHECK_GE(2, gc_count);
-  CHECK_EQ(1, GetGlobalObjectsCount());
+  CHECK_EQ((snapshot_enabled ? 2 : 1), GetGlobalObjectsCount());
 
   // Eval in a function creates reference from the compilation cache to the
   // global object.
@@ -14365,10 +14366,10 @@ TEST(Regress528) {
     CompileRun(source_eval);
     other_context->Exit();
     HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
-    if (GetGlobalObjectsCount() == 1) break;
+    if (GetGlobalObjectsCount() == (snapshot_enabled ? 2 : 1)) break;
   }
   CHECK_GE(2, gc_count);
-  CHECK_EQ(1, GetGlobalObjectsCount());
+  CHECK_EQ((snapshot_enabled ? 2 : 1), GetGlobalObjectsCount());
 
   // Looking up the line number for an exception creates reference from the
   // compilation cache to the global object.
@@ -14392,10 +14393,10 @@ TEST(Regress528) {
     CompileRun(source_exception);
     other_context->Exit();
     HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
-    if (GetGlobalObjectsCount() == 1) break;
+    if (GetGlobalObjectsCount() == (snapshot_enabled ? 2 : 1)) break;
   }
   CHECK_GE(2, gc_count);
-  CHECK_EQ(1, GetGlobalObjectsCount());
+  CHECK_EQ((snapshot_enabled ? 2 : 1), GetGlobalObjectsCount());
 
   other_context.Dispose();
 }
index 3f5e07d..b6fc486 100644 (file)
@@ -54,9 +54,11 @@ class NamedEntriesDetector {
 
 static const v8::HeapGraphNode* GetGlobalObject(
     const v8::HeapSnapshot* snapshot) {
-  CHECK_EQ(2, snapshot->GetRoot()->GetChildrenCount());
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
+
+  CHECK_EQ((snapshot_enabled ? 3 : 2), snapshot->GetRoot()->GetChildrenCount());
   const v8::HeapGraphNode* global_obj =
-      snapshot->GetRoot()->GetChild(0)->GetToNode();
+      snapshot->GetRoot()->GetChild(snapshot_enabled ? 1 : 0)->GetToNode();
   CHECK_EQ(0, strncmp("Object", const_cast<i::HeapEntry*>(
       reinterpret_cast<const i::HeapEntry*>(global_obj))->name(), 6));
   return global_obj;
@@ -653,14 +655,26 @@ TEST(HeapSnapshotJSONSerialization) {
       "  return null;\n"
       "}\n");
   // Get the string index using the path: <root> -> <global>.b.x.s
-  v8::Local<v8::Value> string_obj_pos_val = CompileRun(
-      "GetChildPosByProperty(\n"
-      "  GetChildPosByProperty(\n"
-      "    GetChildPosByProperty("
-      "      parsed.nodes[1 + children_offset + child_to_node_offset],"
-      "      \"b\",shortcut_type),\n"
-      "    \"x\", property_type),"
-      "  \"s\", property_type)");
+  v8::Local<v8::Value> string_obj_pos_val;
+  if (i::Snapshot::IsEnabled()) {
+      string_obj_pos_val = CompileRun(
+          "GetChildPosByProperty(\n"
+          "  GetChildPosByProperty(\n"
+          "    GetChildPosByProperty("
+          "      parsed.nodes[1 + children_offset + child_to_node_offset + child_fields_count],"
+          "      \"b\",shortcut_type),\n"
+          "    \"x\", property_type),"
+          "  \"s\", property_type)");
+  } else {
+      string_obj_pos_val = CompileRun(
+          "GetChildPosByProperty(\n"
+          "  GetChildPosByProperty(\n"
+          "    GetChildPosByProperty("
+          "      parsed.nodes[1 + children_offset + child_to_node_offset],"
+          "      \"b\",shortcut_type),\n"
+          "    \"x\", property_type),"
+          "  \"s\", property_type)");
+  }
   CHECK(!string_obj_pos_val.IsEmpty());
   int string_obj_pos =
       static_cast<int>(string_obj_pos_val->ToNumber()->Value());
index f75dc30..2904e66 100644 (file)
@@ -9,6 +9,7 @@
 #include "macro-assembler.h"
 #include "global-handles.h"
 #include "cctest.h"
+#include "snapshot.h"
 
 using namespace v8::internal;
 
@@ -1343,13 +1344,14 @@ static int NumberOfGlobalObjects() {
 // optimized code.
 TEST(LeakGlobalContextViaMap) {
   i::FLAG_allow_natives_syntax = true;
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
   v8::HandleScope outer_scope;
   v8::Persistent<v8::Context> ctx1 = v8::Context::New();
   v8::Persistent<v8::Context> ctx2 = v8::Context::New();
   ctx1->Enter();
 
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(4, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects());
 
   {
     v8::HandleScope inner_scope;
@@ -1369,7 +1371,7 @@ TEST(LeakGlobalContextViaMap) {
     ctx1.Dispose();
   }
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(2, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects());
   ctx2.Dispose();
   HEAP->CollectAllAvailableGarbage();
   CHECK_EQ(0, NumberOfGlobalObjects());
@@ -1380,13 +1382,14 @@ TEST(LeakGlobalContextViaMap) {
 // optimized code.
 TEST(LeakGlobalContextViaFunction) {
   i::FLAG_allow_natives_syntax = true;
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
   v8::HandleScope outer_scope;
   v8::Persistent<v8::Context> ctx1 = v8::Context::New();
   v8::Persistent<v8::Context> ctx2 = v8::Context::New();
   ctx1->Enter();
 
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(4, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects());
 
   {
     v8::HandleScope inner_scope;
@@ -1406,7 +1409,7 @@ TEST(LeakGlobalContextViaFunction) {
     ctx1.Dispose();
   }
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(2, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects());
   ctx2.Dispose();
   HEAP->CollectAllAvailableGarbage();
   CHECK_EQ(0, NumberOfGlobalObjects());
@@ -1415,13 +1418,14 @@ TEST(LeakGlobalContextViaFunction) {
 
 TEST(LeakGlobalContextViaMapKeyed) {
   i::FLAG_allow_natives_syntax = true;
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
   v8::HandleScope outer_scope;
   v8::Persistent<v8::Context> ctx1 = v8::Context::New();
   v8::Persistent<v8::Context> ctx2 = v8::Context::New();
   ctx1->Enter();
 
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(4, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects());
 
   {
     v8::HandleScope inner_scope;
@@ -1441,7 +1445,7 @@ TEST(LeakGlobalContextViaMapKeyed) {
     ctx1.Dispose();
   }
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(2, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects());
   ctx2.Dispose();
   HEAP->CollectAllAvailableGarbage();
   CHECK_EQ(0, NumberOfGlobalObjects());
@@ -1450,13 +1454,14 @@ TEST(LeakGlobalContextViaMapKeyed) {
 
 TEST(LeakGlobalContextViaMapProto) {
   i::FLAG_allow_natives_syntax = true;
+  bool snapshot_enabled = i::Snapshot::IsEnabled();
   v8::HandleScope outer_scope;
   v8::Persistent<v8::Context> ctx1 = v8::Context::New();
   v8::Persistent<v8::Context> ctx2 = v8::Context::New();
   ctx1->Enter();
 
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(4, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects());
 
   {
     v8::HandleScope inner_scope;
@@ -1480,7 +1485,7 @@ TEST(LeakGlobalContextViaMapProto) {
     ctx1.Dispose();
   }
   HEAP->CollectAllAvailableGarbage();
-  CHECK_EQ(2, NumberOfGlobalObjects());
+  CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects());
   ctx2.Dispose();
   HEAP->CollectAllAvailableGarbage();
   CHECK_EQ(0, NumberOfGlobalObjects());