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 |