OLD | NEW |
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 4907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 instructions = DebugStepCheck(node->position()) + instructions; | 4918 instructions = DebugStepCheck(node->position()) + instructions; |
4919 } | 4919 } |
4920 instructions += CheckVariableTypeInCheckedMode(node->variable()); | 4920 instructions += CheckVariableTypeInCheckedMode(node->variable()); |
4921 instructions += | 4921 instructions += |
4922 StoreLocal(node->position(), LookupVariable(node->variable())); | 4922 StoreLocal(node->position(), LookupVariable(node->variable())); |
4923 fragment_ = instructions; | 4923 fragment_ = instructions; |
4924 } | 4924 } |
4925 | 4925 |
4926 | 4926 |
4927 void FlowGraphBuilder::VisitStaticGet(StaticGet* node) { | 4927 void FlowGraphBuilder::VisitStaticGet(StaticGet* node) { |
4928 fragment_ = streaming_flow_graph_builder_->BuildAt(node->kernel_offset()); | 4928 if (node->kernel_offset() != -1) { |
| 4929 fragment_ = streaming_flow_graph_builder_->BuildAt(node->kernel_offset()); |
| 4930 return; |
| 4931 } |
| 4932 // A StaticGet will always have a kernel_offset, except for the StaticGet that |
| 4933 // was manually created for _getMainClosure in dart:_builtin. Compile that |
| 4934 // one specially here. |
| 4935 const dart::Library& builtin = |
| 4936 dart::Library::Handle(Z, I->object_store()->builtin_library()); |
| 4937 const Object& main = |
| 4938 Object::Handle(Z, builtin.LookupObjectAllowPrivate(dart::String::Handle( |
| 4939 Z, dart::String::New("main")))); |
| 4940 if (main.IsField()) { |
| 4941 UNIMPLEMENTED(); |
| 4942 } else if (main.IsFunction()) { |
| 4943 const Function& function = Function::Cast(main); |
| 4944 if (function.kind() == RawFunction::kRegularFunction) { |
| 4945 const Function& closure_function = |
| 4946 Function::Handle(Z, function.ImplicitClosureFunction()); |
| 4947 closure_function.set_kernel_function(function.kernel_function()); |
| 4948 const Instance& closure = |
| 4949 Instance::ZoneHandle(Z, closure_function.ImplicitStaticClosure()); |
| 4950 fragment_ = Constant(closure); |
| 4951 } else { |
| 4952 UNIMPLEMENTED(); |
| 4953 } |
| 4954 } else { |
| 4955 UNIMPLEMENTED(); |
| 4956 } |
4929 } | 4957 } |
4930 | 4958 |
4931 | 4959 |
4932 void FlowGraphBuilder::VisitStaticSet(StaticSet* node) { | 4960 void FlowGraphBuilder::VisitStaticSet(StaticSet* node) { |
4933 CanonicalName* target = node->target(); | 4961 CanonicalName* target = node->target(); |
4934 if (H.IsField(target)) { | 4962 if (H.IsField(target)) { |
4935 const dart::Field& field = | 4963 const dart::Field& field = |
4936 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target)); | 4964 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target)); |
4937 const AbstractType& dst_type = AbstractType::ZoneHandle(Z, field.type()); | 4965 const AbstractType& dst_type = AbstractType::ZoneHandle(Z, field.type()); |
4938 Fragment instructions = TranslateExpression(node->expression()); | 4966 Fragment instructions = TranslateExpression(node->expression()); |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6768 thread->clear_sticky_error(); | 6796 thread->clear_sticky_error(); |
6769 return error.raw(); | 6797 return error.raw(); |
6770 } | 6798 } |
6771 } | 6799 } |
6772 | 6800 |
6773 | 6801 |
6774 } // namespace kernel | 6802 } // namespace kernel |
6775 } // namespace dart | 6803 } // namespace dart |
6776 | 6804 |
6777 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6805 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |