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

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

Issue 2794473002: Stream StaticGet (Closed)
Patch Set: Created 3 years, 8 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_binary_flowgraph.cc ('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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 instructions = DebugStepCheck(node->position()) + instructions; 4649 instructions = DebugStepCheck(node->position()) + instructions;
4650 } 4650 }
4651 instructions += CheckVariableTypeInCheckedMode(node->variable()); 4651 instructions += CheckVariableTypeInCheckedMode(node->variable());
4652 instructions += 4652 instructions +=
4653 StoreLocal(node->position(), LookupVariable(node->variable())); 4653 StoreLocal(node->position(), LookupVariable(node->variable()));
4654 fragment_ = instructions; 4654 fragment_ = instructions;
4655 } 4655 }
4656 4656
4657 4657
4658 void FlowGraphBuilder::VisitStaticGet(StaticGet* node) { 4658 void FlowGraphBuilder::VisitStaticGet(StaticGet* node) {
4659 CanonicalName* target = node->target(); 4659 fragment_ = streaming_flow_graph_builder_->BuildAt(node->kernel_offset());
4660 if (target->IsField()) {
4661 const dart::Field& field =
4662 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target));
4663 if (field.is_const()) {
4664 fragment_ = Constant(constant_evaluator_.EvaluateExpression(node));
4665 } else {
4666 const dart::Class& owner = dart::Class::Handle(Z, field.Owner());
4667 const dart::String& getter_name = H.DartGetterName(target);
4668 const Function& getter =
4669 Function::ZoneHandle(Z, owner.LookupStaticFunction(getter_name));
4670 if (getter.IsNull() || !field.has_initializer()) {
4671 Fragment instructions = Constant(field);
4672 fragment_ = instructions + LoadStaticField();
4673 } else {
4674 fragment_ = StaticCall(node->position(), getter, 0);
4675 }
4676 }
4677 } else {
4678 const Function& function =
4679 Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target));
4680
4681 if (target->IsGetter()) {
4682 fragment_ = StaticCall(node->position(), function, 0);
4683 } else if (target->IsMethod()) {
4684 fragment_ = Constant(constant_evaluator_.EvaluateExpression(node));
4685 } else {
4686 UNIMPLEMENTED();
4687 }
4688 }
4689 } 4660 }
4690 4661
4691 4662
4692 void FlowGraphBuilder::VisitStaticSet(StaticSet* node) { 4663 void FlowGraphBuilder::VisitStaticSet(StaticSet* node) {
4693 CanonicalName* target = node->target(); 4664 CanonicalName* target = node->target();
4694 if (target->IsField()) { 4665 if (target->IsField()) {
4695 const dart::Field& field = 4666 const dart::Field& field =
4696 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target)); 4667 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target));
4697 const AbstractType& dst_type = AbstractType::ZoneHandle(Z, field.type()); 4668 const AbstractType& dst_type = AbstractType::ZoneHandle(Z, field.type());
4698 Fragment instructions = TranslateExpression(node->expression()); 4669 Fragment instructions = TranslateExpression(node->expression());
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
6493 thread->clear_sticky_error(); 6464 thread->clear_sticky_error();
6494 return error.raw(); 6465 return error.raw();
6495 } 6466 }
6496 } 6467 }
6497 6468
6498 6469
6499 } // namespace kernel 6470 } // namespace kernel
6500 } // namespace dart 6471 } // namespace dart
6501 6472
6502 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6473 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698