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

Unified Diff: runtime/vm/assembler_dbc_test.cc

Issue 2104093003: DBC: Implement OneByteStringFromCharCode and StringToCharCode. (Closed) Base URL: git@github.com:dart-lang/sdk.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 | « no previous file | runtime/vm/constants_dbc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_dbc_test.cc
diff --git a/runtime/vm/assembler_dbc_test.cc b/runtime/vm/assembler_dbc_test.cc
index 9e4e2cdab4300fe276a5d6504b3ff0b804be6fec..e97fdd70d0e231be917771a2896193825c67129e 100644
--- a/runtime/vm/assembler_dbc_test.cc
+++ b/runtime/vm/assembler_dbc_test.cc
@@ -147,6 +147,55 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
}
+// - OneByteStringFromCharCode rA, rX
+//
+// Load the one-character symbol with the char code given by the Smi
+// in FP[rX] into FP[rA].
+ASSEMBLER_TEST_GENERATE(OneByteStringFromCharCode, assembler) {
+ __ Frame(2);
+ __ LoadConstant(0, Smi::ZoneHandle(Smi::New(65)));
+ __ OneByteStringFromCharCode(1, 0);
+ __ Return(1);
+}
+
+
+ASSEMBLER_TEST_RUN(OneByteStringFromCharCode, test) {
+ EXPECT_EQ(Symbols::New(Thread::Current(), "A"),
+ EXECUTE_TEST_CODE_OBJECT(test->code()).raw());
+}
+
+
+// - StringToCharCode rA, rX
+//
+// Load and smi-encode the single char code of the string in FP[rX] into
+// FP[rA]. If the string's length is not 1, load smi -1 instead.
+//
+ASSEMBLER_TEST_GENERATE(StringToCharCode, assembler) {
+ __ Frame(2);
+ __ LoadConstant(0, String::ZoneHandle(String::New("A", Heap::kOld)));
+ __ StringToCharCode(1, 0);
+ __ Return(1);
+}
+
+
+ASSEMBLER_TEST_RUN(StringToCharCode, test) {
+ EXPECT_EQ(65, EXECUTE_TEST_CODE_INTPTR(test->code()));
+}
+
+
+ASSEMBLER_TEST_GENERATE(StringToCharCodeIllegalLength, assembler) {
+ __ Frame(2);
+ __ LoadConstant(0, String::ZoneHandle(String::New("AAA", Heap::kOld)));
+ __ StringToCharCode(1, 0);
+ __ Return(1);
+}
+
+
+ASSEMBLER_TEST_RUN(StringToCharCodeIllegalLength, test) {
+ EXPECT_EQ(-1, EXECUTE_TEST_CODE_INTPTR(test->code()));
+}
+
+
// - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS;
// GreaterThanTOS;
//
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698