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

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

Issue 2776373002: Initial steps into streaming the kernel flowgraph (Closed)
Patch Set: Rebase + fix lint error Created 3 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
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 #include "vm/kernel_binary_flowgraph.h"
6
7 #if !defined(DART_PRECOMPILED_RUNTIME)
8
9 namespace dart {
10 namespace kernel {
11
12 Fragment StreamingFlowGraphBuilder::BuildAt(intptr_t kernel_offset) {
13 reader_->set_offset(kernel_offset);
14
15 uint8_t payload = 0;
16 Tag tag = reader_->ReadTag(&payload);
17 switch (tag) {
18 // case kInvalidExpression:
19 // return InvalidExpression::ReadFrom(reader_);
20 // case kVariableGet:
21 // return VariableGet::ReadFrom(reader_);
22 // case kSpecializedVariableGet:
23 // return VariableGet::ReadFrom(reader_, payload);
24 // case kVariableSet:
25 // return VariableSet::ReadFrom(reader_);
26 // case kSpecializedVariableSet:
27 // return VariableSet::ReadFrom(reader_, payload);
28 // case kPropertyGet:
29 // return PropertyGet::ReadFrom(reader_);
30 // case kPropertySet:
31 // return PropertySet::ReadFrom(reader_);
32 // case kDirectPropertyGet:
33 // return DirectPropertyGet::ReadFrom(reader_);
34 // case kDirectPropertySet:
35 // return DirectPropertySet::ReadFrom(reader_);
36 // case kStaticGet:
37 // return StaticGet::ReadFrom(reader_);
38 // case kStaticSet:
39 // return StaticSet::ReadFrom(reader_);
40 // case kMethodInvocation:
41 // return MethodInvocation::ReadFrom(reader_);
42 // case kDirectMethodInvocation:
43 // return DirectMethodInvocation::ReadFrom(reader_);
44 // case kStaticInvocation:
45 // return StaticInvocation::ReadFrom(reader_, false);
46 // case kConstStaticInvocation:
47 // return StaticInvocation::ReadFrom(reader_, true);
48 // case kConstructorInvocation:
49 // return ConstructorInvocation::ReadFrom(reader_, false);
50 // case kConstConstructorInvocation:
51 // return ConstructorInvocation::ReadFrom(reader_, true);
52 // case kNot:
53 // return Not::ReadFrom(reader_);
54 // case kLogicalExpression:
55 // return LogicalExpression::ReadFrom(reader_);
56 // case kConditionalExpression:
57 // return ConditionalExpression::ReadFrom(reader_);
58 // case kStringConcatenation:
59 // return StringConcatenation::ReadFrom(reader_);
60 // case kIsExpression:
61 // return IsExpression::ReadFrom(reader_);
62 // case kAsExpression:
63 // return AsExpression::ReadFrom(reader_);
64 // case kSymbolLiteral:
65 // return SymbolLiteral::ReadFrom(reader_);
66 // case kTypeLiteral:
67 // return TypeLiteral::ReadFrom(reader_);
68 // case kThisExpression:
69 // return ThisExpression::ReadFrom(reader_);
70 case kRethrow:
71 return BuildRethrow();
72 // case kThrow:
73 // return Throw::ReadFrom(reader_);
74 // case kListLiteral:
75 // return ListLiteral::ReadFrom(reader_, false);
76 // case kConstListLiteral:
77 // return ListLiteral::ReadFrom(reader_, true);
78 // case kMapLiteral:
79 // return MapLiteral::ReadFrom(reader_, false);
80 // case kConstMapLiteral:
81 // return MapLiteral::ReadFrom(reader_, true);
82 // case kAwaitExpression:
83 // return AwaitExpression::ReadFrom(reader_);
84 // case kFunctionExpression:
85 // return FunctionExpression::ReadFrom(reader_);
86 // case kLet:
87 // return Let::ReadFrom(reader_);
88 // case kBigIntLiteral:
89 // return BigintLiteral::ReadFrom(reader_);
90 // case kStringLiteral:
91 // return StringLiteral::ReadFrom(reader_);
92 // case kSpecialIntLiteral:
93 // return IntLiteral::ReadFrom(reader_, payload);
94 // case kNegativeIntLiteral:
95 // return IntLiteral::ReadFrom(reader_, true);
96 // case kPositiveIntLiteral:
97 // return IntLiteral::ReadFrom(reader_, false);
98 // case kDoubleLiteral:
99 // return DoubleLiteral::ReadFrom(reader_);
100 // case kTrueLiteral:
101 // return BoolLiteral::ReadFrom(reader_, true);
102 // case kFalseLiteral:
103 // return BoolLiteral::ReadFrom(reader_, false);
104 // case kNullLiteral:
105 // return NullLiteral::ReadFrom(reader_);
106 default:
107 UNREACHABLE();
108 }
109
110 return Fragment();
111 }
112
113 TokenPosition StreamingFlowGraphBuilder::ReadPosition(bool record) {
114 return reader_->ReadPosition(record);
115 }
116
117 CatchBlock* StreamingFlowGraphBuilder::catch_block() {
118 return flow_graph_builder_->catch_block_;
119 }
120
121 Fragment StreamingFlowGraphBuilder::DebugStepCheck(TokenPosition position) {
122 return flow_graph_builder_->DebugStepCheck(position);
123 }
124
125 Fragment StreamingFlowGraphBuilder::LoadLocal(LocalVariable* variable) {
126 return flow_graph_builder_->LoadLocal(variable);
127 }
128
129 Fragment StreamingFlowGraphBuilder::PushArgument() {
130 return flow_graph_builder_->PushArgument();
131 }
132
133 Fragment StreamingFlowGraphBuilder::RethrowException(TokenPosition position,
134 int catch_try_index) {
135 return flow_graph_builder_->RethrowException(position, catch_try_index);
136 }
137
138 Fragment StreamingFlowGraphBuilder::BuildRethrow() {
139 TokenPosition position = ReadPosition();
140 Fragment instructions = DebugStepCheck(position);
141 instructions += LoadLocal(catch_block()->exception_var());
142 instructions += PushArgument();
143 instructions += LoadLocal(catch_block()->stack_trace_var());
144 instructions += PushArgument();
145 instructions += RethrowException(position, catch_block()->catch_try_index());
146
147 return instructions;
148 }
149
150 } // namespace kernel
151 } // namespace dart
152
153 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698