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

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

Issue 10032009: Fix a crash in graoh builder where a throw node is added in an expression tree by the parser: allow… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 Value* value_; 1179 Value* value_;
1180 intptr_t token_index_; 1180 intptr_t token_index_;
1181 1181
1182 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 1182 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
1183 }; 1183 };
1184 1184
1185 1185
1186 class ThrowInstr : public Instruction { 1186 class ThrowInstr : public Instruction {
1187 public: 1187 public:
1188 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) 1188 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception)
1189 : node_id_(node_id), token_index_(token_index), exception_(exception) { 1189 : node_id_(node_id),
1190 token_index_(token_index),
1191 exception_(exception),
1192 successor_(NULL) {
1190 ASSERT(exception_ != NULL); 1193 ASSERT(exception_ != NULL);
1191 } 1194 }
1192 1195
1193 DECLARE_INSTRUCTION(Throw) 1196 DECLARE_INSTRUCTION(Throw)
1194 1197
1195 intptr_t node_id() const { return node_id_; } 1198 intptr_t node_id() const { return node_id_; }
1196 intptr_t token_index() const { return token_index_; } 1199 intptr_t token_index() const { return token_index_; }
1197 Value* exception() const { return exception_; } 1200 Value* exception() const { return exception_; }
1198 1201
1199 virtual Instruction* StraightLineSuccessor() const { return NULL; } 1202 // Parser can generate a throw within an expression tree.
1200 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } 1203 virtual Instruction* StraightLineSuccessor() const {
1204 return successor_;
1205 }
1206 virtual void SetSuccessor(Instruction* instr) {
1207 ASSERT(successor_ == NULL);
1208 successor_ = instr;
1209 }
1201 1210
1202 private: 1211 private:
1203 intptr_t node_id_; 1212 intptr_t node_id_;
1204 intptr_t token_index_; 1213 intptr_t token_index_;
1205 Value* exception_; 1214 Value* exception_;
1215 Instruction* successor_;
1206 1216
1207 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 1217 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
1208 }; 1218 };
1209 1219
1210 1220
1211 class ReThrowInstr : public Instruction { 1221 class ReThrowInstr : public Instruction {
1212 public: 1222 public:
1213 ReThrowInstr(intptr_t node_id, 1223 ReThrowInstr(intptr_t node_id,
1214 intptr_t token_index, 1224 intptr_t token_index,
1215 Value* exception, 1225 Value* exception,
1216 Value* stack_trace) 1226 Value* stack_trace)
1217 : node_id_(node_id), 1227 : node_id_(node_id),
1218 token_index_(token_index), 1228 token_index_(token_index),
1219 exception_(exception), 1229 exception_(exception),
1220 stack_trace_(stack_trace) { 1230 stack_trace_(stack_trace),
1231 successor_(NULL) {
1221 ASSERT(exception_ != NULL); 1232 ASSERT(exception_ != NULL);
1222 ASSERT(stack_trace_ != NULL); 1233 ASSERT(stack_trace_ != NULL);
1223 } 1234 }
1224 1235
1225 DECLARE_INSTRUCTION(ReThrow) 1236 DECLARE_INSTRUCTION(ReThrow)
1226 1237
1227 intptr_t node_id() const { return node_id_; } 1238 intptr_t node_id() const { return node_id_; }
1228 intptr_t token_index() const { return token_index_; } 1239 intptr_t token_index() const { return token_index_; }
1229 Value* exception() const { return exception_; } 1240 Value* exception() const { return exception_; }
1230 Value* stack_trace() const { return stack_trace_; } 1241 Value* stack_trace() const { return stack_trace_; }
1231 1242
1232 virtual Instruction* StraightLineSuccessor() const { return NULL; } 1243 // Parser can generate a rethrow within an expression tree.
1233 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } 1244 virtual Instruction* StraightLineSuccessor() const {
1245 return successor_;
1246 }
1247 virtual void SetSuccessor(Instruction* instr) {
1248 ASSERT(successor_ == NULL);
1249 successor_ = instr;
1250 }
1234 1251
1235 private: 1252 private:
1236 intptr_t node_id_; 1253 intptr_t node_id_;
1237 intptr_t token_index_; 1254 intptr_t token_index_;
1238 Value* exception_; 1255 Value* exception_;
1239 Value* stack_trace_; 1256 Value* stack_trace_;
1257 Instruction* successor_;
1240 1258
1241 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 1259 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
1242 }; 1260 };
1243 1261
1244 1262
1245 class BranchInstr : public Instruction { 1263 class BranchInstr : public Instruction {
1246 public: 1264 public:
1247 explicit BranchInstr(Value* value) 1265 explicit BranchInstr(Value* value)
1248 : value_(value), 1266 : value_(value),
1249 true_successor_(NULL), 1267 true_successor_(NULL),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 const GrowableArray<BlockEntryInstr*>& block_order_; 1333 const GrowableArray<BlockEntryInstr*>& block_order_;
1316 1334
1317 private: 1335 private:
1318 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1336 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1319 }; 1337 };
1320 1338
1321 1339
1322 } // namespace dart 1340 } // namespace dart
1323 1341
1324 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1342 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698