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

Unified Diff: test/cctest/interpreter/BasicLoops.golden

Issue 1717293002: [Interpreter] Refactor bytecode generator test suite. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: std::vector instead of initializer_list, golden path as constant. Created 4 years, 10 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
Index: test/cctest/interpreter/BasicLoops.golden
diff --git a/test/cctest/interpreter/BasicLoops.golden b/test/cctest/interpreter/BasicLoops.golden
new file mode 100644
index 0000000000000000000000000000000000000000..f1280a1edbbe04666b91d3f8b6e676465f0ff10c
--- /dev/null
+++ b/test/cctest/interpreter/BasicLoops.golden
@@ -0,0 +1,744 @@
+#
+# Autogenerated by generate-bytecode-expectations
+#
+
+---
+pool type: mixed
+execute: yes
+wrap: yes
+
+---
+snippet: "
+ var x = 0;
+ while (false) { x = 99; break; continue; }
+ return x;
+"
+frame size: 1 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0;while (false) { x = x + 1;};return x;
rmcilroy 2016/02/22 21:49:49 please add newlines to the snippets between statem
Stefano Sanfilippo 2016/02/23 15:57:18 Done.
+"
+frame size: 1 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0;var y = 1;while (x < 10) { y = y * 12; x = x + 1; if (x == 3) continue; if (x == 4) break;}return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(10),
+ B(TestLessThan), R(2),
+ B(JumpIfFalse), U8(47),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(12),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(3),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-39),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(4),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(4),
+ B(Jump), U8(-53),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var i = 0;while (true) { if (i < 0) continue; if (i == 3) break; if (i == 4) break; if (i == 10) continue; if (i == 5) break; i = i + 1;}return i;
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaZero),
+ B(TestLessThan), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-10),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(3),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(50),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(4),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(38),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(10),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-46),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(5),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(14),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-70),
+ B(Ldar), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var i = 0;while (true) { while (i < 3) { if (i == 2) break; i = i + 1; } i = i + 1; break;}return i;
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(3),
+ B(TestLessThan), R(1),
+ B(JumpIfFalse), U8(27),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(2),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(14),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-33),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(4),
+ B(Jump), U8(-48),
+ B(Ldar), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 10;var y = 1;while (x) { y = y * 12; x = x - 1;}return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaSmi8), U8(10),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(JumpIfToBooleanFalse), U8(25),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(12),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Sub), R(2),
+ B(Star), R(0),
+ B(Jump), U8(-25),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0; var y = 1;do { y = y * 10; if (x == 5) break; if (x == 6) continue; x = x + 1;} while (x < 10);return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(10),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(5),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(34),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(6),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(12),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(10),
+ B(TestLessThan), R(2),
+ B(JumpIfTrue), U8(-53),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 10;var y = 1;do { y = y * 12; x = x - 1;} while (x);return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaSmi8), U8(10),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(12),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Sub), R(2),
+ B(Star), R(0),
+ B(Ldar), R(0),
+ B(JumpIfToBooleanTrue), U8(-23),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0; var y = 1;do { y = y * 10; if (x == 5) break; x = x + 1; if (x == 6) continue;} while (false);return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(10),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(5),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(22),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(6),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(2),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0; var y = 1;do { y = y * 10; if (x == 5) break; x = x + 1; if (x == 6) continue;} while (true);return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(Star), R(1),
+ B(StackCheck),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(10),
+ B(Mul), R(2),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(5),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(24),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(6),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-41),
+ B(Jump), U8(-43),
+ B(Ldar), R(1),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0; for (;;) { if (x == 1) break; if (x == 2) continue; x = x + 1;}
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(26),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(2),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-23),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-35),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ for (var x = 0;;) { if (x == 1) break; if (x == 2) continue; x = x + 1;}
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(26),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(2),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(-23),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-35),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0; for (;; x = x + 1) { if (x == 1) break; if (x == 2) continue;}
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(26),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(2),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(2),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-35),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ for (var x = 0;; x = x + 1) { if (x == 1) break; if (x == 2) continue;}
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(26),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(2),
+ B(TestEqual), R(1),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(2),
+ B(Ldar), R(0),
+ B(Star), R(1),
+ B(LdaSmi8), U8(1),
+ B(Add), R(1),
+ B(Star), R(0),
+ B(Jump), U8(-35),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var u = 0;for (var i = 0; i < 100; i = i + 1) { u = u + 1; continue;}
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaZero),
+ B(Star), R(1),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(100),
+ B(TestLessThan), R(2),
+ B(JumpIfFalse), U8(27),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Jump), U8(2),
+ B(Ldar), R(1),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(1),
+ B(Jump), U8(-33),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var y = 1;for (var x = 10; x; --x) { y = y * 12;}return y;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaSmi8), U8(1),
+ B(Star), R(0),
+ B(LdaSmi8), U8(10),
+ B(Star), R(1),
+ B(Ldar), R(1),
+ B(JumpIfToBooleanFalse), U8(21),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(12),
+ B(Mul), R(2),
+ B(Star), R(0),
+ B(Ldar), R(1),
+ B(ToNumber),
+ B(Dec),
+ B(Star), R(1),
+ B(Jump), U8(-21),
+ B(Ldar), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0;for (var i = 0; false; i++) { x = x + 1;};return x;
+"
+frame size: 2 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaZero),
+ B(Star), R(1),
+ B(Ldar), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var x = 0;for (var i = 0; true; ++i) { x = x + 1; if (x == 20) break;};return x;
+"
+frame size: 3 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(0),
+ B(LdaZero),
+ B(Star), R(1),
+ B(StackCheck),
+ B(Ldar), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(1),
+ B(Add), R(2),
+ B(Star), R(0),
+ B(Star), R(2),
+ B(LdaSmi8), U8(20),
+ B(TestEqual), R(2),
+ B(JumpIfFalse), U8(4),
+ B(Jump), U8(10),
+ B(Ldar), R(1),
+ B(ToNumber),
+ B(Inc),
+ B(Star), R(1),
+ B(Jump), U8(-27),
+ B(Ldar), R(0),
+ B(Return),
+]
+constant pool: [
+]
+handlers: [
+]
+
+---
+snippet: "
+ var a = 0;
+ while (a) {
+ {
+ let z = 1;
+ function f() { z = 2; }
+ if (z) continue;
+ z++;
+ }
+ }
+"
+frame size: 7 # in multiples of sizeof(void*)
+parameter count: 1
+bytecodes: [
+ B(StackCheck),
+ B(LdaZero),
+ B(Star), R(1),
+ B(Ldar), R(1),
+ B(JumpIfToBooleanFalse), U8(110),
+ B(StackCheck),
+ B(LdaConstant), U8(0),
+ B(Star), R(4),
+ B(Ldar), R(closure),
+ B(Star), R(5),
+ B(CallRuntime), U16(464), R(4), U8(2),
+ B(PushContext), R(3),
+ B(LdaTheHole),
+ B(StaContextSlot), R(context), U8(4),
+ B(CreateClosure), U8(1), U8(0),
+ B(Star), R(0),
+ B(LdaSmi8), U8(1),
+ B(StaContextSlot), R(context), U8(4),
+ B(Ldar), R(0),
+ B(JumpIfNotHole), U8(11),
+ B(LdaConstant), U8(2),
+ B(Star), R(4),
+ B(CallRuntime), U16(257), R(4), U8(1),
+ B(Star), R(2),
+ B(LdaContextSlot), R(context), U8(4),
+ B(JumpIfNotHole), U8(11),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(CallRuntime), U16(257), R(4), U8(1),
+ B(JumpIfToBooleanFalse), U8(6),
+ B(PopContext), R(3),
+ B(Jump), U8(-67),
+ B(LdaContextSlot), R(context), U8(4),
+ B(JumpIfNotHole), U8(11),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(CallRuntime), U16(257), R(4), U8(1),
+ B(ToNumber),
+ B(Star), R(4),
+ B(Inc),
+ B(Star), R(5),
+ B(LdaContextSlot), R(context), U8(4),
+ B(JumpIfNotHole), U8(11),
+ B(LdaConstant), U8(3),
+ B(Star), R(6),
+ B(CallRuntime), U16(257), R(6), U8(1),
+ B(Ldar), R(5),
+ B(StaContextSlot), R(context), U8(4),
+ B(PopContext), R(3),
+ B(Jump), U8(-110),
+ B(LdaUndefined),
+ B(Return),
+]
+constant pool: [
+ InstanceType::FIXED_ARRAY_TYPE,
+ InstanceType::SHARED_FUNCTION_INFO_TYPE,
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
+]
+handlers: [
+]
+

Powered by Google App Engine
This is Rietveld 408576698