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

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 9706032: Add Throw and ReThrow nodes. Rethrow not yet tested (bailout with untested), since it needs the try… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.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 (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 #include "vm/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); 1268 Bailout("EffectGraphVisitor::VisitCatchClauseNode");
1269 } 1269 }
1270 1270
1271 1271
1272 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { 1272 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
1273 Bailout("EffectGraphVisitor::VisitTryCatchNode"); 1273 Bailout("EffectGraphVisitor::VisitTryCatchNode");
1274 } 1274 }
1275 1275
1276 1276
1277 void EffectGraphVisitor::VisitThrowNode(ThrowNode* node) { 1277 void EffectGraphVisitor::VisitThrowNode(ThrowNode* node) {
1278 Bailout("EffectGraphVisitor::VisitThrowNode"); 1278 ValueGraphVisitor for_exception(owner(), temp_index());
1279 node->exception()->Visit(&for_exception);
1280 Append(for_exception);
1281 if (node->stacktrace() == NULL) {
1282 ThrowComp* comp =
1283 new ThrowComp(node->id(), node->token_index(), for_exception.value());
1284 AddInstruction(new DoInstr(comp));
1285 } else {
1286 ValueGraphVisitor for_stack_trace(owner(), temp_index() + 1);
1287 node->stacktrace()->Visit(&for_stack_trace);
1288 Append(for_stack_trace);
1289 ReThrowComp* comp = new ReThrowComp(node->id(),
1290 node->token_index(),
1291 for_exception.value(),
1292 for_stack_trace.value());
1293 AddInstruction(new DoInstr(comp));
1294 }
1279 } 1295 }
1280 1296
1281 1297
1282 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { 1298 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) {
1283 Bailout("EffectGraphVisitor::VisitInlinedFinallyNode"); 1299 Bailout("EffectGraphVisitor::VisitInlinedFinallyNode");
1284 } 1300 }
1285 1301
1286 1302
1287 // Graph printing. 1303 // Graph printing.
1288 class FlowGraphPrinter : public FlowGraphVisitor { 1304 class FlowGraphPrinter : public FlowGraphVisitor {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 } 1523 }
1508 OS::Print(")"); 1524 OS::Print(")");
1509 } 1525 }
1510 1526
1511 1527
1512 void FlowGraphPrinter::VisitCreateClosure(CreateClosureComp* comp) { 1528 void FlowGraphPrinter::VisitCreateClosure(CreateClosureComp* comp) {
1513 OS::Print("CreateClosure(%s)", comp->function().ToCString()); 1529 OS::Print("CreateClosure(%s)", comp->function().ToCString());
1514 } 1530 }
1515 1531
1516 1532
1533 void FlowGraphPrinter::VisitThrow(ThrowComp* comp) {
1534 OS::Print("Throw(");
1535 comp->exception()->Accept(this);
1536 OS::Print(")");
1537 }
1538
1539
1540 void FlowGraphPrinter::VisitReThrow(ReThrowComp* comp) {
1541 OS::Print("ReThrow(");
1542 comp->exception()->Accept(this);
1543 OS::Print(", ");
1544 comp->stack_trace()->Accept(this);
1545 OS::Print(")");
1546 }
1547
1548
1517 void FlowGraphPrinter::VisitNativeLoadField(NativeLoadFieldComp* comp) { 1549 void FlowGraphPrinter::VisitNativeLoadField(NativeLoadFieldComp* comp) {
1518 OS::Print("NativeLoadField("); 1550 OS::Print("NativeLoadField(");
1519 comp->value()->Accept(this); 1551 comp->value()->Accept(this);
1520 OS::Print(", %d)", comp->offset_in_bytes()); 1552 OS::Print(", %d)", comp->offset_in_bytes());
1521 } 1553 }
1522 1554
1523 1555
1524 void FlowGraphPrinter::VisitExtractTypeArguments( 1556 void FlowGraphPrinter::VisitExtractTypeArguments(
1525 ExtractTypeArgumentsComp* comp) { 1557 ExtractTypeArgumentsComp* comp) {
1526 OS::Print("ExtractTypeArguments("); 1558 OS::Print("ExtractTypeArguments(");
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 char* chars = reinterpret_cast<char*>( 1641 char* chars = reinterpret_cast<char*>(
1610 Isolate::Current()->current_zone()->Allocate(len)); 1642 Isolate::Current()->current_zone()->Allocate(len));
1611 OS::SNPrint(chars, len, kFormat, function_name, reason); 1643 OS::SNPrint(chars, len, kFormat, function_name, reason);
1612 const Error& error = Error::Handle( 1644 const Error& error = Error::Handle(
1613 LanguageError::New(String::Handle(String::New(chars)))); 1645 LanguageError::New(String::Handle(String::New(chars))));
1614 Isolate::Current()->long_jump_base()->Jump(1, error); 1646 Isolate::Current()->long_jump_base()->Jump(1, error);
1615 } 1647 }
1616 1648
1617 1649
1618 } // namespace dart 1650 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698