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 2128233002: [Interpreter] Add ClassOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 7b3d0d16fec3125f111fc075361a639fbe21bfdf..7862461084ca8cafec9df87a1aac6b80ffdda550 100644
--- a/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -267,6 +267,27 @@ TEST(ValueOf) {
->SameValue(*helper.NewObject("'foobar'")));
}
+TEST(ClassOf) {
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+ Factory* factory = isolate->factory();
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
+ Runtime::kInlineClassOf);
+ CHECK_EQ(*helper.Invoke(helper.NewObject("123")), *factory->null_value());
+ CHECK_EQ(*helper.Invoke(helper.NewObject("'true'")), *factory->null_value());
+ CHECK_EQ(*helper.Invoke(helper.NewObject("'foo'")), *factory->null_value());
+ CHECK(helper.Invoke(helper.NewObject("({a:1})"))
+ ->SameValue(*helper.NewObject("'Object'")));
+ CHECK(helper.Invoke(helper.NewObject("(function foo() {})"))
+ ->SameValue(*helper.NewObject("'Function'")));
+ CHECK(helper.Invoke(helper.NewObject("new Date()"))
+ ->SameValue(*helper.NewObject("'Date'")));
+ CHECK(helper.Invoke(helper.NewObject("new Set"))
+ ->SameValue(*helper.NewObject("'Set'")));
+ CHECK(helper.Invoke(helper.NewObject("/x/"))
+ ->SameValue(*helper.NewObject("'RegExp'")));
+}
+
} // 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