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

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

Issue 23441073: Implement closurization of regular methods in ObjectMirror.getField in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 7 years, 2 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/lib/mirrors_impl.dart ('k') | runtime/vm/object.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) 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/code_descriptors.h" 10 #include "vm/code_descriptors.h"
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 } 2022 }
2023 ReturnDefinition(ExitTempLocalScope(tmp_var)); 2023 ReturnDefinition(ExitTempLocalScope(tmp_var));
2024 } 2024 }
2025 } 2025 }
2026 2026
2027 2027
2028 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { 2028 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) {
2029 const Function& function = node->function(); 2029 const Function& function = node->function();
2030 2030
2031 if (function.IsImplicitStaticClosureFunction()) { 2031 if (function.IsImplicitStaticClosureFunction()) {
2032 Instance& closure = Instance::ZoneHandle(); 2032 const Instance& closure =
2033 closure ^= function.implicit_static_closure(); 2033 Instance::ZoneHandle(function.ImplicitStaticClosure());
2034 if (closure.IsNull()) {
2035 ObjectStore* object_store = Isolate::Current()->object_store();
2036 const Context& context = Context::Handle(object_store->empty_context());
2037 closure ^= Closure::New(function, context, Heap::kOld);
2038 function.set_implicit_static_closure(closure);
2039 }
2040 ReturnDefinition(new ConstantInstr(closure)); 2034 ReturnDefinition(new ConstantInstr(closure));
2041 return; 2035 return;
2042 } 2036 }
2043 if (function.IsNonImplicitClosureFunction()) { 2037 if (function.IsNonImplicitClosureFunction()) {
2044 // The context scope may have already been set by the non-optimizing 2038 // The context scope may have already been set by the non-optimizing
2045 // compiler. If it was not, set it here. 2039 // compiler. If it was not, set it here.
2046 if (function.context_scope() == ContextScope::null()) { 2040 if (function.context_scope() == ContextScope::null()) {
2047 // TODO(regis): Why are we not doing this in the parser? 2041 // TODO(regis): Why are we not doing this in the parser?
2048 const ContextScope& context_scope = ContextScope::ZoneHandle( 2042 const ContextScope& context_scope = ContextScope::ZoneHandle(
2049 node->scope()->PreserveOuterScope(owner()->context_level())); 2043 node->scope()->PreserveOuterScope(owner()->context_level()));
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
3826 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3820 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3827 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3821 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3828 OS::SNPrint(chars, len, kFormat, function_name, reason); 3822 OS::SNPrint(chars, len, kFormat, function_name, reason);
3829 const Error& error = Error::Handle( 3823 const Error& error = Error::Handle(
3830 LanguageError::New(String::Handle(String::New(chars)))); 3824 LanguageError::New(String::Handle(String::New(chars))));
3831 Isolate::Current()->long_jump_base()->Jump(1, error); 3825 Isolate::Current()->long_jump_base()->Jump(1, error);
3832 } 3826 }
3833 3827
3834 3828
3835 } // namespace dart 3829 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698