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

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1431803004: [Interpreter] Fix U16() calls in test-bytecode-generator for big endian. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(rmcilroy): Remove this define after this flag is turned on globally 5 // TODO(rmcilroy): Remove this define after this flag is turned on globally
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 {"var a;" 764 {"var a;"
765 REPEAT_256(SPACE, " a = 1.414;") 765 REPEAT_256(SPACE, " a = 1.414;")
766 " a = 3.14;", 766 " a = 3.14;",
767 1 * kPointerSize, 767 1 * kPointerSize,
768 1, 768 1,
769 1031, 769 1031,
770 { 770 {
771 REPEAT_256(COMMA, // 771 REPEAT_256(COMMA, //
772 B(LdaConstant), U8(wide_idx++), // 772 B(LdaConstant), U8(wide_idx++), //
773 B(Star), R(0)), // 773 B(Star), R(0)), //
774 B(LdaConstantWide), U16(wide_idx++), // 774 B(LdaConstantWide), U16(wide_idx), //
775 B(Star), R(0), // 775 B(Star), R(0), //
776 B(LdaUndefined), // 776 B(LdaUndefined), //
777 B(Return), // 777 B(Return), //
778 }, 778 },
779 257, 779 257,
780 {REPEAT_256(COMMA, 1.414), 780 {REPEAT_256(COMMA, 1.414),
781 3.14}} 781 3.14}}
782 }; 782 };
783 for (size_t i = 0; i < arraysize(snippets); i++) { 783 for (size_t i = 0; i < arraysize(snippets); i++) {
784 Handle<BytecodeArray> bytecode_array = 784 Handle<BytecodeArray> bytecode_array =
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 REPEAT_127(SPACE, " b = a.name; ") 937 REPEAT_127(SPACE, " b = a.name; ")
938 " return a.name; }\n" 938 " return a.name; }\n"
939 "f({name : \"test\"})\n", 939 "f({name : \"test\"})\n",
940 1 * kPointerSize, 940 1 * kPointerSize,
941 2, 941 2,
942 769, 942 769,
943 { 943 {
944 REPEAT_127(COMMA, // 944 REPEAT_127(COMMA, //
945 B(LoadICSloppy), A(1, 2), U8(0), U8((wide_idx_1 += 2)), // 945 B(LoadICSloppy), A(1, 2), U8(0), U8((wide_idx_1 += 2)), //
946 B(Star), R(0)), // 946 B(Star), R(0)), //
947 B(LoadICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 += 2), // 947 B(LoadICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 + 2), //
948 B(Return), // 948 B(Return), //
949 }, 949 },
950 1, 950 1,
951 {"name"}}, 951 {"name"}},
952 { 952 {
953 "function f(a) {\n" 953 "function f(a) {\n"
954 " 'use strict'; var b;\n" 954 " 'use strict'; var b;\n"
955 REPEAT_127(SPACE, " b = a.name; ") 955 REPEAT_127(SPACE, " b = a.name; ")
956 " return a.name; }\n" 956 " return a.name; }\n"
957 "f({name : \"test\"})\n", 957 "f({name : \"test\"})\n",
958 1 * kPointerSize, 958 1 * kPointerSize,
959 2, 959 2,
960 769, 960 769,
961 { 961 {
962 REPEAT_127(COMMA, // 962 REPEAT_127(COMMA, //
963 B(LoadICStrict), A(1, 2), U8(0), U8((wide_idx_2 += 2)), // 963 B(LoadICStrict), A(1, 2), U8(0), U8((wide_idx_2 += 2)), //
964 B(Star), R(0)), // 964 B(Star), R(0)), //
965 B(LoadICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 += 2), // 965 B(LoadICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 + 2), //
966 B(Return), // 966 B(Return), //
967 }, 967 },
968 1, 968 1,
969 {"name"}}, 969 {"name"}},
970 { 970 {
971 "function f(a, b) {\n" 971 "function f(a, b) {\n"
972 " var c;\n" 972 " var c;\n"
973 REPEAT_127(SPACE, " c = a[b]; ") 973 REPEAT_127(SPACE, " c = a[b]; ")
974 " return a[b]; }\n" 974 " return a[b]; }\n"
975 "f({name : \"test\"}, \"name\")\n", 975 "f({name : \"test\"}, \"name\")\n",
976 1 * kPointerSize, 976 1 * kPointerSize,
977 3, 977 3,
978 896, 978 896,
979 { 979 {
980 REPEAT_127(COMMA, // 980 REPEAT_127(COMMA, //
981 B(Ldar), A(2, 3), // 981 B(Ldar), A(2, 3), //
982 B(KeyedLoadICSloppy), A(1, 3), U8((wide_idx_3 += 2)), // 982 B(KeyedLoadICSloppy), A(1, 3), U8((wide_idx_3 += 2)), //
983 B(Star), R(0)), // 983 B(Star), R(0)), //
984 B(Ldar), A(2, 3), // 984 B(Ldar), A(2, 3), //
985 B(KeyedLoadICSloppyWide), A(1, 3), U16(wide_idx_3 += 2), // 985 B(KeyedLoadICSloppyWide), A(1, 3), U16(wide_idx_3 + 2), //
986 B(Return), // 986 B(Return), //
987 }}, 987 }},
988 { 988 {
989 "function f(a, b) {\n" 989 "function f(a, b) {\n"
990 " 'use strict'; var c;\n" 990 " 'use strict'; var c;\n"
991 REPEAT_127(SPACE, " c = a[b]; ") 991 REPEAT_127(SPACE, " c = a[b]; ")
992 " return a[b]; }\n" 992 " return a[b]; }\n"
993 "f({name : \"test\"}, \"name\")\n", 993 "f({name : \"test\"}, \"name\")\n",
994 1 * kPointerSize, 994 1 * kPointerSize,
995 3, 995 3,
996 896, 996 896,
997 { 997 {
998 REPEAT_127(COMMA, // 998 REPEAT_127(COMMA, //
999 B(Ldar), A(2, 3), // 999 B(Ldar), A(2, 3), //
1000 B(KeyedLoadICStrict), A(1, 3), U8((wide_idx_4 += 2)), // 1000 B(KeyedLoadICStrict), A(1, 3), U8((wide_idx_4 += 2)), //
1001 B(Star), R(0)), // 1001 B(Star), R(0)), //
1002 B(Ldar), A(2, 3), // 1002 B(Ldar), A(2, 3), //
1003 B(KeyedLoadICStrictWide), A(1, 3), U16(wide_idx_4 += 2), // 1003 B(KeyedLoadICStrictWide), A(1, 3), U16(wide_idx_4 + 2), //
1004 B(Return), // 1004 B(Return), //
1005 }}, 1005 }},
1006 }; 1006 };
1007 for (size_t i = 0; i < arraysize(snippets); i++) { 1007 for (size_t i = 0; i < arraysize(snippets); i++) {
1008 Handle<BytecodeArray> bytecode_array = 1008 Handle<BytecodeArray> bytecode_array =
1009 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); 1009 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
1010 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 1010 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
1011 } 1011 }
1012 } 1012 }
1013 1013
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 " a.name = 2; }\n" 1129 " a.name = 2; }\n"
1130 "f({name : \"test\"})\n", 1130 "f({name : \"test\"})\n",
1131 0, 1131 0,
1132 2, 1132 2,
1133 772, 1133 772,
1134 { 1134 {
1135 REPEAT_127(COMMA, // 1135 REPEAT_127(COMMA, //
1136 B(LdaSmi8), U8(1), // 1136 B(LdaSmi8), U8(1), //
1137 B(StoreICSloppy), A(1, 2), U8(0), U8((wide_idx_1 += 2))), // 1137 B(StoreICSloppy), A(1, 2), U8(0), U8((wide_idx_1 += 2))), //
1138 B(LdaSmi8), U8(2), // 1138 B(LdaSmi8), U8(2), //
1139 B(StoreICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 += 2), // 1139 B(StoreICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 + 2), //
1140 B(LdaUndefined), // 1140 B(LdaUndefined), //
1141 B(Return), // 1141 B(Return), //
1142 }, 1142 },
1143 1, 1143 1,
1144 {"name"}}, 1144 {"name"}},
1145 {"function f(a) {\n" 1145 {"function f(a) {\n"
1146 "'use strict';\n" 1146 "'use strict';\n"
1147 REPEAT_127(SPACE, " a.name = 1; ") 1147 REPEAT_127(SPACE, " a.name = 1; ")
1148 " a.name = 2; }\n" 1148 " a.name = 2; }\n"
1149 "f({name : \"test\"})\n", 1149 "f({name : \"test\"})\n",
1150 0, 1150 0,
1151 2, 1151 2,
1152 772, 1152 772,
1153 { 1153 {
1154 REPEAT_127(COMMA, // 1154 REPEAT_127(COMMA, //
1155 B(LdaSmi8), U8(1), // 1155 B(LdaSmi8), U8(1), //
1156 B(StoreICStrict), A(1, 2), U8(0), U8((wide_idx_2 += 2))), // 1156 B(StoreICStrict), A(1, 2), U8(0), U8((wide_idx_2 += 2))), //
1157 B(LdaSmi8), U8(2), // 1157 B(LdaSmi8), U8(2), //
1158 B(StoreICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 += 2), // 1158 B(StoreICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 + 2), //
1159 B(LdaUndefined), // 1159 B(LdaUndefined), //
1160 B(Return), // 1160 B(Return), //
1161 }, 1161 },
1162 1, 1162 1,
1163 {"name"}}, 1163 {"name"}},
1164 {"function f(a, b) {\n" 1164 {"function f(a, b) {\n"
1165 REPEAT_127(SPACE, " a[b] = 1; ") 1165 REPEAT_127(SPACE, " a[b] = 1; ")
1166 " a[b] = 2; }\n" 1166 " a[b] = 2; }\n"
1167 "f({name : \"test\"})\n", 1167 "f({name : \"test\"})\n",
1168 0, 1168 0,
1169 3, 1169 3,
1170 771, 1170 771,
1171 { 1171 {
1172 REPEAT_127(COMMA, // 1172 REPEAT_127(COMMA, //
1173 B(LdaSmi8), U8(1), // 1173 B(LdaSmi8), U8(1), //
1174 B(KeyedStoreICSloppy), A(1, 3), A(2, 3), // 1174 B(KeyedStoreICSloppy), A(1, 3), A(2, 3), //
1175 U8((wide_idx_3 += 2))), // 1175 U8((wide_idx_3 += 2))), //
1176 B(LdaSmi8), U8(2), // 1176 B(LdaSmi8), U8(2), //
1177 B(KeyedStoreICSloppyWide), A(1, 3), A(2, 3), // 1177 B(KeyedStoreICSloppyWide), A(1, 3), A(2, 3), //
1178 U16(wide_idx_3 += 2), // 1178 U16(wide_idx_3 + 2), //
1179 B(LdaUndefined), // 1179 B(LdaUndefined), //
1180 B(Return), // 1180 B(Return), //
1181 }}, 1181 }},
1182 {"function f(a, b) {\n" 1182 {"function f(a, b) {\n"
1183 "'use strict';\n" 1183 "'use strict';\n"
1184 REPEAT_127(SPACE, " a[b] = 1; ") 1184 REPEAT_127(SPACE, " a[b] = 1; ")
1185 " a[b] = 2; }\n" 1185 " a[b] = 2; }\n"
1186 "f({name : \"test\"})\n", 1186 "f({name : \"test\"})\n",
1187 0, 1187 0,
1188 3, 1188 3,
1189 771, 1189 771,
1190 { 1190 {
1191 REPEAT_127(COMMA, // 1191 REPEAT_127(COMMA, //
1192 B(LdaSmi8), U8(1), // 1192 B(LdaSmi8), U8(1), //
1193 B(KeyedStoreICStrict), A(1, 3), A(2, 3), // 1193 B(KeyedStoreICStrict), A(1, 3), A(2, 3), //
1194 U8((wide_idx_4 += 2))), // 1194 U8((wide_idx_4 += 2))), //
1195 B(LdaSmi8), U8(2), // 1195 B(LdaSmi8), U8(2), //
1196 B(KeyedStoreICStrictWide), A(1, 3), A(2, 3), // 1196 B(KeyedStoreICStrictWide), A(1, 3), A(2, 3), //
1197 U16(wide_idx_4 += 2), // 1197 U16(wide_idx_4 + 2), //
1198 B(LdaUndefined), // 1198 B(LdaUndefined), //
1199 B(Return), // 1199 B(Return), //
1200 }}}; 1200 }}};
1201 for (size_t i = 0; i < arraysize(snippets); i++) { 1201 for (size_t i = 0; i < arraysize(snippets); i++) {
1202 Handle<BytecodeArray> bytecode_array = 1202 Handle<BytecodeArray> bytecode_array =
1203 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); 1203 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
1204 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 1204 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
1205 } 1205 }
1206 } 1206 }
1207 1207
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 {"a"}}, 1340 {"a"}},
1341 {"a = 1; function f(b) {\n" 1341 {"a = 1; function f(b) {\n"
1342 REPEAT_127(SPACE, "b.name; ") 1342 REPEAT_127(SPACE, "b.name; ")
1343 " return a; }\nf({name: 1});", 1343 " return a; }\nf({name: 1});",
1344 0, 1344 0,
1345 2, 1345 2,
1346 514, 1346 514,
1347 { 1347 {
1348 REPEAT_127(COMMA, // 1348 REPEAT_127(COMMA, //
1349 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), // 1349 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), //
1350 B(LdaGlobalSloppyWide), U16(1), U16(wide_idx_1 += 2), // 1350 B(LdaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), //
1351 B(Return), // 1351 B(Return), //
1352 }, 1352 },
1353 2, 1353 2,
1354 {"name", "a"}}, 1354 {"name", "a"}},
1355 {"a = 1; function f(b) {\n" 1355 {"a = 1; function f(b) {\n"
1356 " 'use strict';\n" 1356 " 'use strict';\n"
1357 REPEAT_127(SPACE, "b.name; ") 1357 REPEAT_127(SPACE, "b.name; ")
1358 " return a; }\nf({name: 1});", 1358 " return a; }\nf({name: 1});",
1359 0, 1359 0,
1360 2, 1360 2,
1361 514, 1361 514,
1362 { 1362 {
1363 REPEAT_127(COMMA, // 1363 REPEAT_127(COMMA, //
1364 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), // 1364 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), //
1365 B(LdaGlobalStrictWide), U16(1), U16(wide_idx_2 += 2), // 1365 B(LdaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), //
1366 B(Return), // 1366 B(Return), //
1367 }, 1367 },
1368 2, 1368 2,
1369 {"name", "a"}}, 1369 {"name", "a"}},
1370 }; 1370 };
1371 1371
1372 for (size_t i = 0; i < arraysize(snippets); i++) { 1372 for (size_t i = 0; i < arraysize(snippets); i++) {
1373 Handle<BytecodeArray> bytecode_array = 1373 Handle<BytecodeArray> bytecode_array =
1374 helper.MakeBytecode(snippets[i].code_snippet, "f"); 1374 helper.MakeBytecode(snippets[i].code_snippet, "f");
1375 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 1375 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 {"a = 1; function f(b) {\n" 1444 {"a = 1; function f(b) {\n"
1445 REPEAT_127(SPACE, "b.name; ") 1445 REPEAT_127(SPACE, "b.name; ")
1446 " a = 2; }\nf({name: 1});", 1446 " a = 2; }\nf({name: 1});",
1447 0, 1447 0,
1448 2, 1448 2,
1449 517, 1449 517,
1450 { 1450 {
1451 REPEAT_127(COMMA, // 1451 REPEAT_127(COMMA, //
1452 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), // 1452 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), //
1453 B(LdaSmi8), U8(2), // 1453 B(LdaSmi8), U8(2), //
1454 B(StaGlobalSloppyWide), U16(1), U16(wide_idx_1 += 2), // 1454 B(StaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), //
1455 B(LdaUndefined), // 1455 B(LdaUndefined), //
1456 B(Return), // 1456 B(Return), //
1457 }, 1457 },
1458 2, 1458 2,
1459 {"name", "a"}}, 1459 {"name", "a"}},
1460 {"a = 1; function f(b) {\n" 1460 {"a = 1; function f(b) {\n"
1461 " 'use strict';\n" 1461 " 'use strict';\n"
1462 REPEAT_127(SPACE, "b.name; ") 1462 REPEAT_127(SPACE, "b.name; ")
1463 " a = 2; }\nf({name: 1});", 1463 " a = 2; }\nf({name: 1});",
1464 0, 1464 0,
1465 2, 1465 2,
1466 517, 1466 517,
1467 { 1467 {
1468 REPEAT_127(COMMA, // 1468 REPEAT_127(COMMA, //
1469 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), // 1469 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), //
1470 B(LdaSmi8), U8(2), // 1470 B(LdaSmi8), U8(2), //
1471 B(StaGlobalStrictWide), U16(1), U16(wide_idx_2 += 2), // 1471 B(StaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), //
1472 B(LdaUndefined), // 1472 B(LdaUndefined), //
1473 B(Return), // 1473 B(Return), //
1474 }, 1474 },
1475 2, 1475 2,
1476 {"name", "a"}}, 1476 {"name", "a"}},
1477 }; 1477 };
1478 1478
1479 for (size_t i = 0; i < arraysize(snippets); i++) { 1479 for (size_t i = 0; i < arraysize(snippets); i++) {
1480 Handle<BytecodeArray> bytecode_array = 1480 Handle<BytecodeArray> bytecode_array =
1481 helper.MakeBytecode(snippets[i].code_snippet, "f"); 1481 helper.MakeBytecode(snippets[i].code_snippet, "f");
(...skipping 3661 matching lines...) Expand 10 before | Expand all | Expand 10 after
5143 for (size_t i = 0; i < arraysize(snippets); i++) { 5143 for (size_t i = 0; i < arraysize(snippets); i++) {
5144 Handle<BytecodeArray> bytecode_array = 5144 Handle<BytecodeArray> bytecode_array =
5145 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); 5145 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
5146 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 5146 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
5147 } 5147 }
5148 } 5148 }
5149 5149
5150 } // namespace interpreter 5150 } // namespace interpreter
5151 } // namespace internal 5151 } // namespace internal
5152 } // namespace v8 5152 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698