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

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

Issue 9586024: Add Load/Store Static/Instance fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « no previous file | runtime/vm/flow_graph_compiler_x64.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 "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 value = new TempVal(temp_index()); 536 value = new TempVal(temp_index());
537 } 537 }
538 538
539 StoreLocalComp* store = new StoreLocalComp(node->local(), value); 539 StoreLocalComp* store = new StoreLocalComp(node->local(), value);
540 ReturnComputation(store); 540 ReturnComputation(store);
541 } 541 }
542 542
543 543
544 void EffectGraphVisitor::VisitLoadInstanceFieldNode( 544 void EffectGraphVisitor::VisitLoadInstanceFieldNode(
545 LoadInstanceFieldNode* node) { 545 LoadInstanceFieldNode* node) {
546 Bailout("EffectGraphVisitor::VisitLoadInstanceFieldNode"); 546 ValueGraphVisitor for_instance(owner(), temp_index());
547 node->instance()->Visit(&for_instance);
548 Append(for_instance);
549 LoadInstanceFieldComp* load =
550 new LoadInstanceFieldComp(node, for_instance.value());
551 ReturnComputation(load);
547 } 552 }
548 553
549 554
550 void EffectGraphVisitor::VisitStoreInstanceFieldNode( 555 void EffectGraphVisitor::VisitStoreInstanceFieldNode(
551 StoreInstanceFieldNode* node) { 556 StoreInstanceFieldNode* node) {
552 Bailout("EffectGraphVisitor::VisitStoreInstanceFieldNode"); 557 ValueGraphVisitor for_instance(owner(), temp_index());
558 node->instance()->Visit(&for_instance);
559 Append(for_instance);
560 ValueGraphVisitor for_value(owner(), for_instance.temp_index());
561 node->value()->Visit(&for_value);
562 Append(for_value);
563 Value* store_value = for_value.value();
564 if (FLAG_enable_type_checks) {
565 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
566 AssertAssignableComp* assert = new AssertAssignableComp(store_value, type);
567 AddInstruction(new BindInstr(temp_index(), assert));
568 store_value = new TempVal(temp_index());
569 }
570 StoreInstanceFieldComp* store =
571 new StoreInstanceFieldComp(node, for_instance.value(), store_value);
572 ReturnComputation(store);
553 } 573 }
554 574
555 575
556 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { 576 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) {
557 Bailout("EffectGraphVisitor::VisitLoadStaticFieldNode"); 577 LoadStaticFieldComp* load = new LoadStaticFieldComp(node->field());
578 ReturnComputation(load);
558 } 579 }
559 580
560 581
561 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { 582 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) {
562 Bailout("EffectGraphVisitor::VisitStoreStaticFieldNode"); 583 ValueGraphVisitor for_value(owner(), temp_index());
584 node->value()->Visit(&for_value);
585 Append(for_value);
586 Value* store_value = for_value.value();
587 if (FLAG_enable_type_checks) {
588 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
589 AssertAssignableComp* assert = new AssertAssignableComp(store_value, type);
590 AddInstruction(new BindInstr(temp_index(), assert));
591 store_value = new TempVal(temp_index());
592 }
593 StoreStaticFieldComp* store =
594 new StoreStaticFieldComp(node, for_value.value());
595 ReturnComputation(store);
563 } 596 }
564 597
565 598
566 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { 599 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
567 ArgumentGraphVisitor for_array(owner(), temp_index()); 600 ArgumentGraphVisitor for_array(owner(), temp_index());
568 node->array()->Visit(&for_array); 601 node->array()->Visit(&for_array);
569 Append(for_array); 602 Append(for_array);
570 ArgumentGraphVisitor for_index(owner(), for_array.temp_index()); 603 ArgumentGraphVisitor for_index(owner(), for_array.temp_index());
571 node->index_expr()->Visit(&for_index); 604 node->index_expr()->Visit(&for_index);
572 Append(for_index); 605 Append(for_index);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 comp->value()->Accept(this); 782 comp->value()->Accept(this);
750 OS::Print(")"); 783 OS::Print(")");
751 } 784 }
752 785
753 786
754 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) { 787 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) {
755 OS::Print("NativeCall(%s)", comp->native_name().ToCString()); 788 OS::Print("NativeCall(%s)", comp->native_name().ToCString());
756 } 789 }
757 790
758 791
792 void FlowGraphPrinter::VisitLoadInstanceField(LoadInstanceFieldComp* comp) {
793 OS::Print("LoadInstanceField(%s, ",
794 String::Handle(comp->field().name()).ToCString());
795 comp->instance()->Accept(this);
796 OS::Print(")");
797 }
798
799
800 void FlowGraphPrinter::VisitStoreInstanceField(StoreInstanceFieldComp* comp) {
801 OS::Print("StoreInstanceField(%s, ",
802 String::Handle(comp->field().name()).ToCString());
803 comp->instance()->Accept(this);
804 OS::Print(", ");
805 comp->value()->Accept(this);
806 OS::Print(")");
807 }
808
809
810 void FlowGraphPrinter::VisitLoadStaticField(LoadStaticFieldComp* comp) {
811 OS::Print("LoadStaticField(%s)",
812 String::Handle(comp->field().name()).ToCString());
813 }
814
815
816 void FlowGraphPrinter::VisitStoreStaticField(StoreStaticFieldComp* comp) {
817 OS::Print("StoreStaticField(%s, ",
818 String::Handle(comp->field().name()).ToCString());
819 comp->value()->Accept(this);
820 OS::Print(")");
821 }
822
823
759 void FlowGraphPrinter::VisitStoreIndexed(StoreIndexedComp* comp) { 824 void FlowGraphPrinter::VisitStoreIndexed(StoreIndexedComp* comp) {
760 OS::Print("StoreIndexed("); 825 OS::Print("StoreIndexed(");
761 comp->array()->Accept(this); 826 comp->array()->Accept(this);
762 OS::Print(", "); 827 OS::Print(", ");
763 comp->index()->Accept(this); 828 comp->index()->Accept(this);
764 OS::Print(", "); 829 OS::Print(", ");
765 comp->value()->Accept(this); 830 comp->value()->Accept(this);
766 OS::Print(")"); 831 OS::Print(")");
767 } 832 }
768 833
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 char* chars = reinterpret_cast<char*>( 906 char* chars = reinterpret_cast<char*>(
842 Isolate::Current()->current_zone()->Allocate(len)); 907 Isolate::Current()->current_zone()->Allocate(len));
843 OS::SNPrint(chars, len, kFormat, function_name, reason); 908 OS::SNPrint(chars, len, kFormat, function_name, reason);
844 const Error& error = Error::Handle( 909 const Error& error = Error::Handle(
845 LanguageError::New(String::Handle(String::New(chars)))); 910 LanguageError::New(String::Handle(String::New(chars))));
846 Isolate::Current()->long_jump_base()->Jump(1, error); 911 Isolate::Current()->long_jump_base()->Jump(1, error);
847 } 912 }
848 913
849 914
850 } // namespace dart 915 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698