diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-03-01 08:58:05 -0800 |
---|---|---|
committer | Ali Sheikh <ofrobots@lemonhope.roam.corp.google.com> | 2016-03-03 20:35:20 -0800 |
commit | 069e02ab47656b3efd1b6829c65856b2e1c2d1db (patch) | |
tree | eb643e0a2e88fd64bb9fc927423458d2ae96c2db /deps/v8/test/cctest/test-javascript-arm64.cc | |
parent | 8938355398c79f583a468284b768652d12ba9bc9 (diff) | |
download | android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.tar.gz android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.tar.bz2 android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.zip |
deps: upgrade to V8 4.9.385.18
Pick up the current branch head for V8 4.9
https://github.com/v8/v8/commit/1ecba0f
PR-URL: https://github.com/nodejs/node/pull/4722
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/test-javascript-arm64.cc')
-rw-r--r-- | deps/v8/test/cctest/test-javascript-arm64.cc | 122 |
1 files changed, 59 insertions, 63 deletions
diff --git a/deps/v8/test/cctest/test-javascript-arm64.cc b/deps/v8/test/cctest/test-javascript-arm64.cc index cbbbf3c22a..3f7d9d17c3 100644 --- a/deps/v8/test/cctest/test-javascript-arm64.cc +++ b/deps/v8/test/cctest/test-javascript-arm64.cc @@ -34,7 +34,7 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/isolate.h" -#include "src/parser.h" +#include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" @@ -43,7 +43,6 @@ using ::v8::Context; using ::v8::Extension; using ::v8::Function; using ::v8::FunctionTemplate; -using ::v8::Handle; using ::v8::HandleScope; using ::v8::Local; using ::v8::Message; @@ -59,21 +58,24 @@ using ::v8::Undefined; using ::v8::V8; using ::v8::Value; -static void ExpectBoolean(bool expected, Local<Value> result) { +static void ExpectBoolean(Local<Context> context, bool expected, + Local<Value> result) { CHECK(result->IsBoolean()); - CHECK_EQ(expected, result->BooleanValue()); + CHECK_EQ(expected, result->BooleanValue(context).FromJust()); } -static void ExpectInt32(int32_t expected, Local<Value> result) { +static void ExpectInt32(Local<Context> context, int32_t expected, + Local<Value> result) { CHECK(result->IsInt32()); - CHECK_EQ(expected, result->Int32Value()); + CHECK_EQ(expected, result->Int32Value(context).FromJust()); } -static void ExpectNumber(double expected, Local<Value> result) { +static void ExpectNumber(Local<Context> context, double expected, + Local<Value> result) { CHECK(result->IsNumber()); - CHECK_EQ(expected, result->NumberValue()); + CHECK_EQ(expected, result->NumberValue(context).FromJust()); } @@ -88,7 +90,7 @@ TEST(simple_value) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); Local<Value> result = CompileRun("0x271828;"); - ExpectInt32(0x271828, result); + ExpectInt32(env.local(), 0x271828, result); } @@ -96,7 +98,7 @@ TEST(global_variable) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); Local<Value> result = CompileRun("var my_global_var = 0x123; my_global_var;"); - ExpectInt32(0x123, result); + ExpectInt32(env.local(), 0x123, result); } @@ -106,7 +108,7 @@ TEST(simple_function_call) { Local<Value> result = CompileRun( "function foo() { return 0x314; }" "foo();"); - ExpectInt32(0x314, result); + ExpectInt32(env.local(), 0x314, result); } @@ -120,14 +122,12 @@ TEST(binary_op) { " return 2 * (a + b - 1);" "}" "foo();"); - ExpectInt32(0x2468, result); + ExpectInt32(env.local(), 0x2468, result); } -static void if_comparison_testcontext_helper( - char const * op, - char const * lhs, - char const * rhs, - int expect) { +static void if_comparison_testcontext_helper(Local<Context> context, + char const* op, char const* lhs, + char const* rhs, int expect) { char buffer[256]; snprintf(buffer, sizeof(buffer), "var lhs = %s;" @@ -136,14 +136,12 @@ static void if_comparison_testcontext_helper( "else { 0; }", lhs, rhs, op); Local<Value> result = CompileRun(buffer); - ExpectInt32(expect, result); + ExpectInt32(context, expect, result); } -static void if_comparison_effectcontext_helper( - char const * op, - char const * lhs, - char const * rhs, - int expect) { +static void if_comparison_effectcontext_helper(Local<Context> context, + char const* op, char const* lhs, + char const* rhs, int expect) { char buffer[256]; snprintf(buffer, sizeof(buffer), "var lhs = %s;" @@ -153,23 +151,21 @@ static void if_comparison_effectcontext_helper( "else { 0; }", lhs, rhs, op); Local<Value> result = CompileRun(buffer); - ExpectInt32(expect, result); + ExpectInt32(context, expect, result); } -static void if_comparison_helper( - char const * op, - int expect_when_lt, - int expect_when_eq, - int expect_when_gt) { +static void if_comparison_helper(Local<Context> context, char const* op, + int expect_when_lt, int expect_when_eq, + int expect_when_gt) { // TODO(all): Non-SMI tests. - if_comparison_testcontext_helper(op, "1", "3", expect_when_lt); - if_comparison_testcontext_helper(op, "5", "5", expect_when_eq); - if_comparison_testcontext_helper(op, "9", "7", expect_when_gt); + if_comparison_testcontext_helper(context, op, "1", "3", expect_when_lt); + if_comparison_testcontext_helper(context, op, "5", "5", expect_when_eq); + if_comparison_testcontext_helper(context, op, "9", "7", expect_when_gt); - if_comparison_effectcontext_helper(op, "1", "3", expect_when_lt); - if_comparison_effectcontext_helper(op, "5", "5", expect_when_eq); - if_comparison_effectcontext_helper(op, "9", "7", expect_when_gt); + if_comparison_effectcontext_helper(context, op, "1", "3", expect_when_lt); + if_comparison_effectcontext_helper(context, op, "5", "5", expect_when_eq); + if_comparison_effectcontext_helper(context, op, "9", "7", expect_when_gt); } @@ -177,14 +173,14 @@ TEST(if_comparison) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - if_comparison_helper("<", 1, 0, 0); - if_comparison_helper("<=", 1, 1, 0); - if_comparison_helper("==", 0, 1, 0); - if_comparison_helper("===", 0, 1, 0); - if_comparison_helper(">=", 0, 1, 1); - if_comparison_helper(">", 0, 0, 1); - if_comparison_helper("!=", 1, 0, 1); - if_comparison_helper("!==", 1, 0, 1); + if_comparison_helper(env.local(), "<", 1, 0, 0); + if_comparison_helper(env.local(), "<=", 1, 1, 0); + if_comparison_helper(env.local(), "==", 0, 1, 0); + if_comparison_helper(env.local(), "===", 0, 1, 0); + if_comparison_helper(env.local(), ">=", 0, 1, 1); + if_comparison_helper(env.local(), ">", 0, 0, 1); + if_comparison_helper(env.local(), "!=", 1, 0, 1); + if_comparison_helper(env.local(), "!==", 1, 0, 1); } @@ -194,19 +190,19 @@ TEST(unary_plus) { Local<Value> result; // SMI result = CompileRun("var a = 1234; +a"); - ExpectInt32(1234, result); + ExpectInt32(env.local(), 1234, result); // Number result = CompileRun("var a = 1234.5; +a"); - ExpectNumber(1234.5, result); + ExpectNumber(env.local(), 1234.5, result); // String (SMI) result = CompileRun("var a = '1234'; +a"); - ExpectInt32(1234, result); + ExpectInt32(env.local(), 1234, result); // String (Number) result = CompileRun("var a = '1234.5'; +a"); - ExpectNumber(1234.5, result); + ExpectNumber(env.local(), 1234.5, result); // Check side effects. result = CompileRun("var a = 1234; +(a = 4321); a"); - ExpectInt32(4321, result); + ExpectInt32(env.local(), 4321, result); } @@ -215,15 +211,15 @@ TEST(unary_minus) { v8::HandleScope scope(env->GetIsolate()); Local<Value> result; result = CompileRun("var a = 1234; -a"); - ExpectInt32(-1234, result); + ExpectInt32(env.local(), -1234, result); result = CompileRun("var a = 1234.5; -a"); - ExpectNumber(-1234.5, result); + ExpectNumber(env.local(), -1234.5, result); result = CompileRun("var a = 1234; -(a = 4321); a"); - ExpectInt32(4321, result); + ExpectInt32(env.local(), 4321, result); result = CompileRun("var a = '1234'; -a"); - ExpectInt32(-1234, result); + ExpectInt32(env.local(), -1234, result); result = CompileRun("var a = '1234.5'; -a"); - ExpectNumber(-1234.5, result); + ExpectNumber(env.local(), -1234.5, result); } @@ -234,7 +230,7 @@ TEST(unary_void) { result = CompileRun("var a = 1234; void (a);"); ExpectUndefined(result); result = CompileRun("var a = 0; void (a = 42); a"); - ExpectInt32(42, result); + ExpectInt32(env.local(), 42, result); result = CompileRun("var a = 0; void (a = 42);"); ExpectUndefined(result); } @@ -245,21 +241,21 @@ TEST(unary_not) { v8::HandleScope scope(env->GetIsolate()); Local<Value> result; result = CompileRun("var a = 1234; !a"); - ExpectBoolean(false, result); + ExpectBoolean(env.local(), false, result); result = CompileRun("var a = 0; !a"); - ExpectBoolean(true, result); + ExpectBoolean(env.local(), true, result); result = CompileRun("var a = 0; !(a = 1234); a"); - ExpectInt32(1234, result); + ExpectInt32(env.local(), 1234, result); result = CompileRun("var a = '1234'; !a"); - ExpectBoolean(false, result); + ExpectBoolean(env.local(), false, result); result = CompileRun("var a = ''; !a"); - ExpectBoolean(true, result); + ExpectBoolean(env.local(), true, result); result = CompileRun("var a = 1234; !!a"); - ExpectBoolean(true, result); + ExpectBoolean(env.local(), true, result); result = CompileRun("var a = 0; !!a"); - ExpectBoolean(false, result); + ExpectBoolean(env.local(), false, result); result = CompileRun("var a = 0; if ( !a ) { 1; } else { 0; }"); - ExpectInt32(1, result); + ExpectInt32(env.local(), 1, result); result = CompileRun("var a = 1; if ( !a ) { 1; } else { 0; }"); - ExpectInt32(0, result); + ExpectInt32(env.local(), 0, result); } |