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

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

Issue 14682020: Optimize functions containing try-catch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed checked mode tests failure Created 7 years, 7 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
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 "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6003 matching lines...) Expand 10 before | Expand all | Expand 10 after
6014 // thrown. 6014 // thrown.
6015 // :exception_var and :stacktrace_var get set with the exception object 6015 // :exception_var and :stacktrace_var get set with the exception object
6016 // and the stacktrace object when an exception is thrown. 6016 // and the stacktrace object when an exception is thrown.
6017 // These three implicit variables can never be captured variables. 6017 // These three implicit variables can never be captured variables.
6018 LocalVariable* context_var = 6018 LocalVariable* context_var =
6019 current_block_->scope->LocalLookupVariable(Symbols::SavedTryContextVar()); 6019 current_block_->scope->LocalLookupVariable(Symbols::SavedTryContextVar());
6020 if (context_var == NULL) { 6020 if (context_var == NULL) {
6021 context_var = new LocalVariable(TokenPos(), 6021 context_var = new LocalVariable(TokenPos(),
6022 Symbols::SavedTryContextVar(), 6022 Symbols::SavedTryContextVar(),
6023 Type::ZoneHandle(Type::DynamicType())); 6023 Type::ZoneHandle(Type::DynamicType()));
6024 context_var->mark_as_always_live();
6024 current_block_->scope->AddVariable(context_var); 6025 current_block_->scope->AddVariable(context_var);
6025 } 6026 }
6026 LocalVariable* catch_excp_var = 6027 LocalVariable* catch_excp_var =
6027 current_block_->scope->LocalLookupVariable(Symbols::ExceptionVar()); 6028 current_block_->scope->LocalLookupVariable(Symbols::ExceptionVar());
6028 if (catch_excp_var == NULL) { 6029 if (catch_excp_var == NULL) {
6029 catch_excp_var = new LocalVariable(TokenPos(), 6030 catch_excp_var = new LocalVariable(TokenPos(),
6030 Symbols::ExceptionVar(), 6031 Symbols::ExceptionVar(),
6031 Type::ZoneHandle(Type::DynamicType())); 6032 Type::ZoneHandle(Type::DynamicType()));
6033 catch_excp_var->mark_as_always_live();
6032 current_block_->scope->AddVariable(catch_excp_var); 6034 current_block_->scope->AddVariable(catch_excp_var);
6033 } 6035 }
6034 LocalVariable* catch_trace_var = 6036 LocalVariable* catch_trace_var =
6035 current_block_->scope->LocalLookupVariable(Symbols::StacktraceVar()); 6037 current_block_->scope->LocalLookupVariable(Symbols::StacktraceVar());
6036 if (catch_trace_var == NULL) { 6038 if (catch_trace_var == NULL) {
6037 catch_trace_var = new LocalVariable(TokenPos(), 6039 catch_trace_var = new LocalVariable(TokenPos(),
6038 Symbols::StacktraceVar(), 6040 Symbols::StacktraceVar(),
6039 Type::ZoneHandle(Type::DynamicType())); 6041 Type::ZoneHandle(Type::DynamicType()));
6042 catch_trace_var->mark_as_always_live();
6040 current_block_->scope->AddVariable(catch_trace_var); 6043 current_block_->scope->AddVariable(catch_trace_var);
6041 } 6044 }
6042 6045
6043 const intptr_t try_pos = TokenPos(); 6046 const intptr_t try_pos = TokenPos();
6044 ConsumeToken(); // Consume the 'try'. 6047 ConsumeToken(); // Consume the 'try'.
6045 6048
6046 SourceLabel* try_label = NULL; 6049 SourceLabel* try_label = NULL;
6047 if (label_name != NULL) { 6050 if (label_name != NULL) {
6048 try_label = SourceLabel::New(try_pos, label_name, SourceLabel::kStatement); 6051 try_label = SourceLabel::New(try_pos, label_name, SourceLabel::kStatement);
6049 OpenBlock(); 6052 OpenBlock();
(...skipping 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after
9954 void Parser::SkipQualIdent() { 9957 void Parser::SkipQualIdent() {
9955 ASSERT(IsIdentifier()); 9958 ASSERT(IsIdentifier());
9956 ConsumeToken(); 9959 ConsumeToken();
9957 if (CurrentToken() == Token::kPERIOD) { 9960 if (CurrentToken() == Token::kPERIOD) {
9958 ConsumeToken(); // Consume the kPERIOD token. 9961 ConsumeToken(); // Consume the kPERIOD token.
9959 ExpectIdentifier("identifier expected after '.'"); 9962 ExpectIdentifier("identifier expected after '.'");
9960 } 9963 }
9961 } 9964 }
9962 9965
9963 } // namespace dart 9966 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698