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

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

Issue 1854113002: [interpreter] statement position always overwrites earlier positions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 8 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/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 {
(...skipping 19 matching lines...) Expand all
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, EncodeStatementDuplicates) { 36 TEST_F(SourcePositionTableTest, EncodeStatementDuplicates) {
37 SourcePositionTableBuilder builder(isolate(), zone()); 37 SourcePositionTableBuilder builder(isolate(), zone());
38 for (int i = 0; i < arraysize(offsets); i++) { 38 for (int i = 0; i < arraysize(offsets); i++) {
39 builder.AddStatementPosition(offsets[i], offsets[i]); 39 builder.AddStatementPosition(offsets[i], offsets[i]);
40 builder.AddStatementPosition( 40 builder.AddStatementPosition(offsets[i], offsets[i] + 1);
41 offsets[i], offsets[i],
42 (i % 2 == 0) ? SourcePositionTableBuilder::OVERWRITE_DUPLICATE
43 : SourcePositionTableBuilder::DISCARD_DUPLICATE);
44 builder.AddStatementPosition(offsets[i], offsets[i]);
45 builder.AddStatementPosition(
46 offsets[i], offsets[i],
47 (i % 2 == 0) ? SourcePositionTableBuilder::OVERWRITE_DUPLICATE
48 : SourcePositionTableBuilder::DISCARD_DUPLICATE);
49 } 41 }
50 42
51 // To test correctness, we rely on the assertions in ToSourcePositionTable(). 43 // To test correctness, we rely on the assertions in ToSourcePositionTable().
52 // (Also below.) 44 // (Also below.)
53 CHECK(!builder.ToSourcePositionTable().is_null()); 45 CHECK(!builder.ToSourcePositionTable().is_null());
54 } 46 }
55 47
56 TEST_F(SourcePositionTableTest, EncodeExpression) { 48 TEST_F(SourcePositionTableTest, EncodeExpression) {
57 SourcePositionTableBuilder builder(isolate(), zone()); 49 SourcePositionTableBuilder builder(isolate(), zone());
58 for (int i = 0; i < arraysize(offsets); i++) { 50 for (int i = 0; i < arraysize(offsets); i++) {
(...skipping 24 matching lines...) Expand all
83 builder.AddExpressionPosition(accumulator, accumulator); 75 builder.AddExpressionPosition(accumulator, accumulator);
84 } 76 }
85 } 77 }
86 78
87 CHECK(!builder.ToSourcePositionTable().is_null()); 79 CHECK(!builder.ToSourcePositionTable().is_null());
88 } 80 }
89 81
90 } // namespace interpreter 82 } // namespace interpreter
91 } // namespace internal 83 } // namespace internal
92 } // namespace v8 84 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698