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

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

Issue 2989493002: Simplify and fix implicit closure check, speed up Closure_equals (Closed)
Patch Set: Avoid overloaded NewClosureFunction Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/longjump.h" 8 #include "vm/longjump.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 parsed_function->SetNodeSequence( 124 parsed_function->SetNodeSequence(
125 new SequenceNode(TokenPosition::kNoSource, scope_)); 125 new SequenceNode(TokenPosition::kNoSource, scope_));
126 126
127 intptr_t parent_offset = -1; 127 intptr_t parent_offset = -1;
128 builder_->SetOffset(kernel_offset_); 128 builder_->SetOffset(kernel_offset_);
129 129
130 FunctionNodeHelper function_node_helper(builder_); 130 FunctionNodeHelper function_node_helper(builder_);
131 131
132 switch (function.kind()) { 132 switch (function.kind()) {
133 case RawFunction::kClosureFunction: 133 case RawFunction::kClosureFunction:
134 case RawFunction::kImplicitClosureFunction:
134 case RawFunction::kConvertedClosureFunction: 135 case RawFunction::kConvertedClosureFunction:
135 case RawFunction::kRegularFunction: 136 case RawFunction::kRegularFunction:
136 case RawFunction::kGetterFunction: 137 case RawFunction::kGetterFunction:
137 case RawFunction::kSetterFunction: 138 case RawFunction::kSetterFunction:
138 case RawFunction::kConstructor: { 139 case RawFunction::kConstructor: {
139 const Tag tag = builder_->PeekTag(); 140 const Tag tag = builder_->PeekTag();
140 parent_offset = builder_->ReadUntilFunctionNode(); 141 parent_offset = builder_->ReadUntilFunctionNode();
141 function_node_helper.ReadUntilExcluding( 142 function_node_helper.ReadUntilExcluding(
142 FunctionNodeHelper::kPositionalParameters); 143 FunctionNodeHelper::kPositionalParameters);
143 current_function_async_marker_ = function_node_helper.async_marker_; 144 current_function_async_marker_ = function_node_helper.async_marker_;
(...skipping 3271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3415 // will not need an AST. The code generator will assume that there is a 3416 // will not need an AST. The code generator will assume that there is a
3416 // local variable stack slot allocated for the current context and (I 3417 // local variable stack slot allocated for the current context and (I
3417 // think) that the runtime will expect it to be at a fixed offset which 3418 // think) that the runtime will expect it to be at a fixed offset which
3418 // requires allocating an unused expression temporary variable. 3419 // requires allocating an unused expression temporary variable.
3419 set_scopes(parsed_function()->EnsureKernelScopes()); 3420 set_scopes(parsed_function()->EnsureKernelScopes());
3420 3421
3421 SetOffset(kernel_offset); 3422 SetOffset(kernel_offset);
3422 3423
3423 switch (function.kind()) { 3424 switch (function.kind()) {
3424 case RawFunction::kClosureFunction: 3425 case RawFunction::kClosureFunction:
3426 case RawFunction::kImplicitClosureFunction:
3425 case RawFunction::kConvertedClosureFunction: 3427 case RawFunction::kConvertedClosureFunction:
3426 case RawFunction::kRegularFunction: 3428 case RawFunction::kRegularFunction:
3427 case RawFunction::kGetterFunction: 3429 case RawFunction::kGetterFunction:
3428 case RawFunction::kSetterFunction: { 3430 case RawFunction::kSetterFunction: {
3429 ReadUntilFunctionNode(); // read until function node. 3431 ReadUntilFunctionNode(); // read until function node.
3430 if (function.IsImplicitClosureFunction()) { 3432 if (function.IsImplicitClosureFunction()) {
3431 return BuildGraphOfImplicitClosureFunction(function); 3433 return BuildGraphOfImplicitClosureFunction(function);
3432 } else if (function.IsConvertedClosureFunction()) { 3434 } else if (function.IsConvertedClosureFunction()) {
3433 return BuildGraphOfConvertedClosureFunction(function); 3435 return BuildGraphOfConvertedClosureFunction(function);
3434 } 3436 }
(...skipping 3832 matching lines...) Expand 10 before | Expand all | Expand 10 after
7267 } 7269 }
7268 } 7270 }
7269 7271
7270 return Array::Handle(Array::null()); 7272 return Array::Handle(Array::null());
7271 } 7273 }
7272 7274
7273 } // namespace kernel 7275 } // namespace kernel
7274 } // namespace dart 7276 } // namespace dart
7275 7277
7276 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7278 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698