Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1491)

Unified Diff: test/cctest/interpreter/test-interpreter-intrinsics.cc

Issue 2019433003: [Interpreter] Add intrinsic for Runtime::kInlineCall. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-interpreter-intrinsics.cc
diff --git a/test/cctest/interpreter/test-interpreter-intrinsics.cc b/test/cctest/interpreter/test-interpreter-intrinsics.cc
index e4cf809ad74efbcf852d2d840f7bd09151cacfa9..cfbfc462c8187b8b4511bae48619724f0ae840f2 100644
--- a/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -29,7 +29,7 @@ class InvokeIntrinsicHelper {
builder.CallRuntime(function_id_, builder.Parameter(0), sizeof...(args))
.Return();
InterpreterTester tester(isolate_, builder.ToBytecodeArray());
- auto callable = tester.GetCallable<Handle<Object>>();
+ auto callable = tester.GetCallable<A...>();
return callable(args...).ToHandleChecked();
}
@@ -91,6 +91,28 @@ TEST(IsArray) {
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42")));
}
+TEST(Call) {
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+ Factory* factory = isolate->factory();
+ InvokeIntrinsicHelper helper(isolate, handles.main_zone(),
+ Runtime::kInlineCall);
+
+ CHECK_EQ(Smi::FromInt(20),
+ *helper.Invoke(helper.NewObject("(function() { return this.x; })"),
+ helper.NewObject("({ x: 20 })")));
+ CHECK_EQ(Smi::FromInt(50),
+ *helper.Invoke(helper.NewObject("(function(arg1) { return arg1; })"),
+ factory->undefined_value(),
+ handle(Smi::FromInt(50), isolate)));
+ CHECK_EQ(
+ Smi::FromInt(20),
+ *helper.Invoke(
+ helper.NewObject("(function(a, b, c) { return a + b + c; })"),
+ factory->undefined_value(), handle(Smi::FromInt(10), isolate),
+ handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate)));
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698