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

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

Issue 2097473002: [Interpreter] Add ValueOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 02424517d95799a153c9a9e5f68b42f752a618dc..b8fce7a1d400cf51f829cd67032b5b3740f4b17d 100644
--- a/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -253,6 +253,27 @@ TEST(IntrinsicAsStubCall) {
->SameValue(*sub_string_helper.NewObject("'bar'")));
}
+TEST(ValueOf) {
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+ Factory* factory = isolate->factory();
+ InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
+ Runtime::kInlineValueOf);
+
+ CHECK_EQ(Smi::FromInt(1234), *helper.Invoke(helper.NewObject("1234")));
+ CHECK_EQ(Smi::FromInt(5678),
+ *helper.Invoke(helper.NewObject("new Object(5678)")));
+
+ CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true")));
+ CHECK_EQ(*factory->false_value(),
+ *helper.Invoke(helper.NewObject("new Object(false)")));
+
+ CHECK(helper.Invoke(helper.NewObject("'foobar'"))
+ ->SameValue(*helper.NewObject("'foobar'")));
+ CHECK(helper.Invoke(helper.NewObject("new Object('foobar')"))
+ ->SameValue(*helper.NewObject("'foobar'")));
+}
+
} // 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