Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/test/cctest/compiler/function-tester.h b/test/cctest/compiler/function-tester.h
index 555e049..c7304f1 100644
--- a/test/cctest/compiler/function-tester.h
+++ b/test/cctest/compiler/function-tester.h
@@ -42,16 +42,18 @@
CompileGraph(graph);
}
- FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code)
+ FunctionTester(Handle<Code> code, int param_count)
: isolate(main_isolate()),
- function(
- (FLAG_allow_natives_syntax = true,
- NewFunction(BuildFunctionFromDescriptor(descriptor).c_str()))),
+ function((FLAG_allow_natives_syntax = true,
+ NewFunction(BuildFunction(param_count).c_str()))),
flags_(0) {
Compile(function);
function->ReplaceCode(*code);
}
+ FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code)
+ : FunctionTester(code, descriptor.GetParameterCount()) {}
+
Isolate* isolate;
Handle<JSFunction> function;
@@ -59,11 +61,22 @@
return Execution::Call(isolate, function, undefined(), 0, nullptr);
}
+ MaybeHandle<Object> Call(Handle<Object> a) {
+ Handle<Object> args[] = {a};
+ return Execution::Call(isolate, function, undefined(), 1, args);
+ }
+
MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) {
Handle<Object> args[] = {a, b};
return Execution::Call(isolate, function, undefined(), 2, args);
}
+ MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b,
+ Handle<Object> c) {
+ Handle<Object> args[] = {a, b, c};
+ return Execution::Call(isolate, function, undefined(), 3, args);
+ }
+
MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c,
Handle<Object> d) {
Handle<Object> args[] = {a, b, c, d};
@@ -91,41 +104,56 @@
return try_catch.Message();
}
- void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) {
- Handle<Object> result = Call(a, b).ToHandleChecked();
+ void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b,
+ Handle<Object> c, Handle<Object> d) {
+ Handle<Object> result = Call(a, b, c, d).ToHandleChecked();
CHECK(expected->SameValue(*result));
}
+ void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b,
+ Handle<Object> c) {
+ return CheckCall(expected, a, b, c, undefined());
+ }
+
+ void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) {
+ return CheckCall(expected, a, b, undefined());
+ }
+
void CheckCall(Handle<Object> expected, Handle<Object> a) {
CheckCall(expected, a, undefined());
}
- void CheckCall(Handle<Object> expected) {
- CheckCall(expected, undefined(), undefined());
- }
+ void CheckCall(Handle<Object> expected) { CheckCall(expected, undefined()); }
void CheckCall(double expected, double a, double b) {
CheckCall(Val(expected), Val(a), Val(b));
}
+ void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a); }
+
void CheckTrue(Handle<Object> a, Handle<Object> b) {
CheckCall(true_value(), a, b);
}
- void CheckTrue(Handle<Object> a) { CheckCall(true_value(), a, undefined()); }
+ void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c) {
+ CheckCall(true_value(), a, b, c);
+ }
+
+ void CheckTrue(Handle<Object> a, Handle<Object> b, Handle<Object> c,
+ Handle<Object> d) {
+ CheckCall(true_value(), a, b, c, d);
+ }
void CheckTrue(double a, double b) {
CheckCall(true_value(), Val(a), Val(b));
}
+ void CheckFalse(Handle<Object> a) { CheckCall(false_value(), a); }
+
void CheckFalse(Handle<Object> a, Handle<Object> b) {
CheckCall(false_value(), a, b);
}
- void CheckFalse(Handle<Object> a) {
- CheckCall(false_value(), a, undefined());
- }
-
void CheckFalse(double a, double b) {
CheckCall(false_value(), Val(a), Val(b));
}
@@ -194,6 +222,7 @@
CHECK(Compiler::Analyze(info.parse_info()));
CHECK(Compiler::EnsureDeoptimizationSupport(&info));
}
+ JSFunction::EnsureLiterals(function);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info);
CHECK(!code.is_null());
@@ -216,11 +245,6 @@
return function_string;
}
- std::string BuildFunctionFromDescriptor(
- const CallInterfaceDescriptor& descriptor) {
- return BuildFunction(descriptor.GetParameterCount());
- }
-
// Compile the given machine graph instead of the source of the function
// and replace the JSFunction's code with the result.
Handle<JSFunction> CompileGraph(Graph* graph) {