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

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

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 | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.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 #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 22 matching lines...) Expand all
33 // | InstanceSetter <String> <Value> <Value> 33 // | InstanceSetter <String> <Value> <Value>
34 // | LoadInstanceField <LoadInstanceFieldNode> <Value> 34 // | LoadInstanceField <LoadInstanceFieldNode> <Value>
35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value> 35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
36 // | LoadStaticField <Field> 36 // | LoadStaticField <Field>
37 // | StoreStaticField <Field> <Value> 37 // | StoreStaticField <Field> <Value>
38 // | BooleanNegate <Value> 38 // | BooleanNegate <Value>
39 // | InstanceOf <Value> <Type> 39 // | InstanceOf <Value> <Type>
40 // | CreateArray <ArrayNode> <Value> ... 40 // | CreateArray <ArrayNode> <Value> ...
41 // | CreateClosure <ClosureNode> 41 // | CreateClosure <ClosureNode>
42 // | AllocateObject <ConstructorCallNode> 42 // | AllocateObject <ConstructorCallNode>
43 // | Throw <Value>
44 // | ReThrow <Value> <Value>
43 // | NativeLoadField <Value> <intptr_t> 45 // | NativeLoadField <Value> <intptr_t>
44 // | ExtractTypeArgumentsComp <ConstructorCallNode> <Value> 46 // | ExtractTypeArgumentsComp <ConstructorCallNode> <Value>
45 // 47 //
46 // <Value> ::= 48 // <Value> ::=
47 // Temp <int> 49 // Temp <int>
48 // | Constant <Instance> 50 // | Constant <Instance>
49 51
50 // M is a two argument macro. It is applied to each concrete value's 52 // M is a two argument macro. It is applied to each concrete value's
51 // typename and classname. 53 // typename and classname.
52 #define FOR_EACH_VALUE(M) \ 54 #define FOR_EACH_VALUE(M) \
(...skipping 18 matching lines...) Expand all
71 M(InstanceSetter, InstanceSetterComp) \ 73 M(InstanceSetter, InstanceSetterComp) \
72 M(LoadInstanceField, LoadInstanceFieldComp) \ 74 M(LoadInstanceField, LoadInstanceFieldComp) \
73 M(StoreInstanceField, StoreInstanceFieldComp) \ 75 M(StoreInstanceField, StoreInstanceFieldComp) \
74 M(LoadStaticField, LoadStaticFieldComp) \ 76 M(LoadStaticField, LoadStaticFieldComp) \
75 M(StoreStaticField, StoreStaticFieldComp) \ 77 M(StoreStaticField, StoreStaticFieldComp) \
76 M(BooleanNegate, BooleanNegateComp) \ 78 M(BooleanNegate, BooleanNegateComp) \
77 M(InstanceOf, InstanceOfComp) \ 79 M(InstanceOf, InstanceOfComp) \
78 M(CreateArray, CreateArrayComp) \ 80 M(CreateArray, CreateArrayComp) \
79 M(CreateClosure, CreateClosureComp) \ 81 M(CreateClosure, CreateClosureComp) \
80 M(AllocateObject, AllocateObjectComp) \ 82 M(AllocateObject, AllocateObjectComp) \
83 M(Throw, ThrowComp) \
84 M(ReThrow, ReThrowComp) \
81 M(NativeLoadField, NativeLoadFieldComp) \ 85 M(NativeLoadField, NativeLoadFieldComp) \
82 M(ExtractTypeArguments, ExtractTypeArgumentsComp) \ 86 M(ExtractTypeArguments, ExtractTypeArgumentsComp) \
83 87
84 88
85 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 89 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
86 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 90 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
87 #undef FORWARD_DECLARATION 91 #undef FORWARD_DECLARATION
88 92
89 class Computation : public ZoneAllocated { 93 class Computation : public ZoneAllocated {
90 public: 94 public:
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 intptr_t token_index() const { return ast_node_.token_index(); } 636 intptr_t token_index() const { return ast_node_.token_index(); }
633 const Function& function() const { return ast_node_.function(); } 637 const Function& function() const { return ast_node_.function(); }
634 638
635 private: 639 private:
636 const ClosureNode& ast_node_; 640 const ClosureNode& ast_node_;
637 641
638 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); 642 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp);
639 }; 643 };
640 644
641 645
646 class ThrowComp : public Computation {
647 public:
648 explicit ThrowComp(intptr_t node_id,
649 intptr_t token_index,
650 Value* exception)
651 : node_id_(node_id), token_index_(token_index), exception_(exception) {
652 ASSERT(exception_ != NULL);
653 }
654
655 DECLARE_COMPUTATION(Throw)
656
657 intptr_t node_id() const { return node_id_; }
658 intptr_t token_index() const { return token_index_; }
659 Value* exception() const { return exception_; }
660
661 private:
662 intptr_t node_id_;
663 intptr_t token_index_;
664 Value* exception_;
665
666 DISALLOW_COPY_AND_ASSIGN(ThrowComp);
667 };
668
669
670 class ReThrowComp : public Computation {
671 public:
672 ReThrowComp(intptr_t node_id,
673 intptr_t token_index,
674 Value* exception,
675 Value* stack_trace)
676 : node_id_(node_id),
677 token_index_(token_index),
678 exception_(exception),
679 stack_trace_(stack_trace) {
680 ASSERT(exception_ != NULL);
681 ASSERT(stack_trace_ != NULL);
682 }
683
684 DECLARE_COMPUTATION(ReThrow)
685
686 intptr_t node_id() const { return node_id_; }
687 intptr_t token_index() const { return token_index_; }
688 Value* exception() const { return exception_; }
689 Value* stack_trace() const { return stack_trace_; }
690
691 private:
692 intptr_t node_id_;
693 intptr_t token_index_;
694 Value* exception_;
695 Value* stack_trace_;
696
697 DISALLOW_COPY_AND_ASSIGN(ReThrowComp);
698 };
699
700
642 class NativeLoadFieldComp : public Computation { 701 class NativeLoadFieldComp : public Computation {
643 public: 702 public:
644 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes) 703 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes)
645 : value_(value), offset_in_bytes_(offset_in_bytes) { 704 : value_(value), offset_in_bytes_(offset_in_bytes) {
646 ASSERT(value != NULL); 705 ASSERT(value != NULL);
647 } 706 }
648 707
649 DECLARE_COMPUTATION(NativeLoadFieldComp) 708 DECLARE_COMPUTATION(NativeLoadFieldComp)
650 709
651 Value* value() const { return value_; } 710 Value* value() const { return value_; }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 #undef DECLARE_VISIT_INSTRUCTION 1085 #undef DECLARE_VISIT_INSTRUCTION
1027 1086
1028 private: 1087 private:
1029 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1088 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1030 }; 1089 };
1031 1090
1032 1091
1033 } // namespace dart 1092 } // namespace dart
1034 1093
1035 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1094 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698