OLD | NEW |
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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 } | 2021 } |
2022 ReturnDefinition(ExitTempLocalScope(tmp_var)); | 2022 ReturnDefinition(ExitTempLocalScope(tmp_var)); |
2023 } | 2023 } |
2024 } | 2024 } |
2025 | 2025 |
2026 | 2026 |
2027 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 2027 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
2028 const Function& function = node->function(); | 2028 const Function& function = node->function(); |
2029 | 2029 |
2030 if (function.IsImplicitStaticClosureFunction()) { | 2030 if (function.IsImplicitStaticClosureFunction()) { |
2031 Instance& closure = Instance::ZoneHandle(); | 2031 /* Instance& closure = Instance::ZoneHandle(); |
2032 closure ^= function.implicit_static_closure(); | 2032 closure ^= function.implicit_static_closure(); |
2033 if (closure.IsNull()) { | 2033 if (closure.IsNull()) { |
2034 ObjectStore* object_store = Isolate::Current()->object_store(); | 2034 ObjectStore* object_store = Isolate::Current()->object_store(); |
2035 const Context& context = Context::Handle(object_store->empty_context()); | 2035 const Context& context = Context::Handle(object_store->empty_context()); |
2036 closure ^= Closure::New(function, context, Heap::kOld); | 2036 closure ^= Closure::New(function, context, Heap::kOld); |
2037 function.set_implicit_static_closure(closure); | 2037 function.set_implicit_static_closure(closure); |
2038 } | 2038 } |
2039 ReturnDefinition(new ConstantInstr(closure)); | 2039 ReturnDefinition(new ConstantInstr(closure)); |
| 2040 */ |
| 2041 const Instance& closure = |
| 2042 Instance::ZoneHandle(function.ImplicitStaticClosure()); |
| 2043 ReturnDefinition(new ConstantInstr(closure)); |
2040 return; | 2044 return; |
2041 } | 2045 } |
2042 if (function.IsNonImplicitClosureFunction()) { | 2046 if (function.IsNonImplicitClosureFunction()) { |
2043 // The context scope may have already been set by the non-optimizing | 2047 // The context scope may have already been set by the non-optimizing |
2044 // compiler. If it was not, set it here. | 2048 // compiler. If it was not, set it here. |
2045 if (function.context_scope() == ContextScope::null()) { | 2049 if (function.context_scope() == ContextScope::null()) { |
2046 // TODO(regis): Why are we not doing this in the parser? | 2050 // TODO(regis): Why are we not doing this in the parser? |
2047 const ContextScope& context_scope = ContextScope::ZoneHandle( | 2051 const ContextScope& context_scope = ContextScope::ZoneHandle( |
2048 node->scope()->PreserveOuterScope(owner()->context_level())); | 2052 node->scope()->PreserveOuterScope(owner()->context_level())); |
2049 ASSERT(!function.HasCode()); | 2053 ASSERT(!function.HasCode()); |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3818 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
3815 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3819 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
3816 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3820 OS::SNPrint(chars, len, kFormat, function_name, reason); |
3817 const Error& error = Error::Handle( | 3821 const Error& error = Error::Handle( |
3818 LanguageError::New(String::Handle(String::New(chars)))); | 3822 LanguageError::New(String::Handle(String::New(chars)))); |
3819 Isolate::Current()->long_jump_base()->Jump(1, error); | 3823 Isolate::Current()->long_jump_base()->Jump(1, error); |
3820 } | 3824 } |
3821 | 3825 |
3822 | 3826 |
3823 } // namespace dart | 3827 } // namespace dart |
OLD | NEW |