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

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

Issue 2857513002: Revert "VM: [Kernel] elide parent context setup if it's empty" (Closed)
Patch Set: Created 3 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
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | no next file » | 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) 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "vm/kernel_to_il.h" 8 #include "vm/kernel_to_il.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 instructions += LoadContextAt(depth); 2304 instructions += LoadContextAt(depth);
2305 instructions += StoreLocal(TokenPosition::kNoSource, 2305 instructions += StoreLocal(TokenPosition::kNoSource,
2306 parsed_function_->current_context_var()); 2306 parsed_function_->current_context_var());
2307 instructions += Drop(); 2307 instructions += Drop();
2308 context_depth_ = depth; 2308 context_depth_ = depth;
2309 } 2309 }
2310 return instructions; 2310 return instructions;
2311 } 2311 }
2312 2312
2313 2313
2314 bool FlowGraphBuilder::HasContextScope() const {
2315 const ContextScope& context_scope =
2316 ContextScope::Handle(parsed_function_->function().context_scope());
2317 return !context_scope.IsNull() && context_scope.num_variables() > 0;
2318 }
2319
2320
2321 Fragment FlowGraphBuilder::PushContext(int size) { 2314 Fragment FlowGraphBuilder::PushContext(int size) {
2322 ASSERT(size > 0); 2315 ASSERT(size > 0);
2323 Fragment instructions = AllocateContext(size); 2316 Fragment instructions = AllocateContext(size);
2324 if (context_depth_ != 0 || HasContextScope()) { 2317 LocalVariable* context = MakeTemporary();
2325 LocalVariable* context = MakeTemporary(); 2318 instructions += LoadLocal(context);
2326 instructions += LoadLocal(context); 2319 instructions += LoadLocal(parsed_function_->current_context_var());
2327 instructions += LoadLocal(parsed_function_->current_context_var()); 2320 instructions +=
2328 instructions += 2321 StoreInstanceField(TokenPosition::kNoSource, Context::parent_offset());
2329 StoreInstanceField(TokenPosition::kNoSource, Context::parent_offset());
2330 }
2331 instructions += StoreLocal(TokenPosition::kNoSource, 2322 instructions += StoreLocal(TokenPosition::kNoSource,
2332 parsed_function_->current_context_var()); 2323 parsed_function_->current_context_var());
2333 ++context_depth_; 2324 ++context_depth_;
2334 return instructions; 2325 return instructions;
2335 } 2326 }
2336 2327
2337 2328
2338 Fragment FlowGraphBuilder::PopContext() { 2329 Fragment FlowGraphBuilder::PopContext() {
2339 return AdjustContextTo(context_depth_ - 1); 2330 return AdjustContextTo(context_depth_ - 1);
2340 } 2331 }
(...skipping 4491 matching lines...) Expand 10 before | Expand all | Expand 10 after
6832 thread->clear_sticky_error(); 6823 thread->clear_sticky_error();
6833 return error.raw(); 6824 return error.raw();
6834 } 6825 }
6835 } 6826 }
6836 6827
6837 6828
6838 } // namespace kernel 6829 } // namespace kernel
6839 } // namespace dart 6830 } // namespace dart
6840 6831
6841 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6832 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698