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

Side by Side Diff: vm/flow_graph_builder.cc

Issue 10826097: Use explicit push-argument for InstanceSetter instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Fix syntax error Created 8 years, 4 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/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 arguments->Add(push_receiver); 1781 arguments->Add(push_receiver);
1782 const String& name = 1782 const String& name =
1783 String::ZoneHandle(Field::GetterSymbol(node->field_name())); 1783 String::ZoneHandle(Field::GetterSymbol(node->field_name()));
1784 InstanceCallComp* call = new InstanceCallComp( 1784 InstanceCallComp* call = new InstanceCallComp(
1785 node->token_pos(), owner()->try_index(), name, Token::kGET, 1785 node->token_pos(), owner()->try_index(), name, Token::kGET,
1786 arguments, Array::ZoneHandle(), 1); 1786 arguments, Array::ZoneHandle(), 1);
1787 ReturnComputation(call); 1787 ReturnComputation(call);
1788 } 1788 }
1789 1789
1790 1790
1791 void EffectGraphVisitor::BuildInstanceSetterValues( 1791 void EffectGraphVisitor::BuildInstanceSetterArguments(
1792 InstanceSetterNode* node, Value** receiver, Value** value) { 1792 InstanceSetterNode* node,
1793 ZoneGrowableArray<PushArgumentInstr*>* arguments,
1794 bool is_used) {
1793 ValueGraphVisitor for_receiver(owner(), temp_index()); 1795 ValueGraphVisitor for_receiver(owner(), temp_index());
1794 node->receiver()->Visit(&for_receiver); 1796 node->receiver()->Visit(&for_receiver);
1795 Append(for_receiver); 1797 Append(for_receiver);
1796 ValueGraphVisitor for_value(owner(), for_receiver.temp_index()); 1798 arguments->Add(PushArgument(for_receiver.value()));
1799
1800 ValueGraphVisitor for_value(owner(), temp_index());
1797 node->value()->Visit(&for_value); 1801 node->value()->Visit(&for_value);
1798 Append(for_value); 1802 Append(for_value);
1799 *receiver = for_receiver.value(); 1803
1800 *value = for_value.value(); 1804 Value* value = NULL;
1805 if (is_used) {
1806 value = Bind(
1807 BuildStoreLocal(*owner()->parsed_function().expression_temp_var(),
1808 for_value.value()));
1809 } else {
1810 value = for_value.value();
1811 }
1812 arguments->Add(PushArgument(value));
1801 } 1813 }
1802 1814
1803 1815
1804 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { 1816 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
1805 Value *receiver, *value; 1817 ZoneGrowableArray<PushArgumentInstr*>* arguments =
1806 BuildInstanceSetterValues(node, &receiver, &value); 1818 new ZoneGrowableArray<PushArgumentInstr*>(2);
1819 BuildInstanceSetterArguments(node, arguments, false); // Value not used.
1807 InstanceSetterComp* setter = 1820 InstanceSetterComp* setter =
1808 new InstanceSetterComp(node->token_pos(), 1821 new InstanceSetterComp(node->token_pos(),
1809 owner()->try_index(), 1822 owner()->try_index(),
1810 node->field_name(), 1823 node->field_name(),
1811 receiver, 1824 arguments);
1812 value);
1813 ReturnComputation(setter); 1825 ReturnComputation(setter);
1814 } 1826 }
1815 1827
1816 1828
1817 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { 1829 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) {
1818 Value *receiver, *value; 1830 ZoneGrowableArray<PushArgumentInstr*>* arguments =
1819 BuildInstanceSetterValues(node, &receiver, &value); 1831 new ZoneGrowableArray<PushArgumentInstr*>(2);
1820 Value* saved_value = Bind( 1832 BuildInstanceSetterArguments(node, arguments, true); // Value used.
1821 BuildStoreLocal(*owner()->parsed_function().expression_temp_var(),
1822 value));
1823 Do(new InstanceSetterComp(node->token_pos(), 1833 Do(new InstanceSetterComp(node->token_pos(),
1824 owner()->try_index(), 1834 owner()->try_index(),
1825 node->field_name(), 1835 node->field_name(),
1826 receiver, 1836 arguments));
1827 saved_value));
1828 ReturnComputation( 1837 ReturnComputation(
1829 BuildLoadLocal(*owner()->parsed_function().expression_temp_var())); 1838 BuildLoadLocal(*owner()->parsed_function().expression_temp_var()));
1830 } 1839 }
1831 1840
1832 1841
1833 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { 1842 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) {
1834 const String& getter_name = 1843 const String& getter_name =
1835 String::Handle(Field::GetterName(node->field_name())); 1844 String::Handle(Field::GetterName(node->field_name()));
1836 const Function& getter_function = 1845 const Function& getter_function =
1837 Function::ZoneHandle(node->cls().LookupStaticFunction(getter_name)); 1846 Function::ZoneHandle(node->cls().LookupStaticFunction(getter_name));
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2749 char* chars = reinterpret_cast<char*>( 2758 char* chars = reinterpret_cast<char*>(
2750 Isolate::Current()->current_zone()->Allocate(len)); 2759 Isolate::Current()->current_zone()->Allocate(len));
2751 OS::SNPrint(chars, len, kFormat, function_name, reason); 2760 OS::SNPrint(chars, len, kFormat, function_name, reason);
2752 const Error& error = Error::Handle( 2761 const Error& error = Error::Handle(
2753 LanguageError::New(String::Handle(String::New(chars)))); 2762 LanguageError::New(String::Handle(String::New(chars))));
2754 Isolate::Current()->long_jump_base()->Jump(1, error); 2763 Isolate::Current()->long_jump_base()->Jump(1, error);
2755 } 2764 }
2756 2765
2757 2766
2758 } // namespace dart 2767 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698