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

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

Issue 1641723002: [interpreter] Translate exception handlers into graph. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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 unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/mjsunit/mjsunit.status » ('j') | 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "src/interpreter/bytecode-generator.h" 9 #include "src/interpreter/bytecode-generator.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 CHECK_EQ(CcTest::heap()->empty_fixed_array(), actual->constant_pool()); 205 CHECK_EQ(CcTest::heap()->empty_fixed_array(), actual->constant_pool());
206 } else { 206 } else {
207 CHECK_EQ(expected.constant_count, actual->constant_pool()->length()); 207 CHECK_EQ(expected.constant_count, actual->constant_pool()->length());
208 for (int i = 0; i < expected.constant_count; i++) { 208 for (int i = 0; i < expected.constant_count; i++) {
209 CheckConstant(expected.constants[i], actual->constant_pool()->get(i)); 209 CheckConstant(expected.constants[i], actual->constant_pool()->get(i));
210 } 210 }
211 } 211 }
212 if (expected.handler_count == 0) { 212 if (expected.handler_count == 0) {
213 CHECK_EQ(CcTest::heap()->empty_fixed_array(), actual->handler_table()); 213 CHECK_EQ(CcTest::heap()->empty_fixed_array(), actual->handler_table());
214 } else { 214 } else {
215 static const int kHTSize = 4; // see HandlerTable::kRangeEntrySize
216 static const int kHTStart = 0; // see HandlerTable::kRangeStartIndex
217 static const int kHTEnd = 1; // see HandlerTable::kRangeEndIndex
218 static const int kHTHandler = 2; // see HandlerTable::kRangeHandlerIndex
219 HandlerTable* table = HandlerTable::cast(actual->handler_table()); 215 HandlerTable* table = HandlerTable::cast(actual->handler_table());
220 CHECK_EQ(expected.handler_count * kHTSize, table->length()); 216 CHECK_EQ(expected.handler_count, table->NumberOfRangeEntries());
221 for (int i = 0; i < expected.handler_count; i++) { 217 for (int i = 0; i < expected.handler_count; i++) {
222 int start = Smi::cast(table->get(i * kHTSize + kHTStart))->value(); 218 CHECK_EQ(expected.handlers[i].start, table->GetRangeStart(i));
223 int end = Smi::cast(table->get(i * kHTSize + kHTEnd))->value(); 219 CHECK_EQ(expected.handlers[i].end, table->GetRangeEnd(i));
224 int handler = Smi::cast(table->get(i * kHTSize + kHTHandler))->value(); 220 CHECK_EQ(expected.handlers[i].handler, table->GetRangeHandler(i));
225 CHECK_EQ(expected.handlers[i].start, start);
226 CHECK_EQ(expected.handlers[i].end, end);
227 CHECK_EQ(expected.handlers[i].handler, handler >> 1);
228 } 221 }
229 } 222 }
230 223
231 BytecodeArrayIterator iterator(actual); 224 BytecodeArrayIterator iterator(actual);
232 int i = 0; 225 int i = 0;
233 while (!iterator.done()) { 226 while (!iterator.done()) {
234 int bytecode_index = i++; 227 int bytecode_index = i++;
235 Bytecode bytecode = iterator.current_bytecode(); 228 Bytecode bytecode = iterator.current_bytecode();
236 if (Bytecodes::ToByte(bytecode) != expected.bytecode[bytecode_index]) { 229 if (Bytecodes::ToByte(bytecode) != expected.bytecode[bytecode_index]) {
237 std::ostringstream stream; 230 std::ostringstream stream;
(...skipping 7328 matching lines...) Expand 10 before | Expand all | Expand 10 after
7566 Handle<BytecodeArray> bytecode_array = 7559 Handle<BytecodeArray> bytecode_array =
7567 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); 7560 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
7568 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 7561 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
7569 } 7562 }
7570 FLAG_harmony_do_expressions = old_flag; 7563 FLAG_harmony_do_expressions = old_flag;
7571 } 7564 }
7572 7565
7573 } // namespace interpreter 7566 } // namespace interpreter
7574 } // namespace internal 7567 } // namespace internal
7575 } // namespace v8 7568 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698