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

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

Issue 2051573002: [Interpreter] Add intrinsics called as stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix leak Created 4 years, 6 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 | « src/interpreter/interpreter-intrinsics.cc ('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 b9dffcc70a92891754d58fec08c5ed559bff8651..02424517d95799a153c9a9e5f68b42f752a618dc 100644
--- a/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -212,6 +212,47 @@ TEST(Call) {
handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate)));
}
+TEST(IntrinsicAsStubCall) {
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+ Factory* factory = isolate->factory();
+ InvokeIntrinsicHelper to_number_helper(isolate, handles.main_zone(),
+ Runtime::kInlineToNumber);
+ CHECK_EQ(Smi::FromInt(46),
+ *to_number_helper.Invoke(to_number_helper.NewObject("'46'")));
+
+ InvokeIntrinsicHelper to_integer_helper(isolate, handles.main_zone(),
+ Runtime::kInlineToInteger);
+ CHECK_EQ(Smi::FromInt(502),
+ *to_integer_helper.Invoke(to_integer_helper.NewObject("502.67")));
+
+ InvokeIntrinsicHelper math_pow_helper(isolate, handles.main_zone(),
+ Runtime::kInlineMathPow);
+ CHECK(math_pow_helper
+ .Invoke(math_pow_helper.NewObject("3"),
+ math_pow_helper.NewObject("7"))
+ ->SameValue(Smi::FromInt(2187)));
+
+ InvokeIntrinsicHelper has_property_helper(isolate, handles.main_zone(),
+ Runtime::kInlineHasProperty);
+ CHECK_EQ(*factory->true_value(),
+ *has_property_helper.Invoke(
+ has_property_helper.NewObject("'x'"),
+ has_property_helper.NewObject("({ x: 20 })")));
+ CHECK_EQ(*factory->false_value(),
+ *has_property_helper.Invoke(
+ has_property_helper.NewObject("'y'"),
+ has_property_helper.NewObject("({ x: 20 })")));
+
+ InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(),
+ Runtime::kInlineSubString);
+ CHECK(sub_string_helper
+ .Invoke(sub_string_helper.NewObject("'foobar'"),
+ sub_string_helper.NewObject("3"),
+ sub_string_helper.NewObject("6"))
+ ->SameValue(*sub_string_helper.NewObject("'bar'")));
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/interpreter-intrinsics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698