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

Unified Diff: test/cctest/test-code-stub-assembler.cc

Issue 2571883002: [stubs] Add CSA::IsSymbol() and CSA::IsPrivateSymbol(). (Closed)
Patch Set: refactor Created 4 years 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/code-stub-assembler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-code-stub-assembler.cc
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
index 8fb709eff8ae627e83475af7f2bb3814df96498d..ea44b2f5f5abac53c97384370dd9880b0387f92b 100644
--- a/test/cctest/test-code-stub-assembler.cc
+++ b/test/cctest/test-code-stub-assembler.cc
@@ -2103,5 +2103,52 @@ TEST(AllocatePromiseReactionJobInfo) {
CHECK(promise_info->debug_name()->IsUndefined(isolate));
}
+TEST(IsSymbol) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 1;
+ CodeAssemblerTester data(isolate, kNumParams);
+ CodeStubAssembler m(data.state());
+
+ Node* const symbol = m.Parameter(0);
+ m.Return(m.SelectBooleanConstant(m.IsSymbol(symbol)));
+
+ Handle<Code> code = data.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ Handle<Object> result =
+ ft.Call(isolate->factory()->NewSymbol()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->true_value(), *result);
+
+ result = ft.Call(isolate->factory()->empty_string()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->false_value(), *result);
+}
+
+TEST(IsPrivateSymbol) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 1;
+ CodeAssemblerTester data(isolate, kNumParams);
+ CodeStubAssembler m(data.state());
+
+ Node* const symbol = m.Parameter(0);
+ m.Return(m.SelectBooleanConstant(m.IsPrivateSymbol(symbol)));
+
+ Handle<Code> code = data.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ Handle<Object> result =
+ ft.Call(isolate->factory()->NewSymbol()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->false_value(), *result);
+
+ result = ft.Call(isolate->factory()->empty_string()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->false_value(), *result);
+
+ result = ft.Call(isolate->factory()->NewPrivateSymbol()).ToHandleChecked();
+ CHECK_EQ(isolate->heap()->true_value(), *result);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/code-stub-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698