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

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

Issue 1020893004: Be less aggressive in sharing contexts between scopes so that sibling contexts (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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/object_test.cc ('k') | runtime/vm/parser_test.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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } else { 213 } else {
214 // Parameter i will be at fp[kFirstLocalSlotFromFp - i] and local variable 214 // Parameter i will be at fp[kFirstLocalSlotFromFp - i] and local variable
215 // j will be at fp[kFirstLocalSlotFromFp - num_params - j]. 215 // j will be at fp[kFirstLocalSlotFromFp - num_params - j].
216 first_parameter_index_ = kFirstLocalSlotFromFp; 216 first_parameter_index_ = kFirstLocalSlotFromFp;
217 first_stack_local_index_ = first_parameter_index_ - num_params; 217 first_stack_local_index_ = first_parameter_index_ - num_params;
218 num_copied_params_ = num_params; 218 num_copied_params_ = num_params;
219 } 219 }
220 220
221 // Allocate parameters and local variables, either in the local frame or 221 // Allocate parameters and local variables, either in the local frame or
222 // in the context(s). 222 // in the context(s).
223 LocalScope* context_owner = NULL; // No context needed yet.
224 bool found_captured_variables = false; 223 bool found_captured_variables = false;
225 int next_free_frame_index = 224 int next_free_frame_index =
226 scope->AllocateVariables(first_parameter_index_, 225 scope->AllocateVariables(first_parameter_index_,
227 num_params, 226 num_params,
228 first_stack_local_index_, 227 first_stack_local_index_,
229 scope, 228 NULL,
230 &context_owner,
231 &found_captured_variables); 229 &found_captured_variables);
232 230
233 // Frame indices are relative to the frame pointer and are decreasing. 231 // Frame indices are relative to the frame pointer and are decreasing.
234 ASSERT(next_free_frame_index <= first_stack_local_index_); 232 ASSERT(next_free_frame_index <= first_stack_local_index_);
235 num_stack_locals_ = first_stack_local_index_ - next_free_frame_index; 233 num_stack_locals_ = first_stack_local_index_ - next_free_frame_index;
236 } 234 }
237 235
238 236
239 struct CatchParamDesc { 237 struct CatchParamDesc {
240 CatchParamDesc() 238 CatchParamDesc()
(...skipping 9163 matching lines...) Expand 10 before | Expand all | Expand 10 after
9404 9402
9405 9403
9406 // if (:controller.add[Stream](expr)) { 9404 // if (:controller.add[Stream](expr)) {
9407 // return; 9405 // return;
9408 // } 9406 // }
9409 // await_marker; 9407 // await_marker;
9410 // continuation_return; 9408 // continuation_return;
9411 // restore saved_try_context 9409 // restore saved_try_context
9412 9410
9413 SequenceNode* true_branch = 9411 SequenceNode* true_branch =
9414 new(Z) SequenceNode(Scanner::kNoSourcePos, current_block_->scope); 9412 new(Z) SequenceNode(Scanner::kNoSourcePos, NULL);
9415 AstNode* return_from_generator = new(Z) ReturnNode(yield_pos); 9413 AstNode* return_from_generator = new(Z) ReturnNode(yield_pos);
9416 true_branch->Add(return_from_generator); 9414 true_branch->Add(return_from_generator);
9417 AddNodeForFinallyInlining(return_from_generator); 9415 AddNodeForFinallyInlining(return_from_generator);
9418 AstNode* if_is_cancelled = 9416 AstNode* if_is_cancelled =
9419 new(Z) IfNode(Scanner::kNoSourcePos, add_call, true_branch, NULL); 9417 new(Z) IfNode(Scanner::kNoSourcePos, add_call, true_branch, NULL);
9420 yield->AddNode(if_is_cancelled); 9418 yield->AddNode(if_is_cancelled);
9421 9419
9422 AwaitMarkerNode* await_marker = new(Z) AwaitMarkerNode(); 9420 AwaitMarkerNode* await_marker = new(Z) AwaitMarkerNode();
9423 await_marker->set_scope(current_block_->scope); 9421 await_marker->set_scope(current_block_->scope);
9424 yield->AddNode(await_marker); 9422 yield->AddNode(await_marker);
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after
13223 void Parser::SkipQualIdent() { 13221 void Parser::SkipQualIdent() {
13224 ASSERT(IsIdentifier()); 13222 ASSERT(IsIdentifier());
13225 ConsumeToken(); 13223 ConsumeToken();
13226 if (CurrentToken() == Token::kPERIOD) { 13224 if (CurrentToken() == Token::kPERIOD) {
13227 ConsumeToken(); // Consume the kPERIOD token. 13225 ConsumeToken(); // Consume the kPERIOD token.
13228 ExpectIdentifier("identifier expected after '.'"); 13226 ExpectIdentifier("identifier expected after '.'");
13229 } 13227 }
13230 } 13228 }
13231 13229
13232 } // namespace dart 13230 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/parser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698