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

Side by Side Diff: test/unittests/interpreter/source-position-table-unittest.cc

Issue 1801473003: [ignition, debugger] correctly set position for return with elided bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« test/cctest/cctest.status ('K') | « test/mjsunit/mjsunit.status ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/source-position-table.h" 7 #include "src/interpreter/source-position-table.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 namespace interpreter { 12 namespace interpreter {
13 13
14 class SourcePositionTableTest : public TestWithIsolateAndZone { 14 class SourcePositionTableTest : public TestWithIsolateAndZone {
15 public: 15 public:
16 SourcePositionTableTest() {} 16 SourcePositionTableTest() {}
17 ~SourcePositionTableTest() override {} 17 ~SourcePositionTableTest() override {}
18 }; 18 };
19 19
20 // Some random offsets, mostly at 'suspicious' bit boundaries. 20 // Some random offsets, mostly at 'suspicious' bit boundaries.
21 static int offsets[] = {0, 1, 2, 3, 4, 30, 31, 32, 21 static int offsets[] = {0, 1, 2, 3, 4, 30, 31, 32,
22 33, 62, 63, 64, 65, 126, 127, 128, 22 33, 62, 63, 64, 65, 126, 127, 128,
23 129, 250, 1000, 9999, 12000, 31415926}; 23 129, 250, 1000, 9999, 12000, 31415926, 31415926};
24 24
25 TEST_F(SourcePositionTableTest, EncodeStatement) { 25 TEST_F(SourcePositionTableTest, EncodeStatement) {
26 SourcePositionTableBuilder builder(isolate(), zone()); 26 SourcePositionTableBuilder builder(isolate(), zone());
27 for (int i = 0; i < arraysize(offsets); i++) { 27 for (int i = 0; i < arraysize(offsets); i++) {
28 builder.AddStatementPosition(offsets[i], offsets[i]); 28 builder.AddStatementPosition(offsets[i], offsets[i]);
29 } 29 }
30 30
31 // To test correctness, we rely on the assertions in ToSourcePositionTable(). 31 // To test correctness, we rely on the assertions in ToSourcePositionTable().
32 // (Also below.) 32 // (Also below.)
33 CHECK(!builder.ToSourcePositionTable().is_null()); 33 CHECK(!builder.ToSourcePositionTable().is_null());
34 } 34 }
35 35
36 TEST_F(SourcePositionTableTest, EncodeStatementOverwrite) {
37 SourcePositionTableBuilder builder(isolate(), zone());
38 for (int i = 0; i < arraysize(offsets); i++) {
39 builder.AddStatementPosition(
40 offsets[i], offsets[i],
41 SourcePositionTableBuilder::OVERWRITE_DUPLICATE);
42 }
43
44 // To test correctness, we rely on the assertions in ToSourcePositionTable().
45 // (Also below.)
46 CHECK(!builder.ToSourcePositionTable().is_null());
47 }
48
vogelheim 2016/03/14 10:41:15 Maybe a good test case would be to just add each o
Yang 2016/03/14 11:32:34 Done.
36 TEST_F(SourcePositionTableTest, EncodeExpression) { 49 TEST_F(SourcePositionTableTest, EncodeExpression) {
37 SourcePositionTableBuilder builder(isolate(), zone()); 50 SourcePositionTableBuilder builder(isolate(), zone());
38 for (int i = 0; i < arraysize(offsets); i++) { 51 for (int i = 0; i < arraysize(offsets); i++) {
39 builder.AddExpressionPosition(offsets[i], offsets[i]); 52 builder.AddExpressionPosition(offsets[i], offsets[i]);
40 } 53 }
41 CHECK(!builder.ToSourcePositionTable().is_null()); 54 CHECK(!builder.ToSourcePositionTable().is_null());
42 } 55 }
43 56
44 TEST_F(SourcePositionTableTest, EncodeAscending) { 57 TEST_F(SourcePositionTableTest, EncodeAscending) {
45 SourcePositionTableBuilder builder(isolate(), zone()); 58 SourcePositionTableBuilder builder(isolate(), zone());
(...skipping 17 matching lines...) Expand all
63 builder.AddExpressionPosition(accumulator, accumulator); 76 builder.AddExpressionPosition(accumulator, accumulator);
64 } 77 }
65 } 78 }
66 79
67 CHECK(!builder.ToSourcePositionTable().is_null()); 80 CHECK(!builder.ToSourcePositionTable().is_null());
68 } 81 }
69 82
70 } // namespace interpreter 83 } // namespace interpreter
71 } // namespace internal 84 } // namespace internal
72 } // namespace v8 85 } // namespace v8
OLDNEW
« test/cctest/cctest.status ('K') | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698