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

Side by Side Diff: test/unittests/interpreter/bytecode-array-builder-unittest.cc

Issue 1410863002: [Interpreter] Add support for Throw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-array-builder.h" 7 #include "src/interpreter/bytecode-array-builder.h"
8 #include "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Insert dummy ops to force longer jumps 127 // Insert dummy ops to force longer jumps
128 for (int i = 0; i < 128; i++) { 128 for (int i = 0; i < 128; i++) {
129 builder.LoadTrue(); 129 builder.LoadTrue();
130 } 130 }
131 // Longer jumps requiring Constant operand 131 // Longer jumps requiring Constant operand
132 builder.Jump(&start) 132 builder.Jump(&start)
133 .JumpIfTrue(&start) 133 .JumpIfTrue(&start)
134 .JumpIfFalse(&start) 134 .JumpIfFalse(&start)
135 .JumpIfToBooleanTrue(&start) 135 .JumpIfToBooleanTrue(&start)
136 .JumpIfToBooleanFalse(&start); 136 .JumpIfToBooleanFalse(&start);
137
138 builder.EnterBlock()
139 .Throw()
140 .LeaveBlock();
141
137 builder.Return(); 142 builder.Return();
138 143
139 // Generate BytecodeArray. 144 // Generate BytecodeArray.
140 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); 145 Handle<BytecodeArray> the_array = builder.ToBytecodeArray();
141 CHECK_EQ(the_array->frame_size(), 146 CHECK_EQ(the_array->frame_size(),
142 builder.fixed_register_count() * kPointerSize); 147 builder.fixed_register_count() * kPointerSize);
143 148
144 // Build scorecard of bytecodes encountered in the BytecodeArray. 149 // Build scorecard of bytecodes encountered in the BytecodeArray.
145 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); 150 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1);
146 Bytecode final_bytecode = Bytecode::kLdaZero; 151 Bytecode final_bytecode = Bytecode::kLdaZero;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 500
496 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 501 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
497 iterator.Advance(); 502 iterator.Advance();
498 CHECK(iterator.done()); 503 CHECK(iterator.done());
499 } 504 }
500 505
501 506
502 } // namespace interpreter 507 } // namespace interpreter
503 } // namespace internal 508 } // namespace internal
504 } // namespace v8 509 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698