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

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
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 value = new TempVal(temp_index()); 541 value = new TempVal(temp_index());
542 } 542 }
543 543
544 StoreLocalComp* store = new StoreLocalComp(node->local(), value); 544 StoreLocalComp* store = new StoreLocalComp(node->local(), value);
545 ReturnComputation(store); 545 ReturnComputation(store);
546 } 546 }
547 547
548 548
549 void EffectGraphVisitor::VisitLoadInstanceFieldNode( 549 void EffectGraphVisitor::VisitLoadInstanceFieldNode(
550 LoadInstanceFieldNode* node) { 550 LoadInstanceFieldNode* node) {
551 Bailout("EffectGraphVisitor::VisitLoadInstanceFieldNode"); 551 ValueGraphVisitor for_instance(owner(), temp_index());
552 node->instance()->Visit(&for_instance);
553 Append(for_instance);
554 LoadInstanceFieldComp* load =
555 new LoadInstanceFieldComp(node, for_instance.value());
556 ReturnComputation(load);
552 } 557 }
553 558
554 559
555 void EffectGraphVisitor::VisitStoreInstanceFieldNode( 560 void EffectGraphVisitor::VisitStoreInstanceFieldNode(
556 StoreInstanceFieldNode* node) { 561 StoreInstanceFieldNode* node) {
557 Bailout("EffectGraphVisitor::VisitStoreInstanceFieldNode"); 562 ValueGraphVisitor for_instance(owner(), temp_index());
563 node->instance()->Visit(&for_instance);
564 Append(for_instance);
565 ValueGraphVisitor for_value(owner(), temp_index());
Kevin Millikin (Google) 2012/03/05 11:02:41 Second argument should be for_instance.temp_index(
srdjan 2012/03/05 18:35:21 Done.
566 node->value()->Visit(&for_value);
567 Append(for_value);
568 StoreInstanceFieldComp* store =
569 new StoreInstanceFieldComp(node, for_instance.value(), for_value.value());
570 ReturnComputation(store);
558 } 571 }
559 572
560 573
561 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { 574 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) {
562 Bailout("EffectGraphVisitor::VisitLoadStaticFieldNode"); 575 LoadStaticFieldComp* load = new LoadStaticFieldComp(node->field());
576 ReturnComputation(load);
563 } 577 }
564 578
565 579
566 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { 580 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) {
567 Bailout("EffectGraphVisitor::VisitStoreStaticFieldNode"); 581 ValueGraphVisitor for_value(owner(), temp_index());
582 node->value()->Visit(&for_value);
583 Append(for_value);
584 StoreStaticFieldComp* store =
585 new StoreStaticFieldComp(node, for_value.value());
586 ReturnComputation(store);
568 } 587 }
569 588
570 589
571 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { 590 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
572 ArgumentGraphVisitor for_array(owner(), temp_index()); 591 ArgumentGraphVisitor for_array(owner(), temp_index());
573 node->array()->Visit(&for_array); 592 node->array()->Visit(&for_array);
574 Append(for_array); 593 Append(for_array);
575 ArgumentGraphVisitor for_index(owner(), for_array.temp_index()); 594 ArgumentGraphVisitor for_index(owner(), for_array.temp_index());
576 node->index_expr()->Visit(&for_index); 595 node->index_expr()->Visit(&for_index);
577 Append(for_index); 596 Append(for_index);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 comp->value()->Accept(this); 784 comp->value()->Accept(this);
766 OS::Print(")"); 785 OS::Print(")");
767 } 786 }
768 787
769 788
770 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) { 789 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) {
771 OS::Print("NativeCall(%s)", comp->native_name().ToCString()); 790 OS::Print("NativeCall(%s)", comp->native_name().ToCString());
772 } 791 }
773 792
774 793
794 void FlowGraphPrinter::VisitLoadInstanceField(LoadInstanceFieldComp* comp) {
795 OS::Print("LoadInstanceField(%s, ", String::Handle(comp->name()).ToCString());
796 comp->instance()->Accept(this);
797 OS::Print(")");
798 }
799
800
801 void FlowGraphPrinter::VisitStoreInstanceField(StoreInstanceFieldComp* comp) {
802 OS::Print("StoreInstanceField(%s, ",
803 String::Handle(comp->field_name()).ToCString());
804 comp->instance()->Accept(this);
805 OS::Print(", ");
806 comp->value()->Accept(this);
807 OS::Print(")");
808 }
809
810
811 void FlowGraphPrinter::VisitLoadStaticField(LoadStaticFieldComp* comp) {
812 OS::Print("LoadStaticField(%s)",
813 String::Handle(comp->field().name()).ToCString());
814 }
815
816
817 void FlowGraphPrinter::VisitStoreStaticField(StoreStaticFieldComp* comp) {
818 OS::Print("StoreStaticField(%s, ",
819 String::Handle(comp->field().name()).ToCString());
820 comp->value()->Accept(this);
821 OS::Print(")");
822 }
823
824
775 void FlowGraphPrinter::VisitStoreIndexed(StoreIndexedComp* comp) { 825 void FlowGraphPrinter::VisitStoreIndexed(StoreIndexedComp* comp) {
776 OS::Print("StoreIndexed("); 826 OS::Print("StoreIndexed(");
777 comp->placeholder()->Accept(this); 827 comp->placeholder()->Accept(this);
778 OS::Print(", "); 828 OS::Print(", ");
779 comp->array()->Accept(this); 829 comp->array()->Accept(this);
780 OS::Print(", "); 830 OS::Print(", ");
781 comp->index()->Accept(this); 831 comp->index()->Accept(this);
782 OS::Print(", "); 832 OS::Print(", ");
783 comp->value()->Accept(this); 833 comp->value()->Accept(this);
784 OS::Print(")"); 834 OS::Print(")");
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 char* chars = reinterpret_cast<char*>( 911 char* chars = reinterpret_cast<char*>(
862 Isolate::Current()->current_zone()->Allocate(len)); 912 Isolate::Current()->current_zone()->Allocate(len));
863 OS::SNPrint(chars, len, kFormat, function_name, reason); 913 OS::SNPrint(chars, len, kFormat, function_name, reason);
864 const Error& error = Error::Handle( 914 const Error& error = Error::Handle(
865 LanguageError::New(String::Handle(String::New(chars)))); 915 LanguageError::New(String::Handle(String::New(chars))));
866 Isolate::Current()->long_jump_base()->Jump(1, error); 916 Isolate::Current()->long_jump_base()->Jump(1, error);
867 } 917 }
868 918
869 919
870 } // namespace dart 920 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.h » ('j') | runtime/vm/flow_graph_compiler_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698