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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 1574363002: Use classifying token position for control flow IR instructions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « runtime/vm/flow_graph_builder_test.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 23 matching lines...) Expand all
34 class LocalVariable; 34 class LocalVariable;
35 class ParsedFunction; 35 class ParsedFunction;
36 class Range; 36 class Range;
37 class RangeAnalysis; 37 class RangeAnalysis;
38 class RangeBoundary; 38 class RangeBoundary;
39 class UnboxIntegerInstr; 39 class UnboxIntegerInstr;
40 40
41 // These token positions are used to classify instructions that can't be 41 // These token positions are used to classify instructions that can't be
42 // directly tied to an actual source position. 42 // directly tied to an actual source position.
43 #define CLASSIFYING_TOKEN_POSITIONS(V) \ 43 #define CLASSIFYING_TOKEN_POSITIONS(V) \
44 V(Box, -2) \ 44 V(Private, -2) \
45 V(ParallelMove, -3) \ 45 V(Box, -3) \
46 V(TempMove, -4) \ 46 V(ParallelMove, -4) \
47 V(Constant, -5) 47 V(TempMove, -5) \
48 V(Constant, -6) \
49 V(PushArgument, -7) \
50 V(ControlFlow, -8)
48 51
49 // COMPILE_ASSERT that all CLASSIFYING_TOKEN_POSITIONS are less than 52 // COMPILE_ASSERT that all CLASSIFYING_TOKEN_POSITIONS are less than
50 // Scanner::kNoSourcePos. 53 // Scanner::kNoSourcePos.
51 #define SANITY_CHECK_VALUES(name, value) \ 54 #define SANITY_CHECK_VALUES(name, value) \
52 COMPILE_ASSERT(value < Scanner::kNoSourcePos); 55 COMPILE_ASSERT(value < Scanner::kNoSourcePos);
53 CLASSIFYING_TOKEN_POSITIONS(SANITY_CHECK_VALUES); 56 CLASSIFYING_TOKEN_POSITIONS(SANITY_CHECK_VALUES);
54 #undef SANITY_CHECK_VALUES 57 #undef SANITY_CHECK_VALUES
55 58
56 class ClassifyingTokenPositions : public AllStatic { 59 class ClassifyingTokenPositions : public AllStatic {
57 public: 60 public:
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 1222
1220 BitVector* loop_info() const { return loop_info_; } 1223 BitVector* loop_info() const { return loop_info_; }
1221 void set_loop_info(BitVector* loop_info) { 1224 void set_loop_info(BitVector* loop_info) {
1222 loop_info_ = loop_info; 1225 loop_info_ = loop_info;
1223 } 1226 }
1224 1227
1225 virtual BlockEntryInstr* GetBlock() { 1228 virtual BlockEntryInstr* GetBlock() {
1226 return this; 1229 return this;
1227 } 1230 }
1228 1231
1232 virtual intptr_t token_pos() const {
1233 return ClassifyingTokenPositions::kControlFlow;
1234 }
1235
1229 // Helper to mutate the graph during inlining. This block should be 1236 // Helper to mutate the graph during inlining. This block should be
1230 // replaced with new_block as a predecessor of all of this block's 1237 // replaced with new_block as a predecessor of all of this block's
1231 // successors. 1238 // successors.
1232 void ReplaceAsPredecessorWith(BlockEntryInstr* new_block); 1239 void ReplaceAsPredecessorWith(BlockEntryInstr* new_block);
1233 1240
1234 void set_block_id(intptr_t block_id) { block_id_ = block_id; } 1241 void set_block_id(intptr_t block_id) { block_id_ = block_id; }
1235 1242
1236 intptr_t offset() const { return offset_; } 1243 intptr_t offset() const { return offset_; }
1237 void set_offset(intptr_t offset) { offset_ = offset; } 1244 void set_offset(intptr_t offset) { offset_ = offset; }
1238 1245
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 virtual CompileType ComputeType() const; 2075 virtual CompileType ComputeType() const;
2069 2076
2070 Value* value() const { return InputAt(0); } 2077 Value* value() const { return InputAt(0); }
2071 2078
2072 virtual bool CanDeoptimize() const { return false; } 2079 virtual bool CanDeoptimize() const { return false; }
2073 2080
2074 virtual EffectSet Effects() const { return EffectSet::None(); } 2081 virtual EffectSet Effects() const { return EffectSet::None(); }
2075 2082
2076 virtual void PrintOperandsTo(BufferFormatter* f) const; 2083 virtual void PrintOperandsTo(BufferFormatter* f) const;
2077 2084
2085 virtual intptr_t token_pos() const {
2086 return ClassifyingTokenPositions::kPushArgument;
2087 }
2088
2078 private: 2089 private:
2079 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 2090 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
2080 }; 2091 };
2081 2092
2082 2093
2083 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 2094 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
2084 return PushArgumentAt(index)->value()->definition(); 2095 return PushArgumentAt(index)->value()->definition();
2085 } 2096 }
2086 2097
2087 2098
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 2253
2243 ParallelMoveInstr* GetParallelMove() { 2254 ParallelMoveInstr* GetParallelMove() {
2244 if (parallel_move_ == NULL) { 2255 if (parallel_move_ == NULL) {
2245 parallel_move_ = new ParallelMoveInstr(); 2256 parallel_move_ = new ParallelMoveInstr();
2246 } 2257 }
2247 return parallel_move_; 2258 return parallel_move_;
2248 } 2259 }
2249 2260
2250 virtual void PrintTo(BufferFormatter* f) const; 2261 virtual void PrintTo(BufferFormatter* f) const;
2251 2262
2263 virtual intptr_t token_pos() const {
2264 return ClassifyingTokenPositions::kControlFlow;
2265 }
2266
2252 private: 2267 private:
2253 BlockEntryInstr* block_; 2268 BlockEntryInstr* block_;
2254 JoinEntryInstr* successor_; 2269 JoinEntryInstr* successor_;
2255 double edge_weight_; 2270 double edge_weight_;
2256 2271
2257 // Parallel move that will be used by linear scan register allocator to 2272 // Parallel move that will be used by linear scan register allocator to
2258 // connect live ranges at the end of the block and resolve phis. 2273 // connect live ranges at the end of the block and resolve phis.
2259 ParallelMoveInstr* parallel_move_; 2274 ParallelMoveInstr* parallel_move_;
2260 }; 2275 };
2261 2276
(...skipping 5937 matching lines...) Expand 10 before | Expand all | Expand 10 after
8199 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8214 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8200 UNIMPLEMENTED(); \ 8215 UNIMPLEMENTED(); \
8201 return NULL; \ 8216 return NULL; \
8202 } \ 8217 } \
8203 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8218 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8204 8219
8205 8220
8206 } // namespace dart 8221 } // namespace dart
8207 8222
8208 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8223 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698