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

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

Issue 2718353002: Revert "Track the 'awaiter return' call stack..." (Closed)
Patch Set: Created 3 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
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/code_descriptors.h » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/ast_transformer.h" 5 #include "vm/ast_transformer.h"
6 6
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/parser.h" 8 #include "vm/parser.h"
9 #include "vm/thread.h" 9 #include "vm/thread.h"
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 } 130 }
131 131
132 132
133 void AwaitTransformer::VisitAwaitNode(AwaitNode* node) { 133 void AwaitTransformer::VisitAwaitNode(AwaitNode* node) {
134 // Await transformation: 134 // Await transformation:
135 // 135 //
136 // :await_temp_var_X = <expr>; 136 // :await_temp_var_X = <expr>;
137 // AwaitMarker(kNewContinuationState); 137 // AwaitMarker(kNewContinuationState);
138 // :result_param = _awaitHelper( 138 // :result_param = _awaitHelper(
139 // :await_temp_var_X, 139 // :await_temp_var_X, :async_then_callback, :async_catch_error_callback);
140 // :async_then_callback,
141 // :async_catch_error_callback,
142 // :async_op);
143 // return; // (return_type() == kContinuationTarget) 140 // return; // (return_type() == kContinuationTarget)
144 // 141 //
145 // :saved_try_ctx_var = :await_saved_try_ctx_var_y; 142 // :saved_try_ctx_var = :await_saved_try_ctx_var_y;
146 // :await_temp_var_(X+1) = :result_param; 143 // :await_temp_var_(X+1) = :result_param;
147 144
148 const TokenPosition token_pos = ST(node->token_pos()); 145 const TokenPosition token_pos = ST(node->token_pos());
149 LocalVariable* async_op = 146 LocalVariable* async_op =
150 GetVariableInScope(preamble_->scope(), Symbols::AsyncOperation()); 147 GetVariableInScope(preamble_->scope(), Symbols::AsyncOperation());
151 LocalVariable* async_then_callback = 148 LocalVariable* async_then_callback =
152 GetVariableInScope(preamble_->scope(), Symbols::AsyncThenCallback()); 149 GetVariableInScope(preamble_->scope(), Symbols::AsyncThenCallback());
153 LocalVariable* async_catch_error_callback = GetVariableInScope( 150 LocalVariable* async_catch_error_callback = GetVariableInScope(
154 preamble_->scope(), Symbols::AsyncCatchErrorCallback()); 151 preamble_->scope(), Symbols::AsyncCatchErrorCallback());
155 LocalVariable* result_param = 152 LocalVariable* result_param =
156 GetVariableInScope(preamble_->scope(), Symbols::AsyncOperationParam()); 153 GetVariableInScope(preamble_->scope(), Symbols::AsyncOperationParam());
157 LocalVariable* error_param = GetVariableInScope( 154 LocalVariable* error_param = GetVariableInScope(
158 preamble_->scope(), Symbols::AsyncOperationErrorParam()); 155 preamble_->scope(), Symbols::AsyncOperationErrorParam());
159 LocalVariable* stack_trace_param = GetVariableInScope( 156 LocalVariable* stack_trace_param = GetVariableInScope(
160 preamble_->scope(), Symbols::AsyncOperationStackTraceParam()); 157 preamble_->scope(), Symbols::AsyncOperationStackTraceParam());
161 158
162 AstNode* transformed_expr = Transform(node->expr()); 159 AstNode* transformed_expr = Transform(node->expr());
163 LocalVariable* await_temp = 160 LocalVariable* await_temp =
164 AddNewTempVarToPreamble(transformed_expr, ST(node->token_pos())); 161 AddNewTempVarToPreamble(transformed_expr, ST(node->token_pos()));
165 162
166 AwaitMarkerNode* await_marker = 163 AwaitMarkerNode* await_marker =
167 new (Z) AwaitMarkerNode(async_temp_scope_, node->scope(), token_pos); 164 new (Z) AwaitMarkerNode(async_temp_scope_, node->scope(), token_pos);
168 preamble_->Add(await_marker); 165 preamble_->Add(await_marker);
169 166
170 // :result_param = _awaitHelper( 167 // :result_param = _awaitHelper(
171 // :await_temp, 168 // :await_temp, :async_then_callback, :async_catch_error_callback)
172 // :async_then_callback,
173 // :async_catch_error_callback,
174 // :async_op)
175 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); 169 const Library& async_lib = Library::Handle(Library::AsyncLibrary());
176 const Function& async_await_helper = Function::ZoneHandle( 170 const Function& async_await_helper = Function::ZoneHandle(
177 Z, async_lib.LookupFunctionAllowPrivate(Symbols::AsyncAwaitHelper())); 171 Z, async_lib.LookupFunctionAllowPrivate(Symbols::AsyncAwaitHelper()));
178 ASSERT(!async_await_helper.IsNull()); 172 ASSERT(!async_await_helper.IsNull());
179 ArgumentListNode* async_await_helper_args = 173 ArgumentListNode* async_await_helper_args =
180 new (Z) ArgumentListNode(token_pos); 174 new (Z) ArgumentListNode(token_pos);
181 async_await_helper_args->Add(new (Z) LoadLocalNode(token_pos, await_temp)); 175 async_await_helper_args->Add(new (Z) LoadLocalNode(token_pos, await_temp));
182 async_await_helper_args->Add( 176 async_await_helper_args->Add(
183 new (Z) LoadLocalNode(token_pos, async_then_callback)); 177 new (Z) LoadLocalNode(token_pos, async_then_callback));
184 async_await_helper_args->Add( 178 async_await_helper_args->Add(
185 new (Z) LoadLocalNode(token_pos, async_catch_error_callback)); 179 new (Z) LoadLocalNode(token_pos, async_catch_error_callback));
186 async_await_helper_args->Add(new (Z) LoadLocalNode(token_pos, async_op));
187 StaticCallNode* await_helper_call = new (Z) StaticCallNode( 180 StaticCallNode* await_helper_call = new (Z) StaticCallNode(
188 node->token_pos(), async_await_helper, async_await_helper_args); 181 node->token_pos(), async_await_helper, async_await_helper_args);
189 182
190 preamble_->Add( 183 preamble_->Add(
191 new (Z) StoreLocalNode(token_pos, result_param, await_helper_call)); 184 new (Z) StoreLocalNode(token_pos, result_param, await_helper_call));
192 185
193 ReturnNode* continuation_return = new (Z) ReturnNode(token_pos); 186 ReturnNode* continuation_return = new (Z) ReturnNode(token_pos);
194 continuation_return->set_return_type(ReturnNode::kContinuationTarget); 187 continuation_return->set_return_type(ReturnNode::kContinuationTarget);
195 preamble_->Add(continuation_return); 188 preamble_->Add(continuation_return);
196 189
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 514 }
522 515
523 516
524 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { 517 void AwaitTransformer::VisitThrowNode(ThrowNode* node) {
525 AstNode* new_exception = Transform(node->exception()); 518 AstNode* new_exception = Transform(node->exception());
526 result_ = MakeName( 519 result_ = MakeName(
527 new (Z) ThrowNode(node->token_pos(), new_exception, node->stacktrace())); 520 new (Z) ThrowNode(node->token_pos(), new_exception, node->stacktrace()));
528 } 521 }
529 522
530 } // namespace dart 523 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/code_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698