Reviewers: vogelheim,

Description:
Extend and fix tests for custom heap snapshot.

[email protected]

Please review this at https://codereview.chromium.org/856793002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+48, -25 lines):
  M test/cctest/test-serialize.cc
  M test/mjsunit/debug-script.js
  M test/mjsunit/es6/iteration-syntax.js


Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index eb5977901b56e49689ecd02515370bb765d62bab..1f7eb37fda1775c4d1f97ec81df486cfa5c2d08d 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -563,11 +563,12 @@ UNINITIALIZED_TEST(CustomContextSerialization) {
         CompileRun(
             "var e;"
             "(function() {"
-            "  e = function(s) { eval (s); }"
+            "  e = function(s) { return eval (s); }"
             "})();"
             "var o = this;"
-            "var r = Math.random();"
-            "var f = (function(a, b) {}).bind(1, 2, 3);");
+            "var r = Math.random() + Math.cos(0);"
+            "var f = (function(a, b) { return a + b; }).bind(1, 2, 3);"
+            "var s = parseInt('12345');");
       }
       // Make sure all builtin scripts are cached.
       {
@@ -616,8 +617,9 @@ UNINITIALIZED_TEST(CustomContextSerialization) {
 }


-UNINITIALIZED_DEPENDENT_TEST(CustomContextDeSerialization,
+UNINITIALIZED_DEPENDENT_TEST(CustomContextDeserialization,
                              CustomContextSerialization) {
+  FLAG_crankshaft = false;
   if (!Snapshot::HaveASnapshotToStartFrom()) {
     int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
     Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
@@ -654,6 +656,17 @@ UNINITIALIZED_DEPENDENT_TEST(CustomContextDeSerialization,
         Handle<JSObject> global_object(context->global_object(), isolate);
Handle<Object> property = JSObject::GetDataProperty(global_object, o);
         CHECK(property.is_identical_to(global_proxy));
+
+        v8::Handle<v8::Context> v8_context = v8::Utils::ToLocal(context);
+        v8::Context::Scope context_scope(v8_context);
+        double r = CompileRun("r")->ToNumber(v8_isolate)->Value();
+        CHECK(r >= 1 && r <= 2);
+        int f = CompileRun("f()")->ToNumber(v8_isolate)->Int32Value();
+        CHECK_EQ(5, f);
+        f = CompileRun("e('f()')")->ToNumber(v8_isolate)->Int32Value();
+        CHECK_EQ(5, f);
+        v8::Handle<v8::String> s = CompileRun("s")->ToString(v8_isolate);
+        CHECK(s->Equals(v8_str("12345")));
       }
     }
     v8_isolate->Dispose();
Index: test/mjsunit/debug-script.js
diff --git a/test/mjsunit/debug-script.js b/test/mjsunit/debug-script.js
index 07f0e3c45928593d799626543d501613bd61dd8b..cdb06b878f0632dc12a8e3a402343133152e634a 100644
--- a/test/mjsunit/debug-script.js
+++ b/test/mjsunit/debug-script.js
@@ -96,8 +96,8 @@ if (extension_gc_script) {
 }

 // Test a normal script.
-var mjsunit_js_script = Debug.findScript(/mjsunit.js/);
-assertTrue(/mjsunit.js/.test(mjsunit_js_script.name));
+var mjsunit_js_script = Debug.findScript(/debug-script.js/);
+assertTrue(/debug-script.js/.test(mjsunit_js_script.name));
 assertEquals(Debug.ScriptType.Normal, mjsunit_js_script.type);

 // Check a nonexistent script.
Index: test/mjsunit/es6/iteration-syntax.js
diff --git a/test/mjsunit/es6/iteration-syntax.js b/test/mjsunit/es6/iteration-syntax.js index 356a97898a363b1eb750110ef96eac7d3f2290de..4be94c5db4670e89ac4aadab573b55298043eb25 100644
--- a/test/mjsunit/es6/iteration-syntax.js
+++ b/test/mjsunit/es6/iteration-syntax.js
@@ -25,7 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Flags: --harmony-scoping --use-strict
+// Flags: --harmony-scoping

 // Test for-of syntax.

@@ -35,28 +35,38 @@ function f() { for (x of y) { } }
 function f() { for (var x of y) { } }
 function f() { for (let x of y) { } }

-assertThrows("function f() { for (x of) { } }", SyntaxError);
-assertThrows("function f() { for (x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (x of y;) { } }", SyntaxError);
+function StrictSyntaxError(s) {
+  try {
+    eval(s);
+  } catch (e) {
+    assertInstanceof(e, SyntaxError);
+    return;
+  }
+  throw "did not throw";
+}

-assertThrows("function f() { for (var x of) { } }", SyntaxError);
-assertThrows("function f() { for (var x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (var x of y;) { } }", SyntaxError);
+StrictSyntaxError("function f() { for (x of) { } }");
+StrictSyntaxError("function f() { for (x of y z) { } }");
+StrictSyntaxError("function f() { for (x of y;) { } }");

-assertThrows("function f() { for (let x of) { } }", SyntaxError);
-assertThrows("function f() { for (let x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (let x of y;) { } }", SyntaxError);
+StrictSyntaxError("function f() { for (var x of) { } }");
+StrictSyntaxError("function f() { for (var x of y z) { } }");
+StrictSyntaxError("function f() { for (var x of y;) { } }");

-assertThrows("function f() { for (of y) { } }", SyntaxError);
-assertThrows("function f() { for (of of) { } }", SyntaxError);
-assertThrows("function f() { for (var of y) { } }", SyntaxError);
-assertThrows("function f() { for (var of of) { } }", SyntaxError);
-assertThrows("function f() { for (let of y) { } }", SyntaxError);
-assertThrows("function f() { for (let of of) { } }", SyntaxError);
+StrictSyntaxError("function f() { for (let x of) { } }");
+StrictSyntaxError("function f() { for (let x of y z) { } }");
+StrictSyntaxError("function f() { for (let x of y;) { } }");

-assertThrows("function f() { for (x = 3 of y) { } }", SyntaxError);
-assertThrows("function f() { for (var x = 3 of y) { } }", SyntaxError);
-assertThrows("function f() { for (let x = 3 of y) { } }", SyntaxError);
+StrictSyntaxError("function f() { for (of y) { } }");
+StrictSyntaxError("function f() { for (of of) { } }");
+StrictSyntaxError("function f() { for (var of y) { } }");
+StrictSyntaxError("function f() { for (var of of) { } }");
+StrictSyntaxError("function f() { for (let of y) { } }");
+StrictSyntaxError("function f() { for (let of of) { } }");
+
+StrictSyntaxError("function f() { for (x = 3 of y) { } }");
+StrictSyntaxError("function f() { for (var x = 3 of y) { } }");
+StrictSyntaxError("function f() { for (let x = 3 of y) { } }");


 // Alack, this appears to be valid.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to