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

Side by Side Diff: src/interpreter/source-position-table.h

Issue 1947403002: [interpreter] Introduce bytecode generation pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 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 | « src/interpreter/interpreter.cc ('k') | src/interpreter/source-position-table.cc » ('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 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 #ifndef V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ 5 #ifndef V8_INTERPRETER_SOURCE_POSITION_TABLE_H_
6 #define V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ 6 #define V8_INTERPRETER_SOURCE_POSITION_TABLE_H_
7 7
8 #include "src/assert-scope.h" 8 #include "src/assert-scope.h"
9 #include "src/checks.h" 9 #include "src/checks.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 16 matching lines...) Expand all
27 PositionTableEntry(int bytecode, int source, bool statement) 27 PositionTableEntry(int bytecode, int source, bool statement)
28 : bytecode_offset(bytecode), 28 : bytecode_offset(bytecode),
29 source_position(source), 29 source_position(source),
30 is_statement(statement) {} 30 is_statement(statement) {}
31 31
32 int bytecode_offset; 32 int bytecode_offset;
33 int source_position; 33 int source_position;
34 bool is_statement; 34 bool is_statement;
35 }; 35 };
36 36
37 class SourcePositionTableBuilder : public PositionsRecorder { 37 class SourcePositionTableBuilder final : public PositionsRecorder {
38 public: 38 public:
39 SourcePositionTableBuilder(Isolate* isolate, Zone* zone) 39 SourcePositionTableBuilder(Isolate* isolate, Zone* zone)
40 : isolate_(isolate), 40 : isolate_(isolate),
41 bytes_(zone), 41 bytes_(zone),
42 #ifdef ENABLE_SLOW_DCHECKS 42 #ifdef ENABLE_SLOW_DCHECKS
43 raw_entries_(zone), 43 raw_entries_(zone),
44 #endif 44 #endif
45 candidate_(kUninitializedCandidateOffset, 0, false) { 45 previous_() {
46 } 46 }
47 47
48 void AddStatementPosition(size_t bytecode_offset, int source_position); 48 void AddPosition(size_t bytecode_offset, int source_position,
49 void AddExpressionPosition(size_t bytecode_offset, int source_position); 49 bool is_statement);
50 Handle<ByteArray> ToSourcePositionTable(); 50 Handle<ByteArray> ToSourcePositionTable();
51 51
52 private: 52 private:
53 static const int kUninitializedCandidateOffset = -1;
54
55 void AddEntry(const PositionTableEntry& entry); 53 void AddEntry(const PositionTableEntry& entry);
56 void CommitEntry(); 54 void CommitEntry();
57 55
58 Isolate* isolate_; 56 Isolate* isolate_;
59 ZoneVector<byte> bytes_; 57 ZoneVector<byte> bytes_;
60 #ifdef ENABLE_SLOW_DCHECKS 58 #ifdef ENABLE_SLOW_DCHECKS
61 ZoneVector<PositionTableEntry> raw_entries_; 59 ZoneVector<PositionTableEntry> raw_entries_;
62 #endif 60 #endif
63 PositionTableEntry candidate_; // Next entry to be written, if initialized.
64 PositionTableEntry previous_; // Previously written entry, to compute delta. 61 PositionTableEntry previous_; // Previously written entry, to compute delta.
65 }; 62 };
66 63
67 class SourcePositionTableIterator { 64 class SourcePositionTableIterator {
68 public: 65 public:
69 explicit SourcePositionTableIterator(ByteArray* byte_array); 66 explicit SourcePositionTableIterator(ByteArray* byte_array);
70 67
71 void Advance(); 68 void Advance();
72 69
73 int bytecode_offset() const { 70 int bytecode_offset() const {
(...skipping 17 matching lines...) Expand all
91 int index_; 88 int index_;
92 PositionTableEntry current_; 89 PositionTableEntry current_;
93 DisallowHeapAllocation no_gc; 90 DisallowHeapAllocation no_gc;
94 }; 91 };
95 92
96 } // namespace interpreter 93 } // namespace interpreter
97 } // namespace internal 94 } // namespace internal
98 } // namespace v8 95 } // namespace v8
99 96
100 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ 97 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | src/interpreter/source-position-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698