From: yangguo Date: Fri, 16 Jan 2015 22:17:37 +0000 (-0800) Subject: Extend and fix tests for custom heap snapshot. X-Git-Tag: upstream/4.7.83~4930 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4a62c129bb572ad4525a36473501d484a6ea842;p=platform%2Fupstream%2Fv8.git Extend and fix tests for custom heap snapshot. R=vogelheim@chromium.org Review URL: https://codereview.chromium.org/856793002 Cr-Commit-Position: refs/heads/master@{#26110} --- diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index eb59779..1f7eb37 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 startup_name = Vector::New(file_name_length + 1); @@ -654,6 +656,17 @@ UNINITIALIZED_DEPENDENT_TEST(CustomContextDeSerialization, Handle global_object(context->global_object(), isolate); Handle property = JSObject::GetDataProperty(global_object, o); CHECK(property.is_identical_to(global_proxy)); + + v8::Handle 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 s = CompileRun("s")->ToString(v8_isolate); + CHECK(s->Equals(v8_str("12345"))); } } v8_isolate->Dispose(); diff --git a/test/mjsunit/debug-script.js b/test/mjsunit/debug-script.js index 07f0e3c..af1eb45 100644 --- a/test/mjsunit/debug-script.js +++ b/test/mjsunit/debug-script.js @@ -96,9 +96,9 @@ if (extension_gc_script) { } // Test a normal script. -var mjsunit_js_script = Debug.findScript(/mjsunit.js/); -assertTrue(/mjsunit.js/.test(mjsunit_js_script.name)); -assertEquals(Debug.ScriptType.Normal, mjsunit_js_script.type); +var debug_script = Debug.findScript(/debug-script.js/); +assertTrue(/debug-script.js/.test(debug_script.name)); +assertEquals(Debug.ScriptType.Normal, debug_script.type); // Check a nonexistent script. var dummy_script = Debug.findScript('dummy.js'); diff --git a/test/mjsunit/es6/iteration-syntax.js b/test/mjsunit/es6/iteration-syntax.js index 356a978..4be94c5 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.