Index: test/cctest/test-javascript-arm64.cc |
diff --git a/test/cctest/test-javascript-arm64.cc b/test/cctest/test-javascript-arm64.cc |
index cbbbf3c22ac1ecf6de4a3bd6c7d195aec7d122ae..4c1908d5dc66df729616cad3fad178426d1a3903 100644 |
--- a/test/cctest/test-javascript-arm64.cc |
+++ b/test/cctest/test-javascript-arm64.cc |
@@ -25,6 +25,9 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// TODO(jochen): Remove this after the setting is turned on globally. |
+#define V8_IMMINENT_DEPRECATION_WARNINGS |
+ |
#include <limits.h> |
#include "src/v8.h" |
@@ -43,7 +46,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 +61,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 +93,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 +101,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 +111,7 @@ TEST(simple_function_call) { |
Local<Value> result = CompileRun( |
"function foo() { return 0x314; }" |
"foo();"); |
- ExpectInt32(0x314, result); |
+ ExpectInt32(env.local(), 0x314, result); |
} |
@@ -120,14 +125,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 +139,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 +154,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 +176,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 +193,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 +214,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 +233,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 +244,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); |
} |