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

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

Issue 9726011: Implement StaticGetter and StaticSetter in new compiler. (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/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 InstanceSetterComp* setter = new InstanceSetterComp(node->id(), 1103 InstanceSetterComp* setter = new InstanceSetterComp(node->id(),
1104 node->token_index(), 1104 node->token_index(),
1105 node->field_name(), 1105 node->field_name(),
1106 for_receiver.value(), 1106 for_receiver.value(),
1107 for_value.value()); 1107 for_value.value());
1108 ReturnComputation(setter); 1108 ReturnComputation(setter);
1109 } 1109 }
1110 1110
1111 1111
1112 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { 1112 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) {
1113 Bailout("EffectGraphVisitor::VisitStaticGetterNode"); 1113 const String& getter_name =
1114 String::Handle(Field::GetterName(node->field_name()));
1115 const Function& getter_function =
1116 Function::ZoneHandle(node->cls().LookupStaticFunction(getter_name));
1117 ASSERT(!getter_function.IsNull());
1118 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>();
1119 StaticCallComp* call = new StaticCallComp(node->token_index(),
1120 getter_function,
1121 Array::ZoneHandle(), // No names.
1122 values);
1123 ReturnComputation(call);
1114 } 1124 }
1115 1125
1116 1126
1117 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { 1127 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
1118 Bailout("EffectGraphVisitor::VisitStaticSetterNode"); 1128 const String& setter_name =
1129 String::Handle(Field::SetterName(node->field_name()));
1130 const Function& setter_function =
1131 Function::ZoneHandle(node->cls().LookupStaticFunction(setter_name));
1132 ASSERT(!setter_function.IsNull());
1133 ArgumentGraphVisitor for_value(owner(), temp_index());
1134 node->value()->Visit(&for_value);
1135 Append(for_value);
1136 StaticSetterComp* call = new StaticSetterComp(node->token_index(),
1137 setter_function,
1138 for_value.value());
1139 ReturnComputation(call);
1119 } 1140 }
1120 1141
1121 1142
1122 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { 1143 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
1123 NativeCallComp* native_call = new NativeCallComp(node); 1144 NativeCallComp* native_call = new NativeCallComp(node);
1124 ReturnComputation(native_call); 1145 ReturnComputation(native_call);
1125 } 1146 }
1126 1147
1127 1148
1128 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { 1149 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1535
1515 void FlowGraphPrinter::VisitInstanceSetter(InstanceSetterComp* comp) { 1536 void FlowGraphPrinter::VisitInstanceSetter(InstanceSetterComp* comp) {
1516 OS::Print("InstanceSetter("); 1537 OS::Print("InstanceSetter(");
1517 comp->receiver()->Accept(this); 1538 comp->receiver()->Accept(this);
1518 OS::Print(", "); 1539 OS::Print(", ");
1519 comp->value()->Accept(this); 1540 comp->value()->Accept(this);
1520 OS::Print(")"); 1541 OS::Print(")");
1521 } 1542 }
1522 1543
1523 1544
1545 void FlowGraphPrinter::VisitStaticSetter(StaticSetterComp* comp) {
1546 OS::Print("StaticSetter(");
1547 comp->value()->Accept(this);
1548 OS::Print(")");
1549 }
1550
1551
1524 void FlowGraphPrinter::VisitBooleanNegate(BooleanNegateComp* comp) { 1552 void FlowGraphPrinter::VisitBooleanNegate(BooleanNegateComp* comp) {
1525 OS::Print("! "); 1553 OS::Print("! ");
1526 comp->value()->Accept(this); 1554 comp->value()->Accept(this);
1527 } 1555 }
1528 1556
1529 1557
1530 void FlowGraphPrinter::VisitInstanceOf(InstanceOfComp* comp) { 1558 void FlowGraphPrinter::VisitInstanceOf(InstanceOfComp* comp) {
1531 comp->value()->Accept(this); 1559 comp->value()->Accept(this);
1532 OS::Print(" %s %s", 1560 OS::Print(" %s %s",
1533 comp->negate_result() ? "ISNOT" : "IS", 1561 comp->negate_result() ? "ISNOT" : "IS",
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 char* chars = reinterpret_cast<char*>( 1724 char* chars = reinterpret_cast<char*>(
1697 Isolate::Current()->current_zone()->Allocate(len)); 1725 Isolate::Current()->current_zone()->Allocate(len));
1698 OS::SNPrint(chars, len, kFormat, function_name, reason); 1726 OS::SNPrint(chars, len, kFormat, function_name, reason);
1699 const Error& error = Error::Handle( 1727 const Error& error = Error::Handle(
1700 LanguageError::New(String::Handle(String::New(chars)))); 1728 LanguageError::New(String::Handle(String::New(chars))));
1701 Isolate::Current()->long_jump_base()->Jump(1, error); 1729 Isolate::Current()->long_jump_base()->Jump(1, error);
1702 } 1730 }
1703 1731
1704 1732
1705 } // namespace dart 1733 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698