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

Side by Side Diff: vm/flow_graph_builder.cc

Issue 10825176: Refactor our IL instruction for static setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: 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 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 new ZoneGrowableArray<PushArgumentInstr*>(); 1782 new ZoneGrowableArray<PushArgumentInstr*>();
1783 StaticCallComp* call = new StaticCallComp(node->token_pos(), 1783 StaticCallComp* call = new StaticCallComp(node->token_pos(),
1784 owner()->try_index(), 1784 owner()->try_index(),
1785 getter_function, 1785 getter_function,
1786 Array::ZoneHandle(), // No names. 1786 Array::ZoneHandle(), // No names.
1787 arguments); 1787 arguments);
1788 ReturnComputation(call); 1788 ReturnComputation(call);
1789 } 1789 }
1790 1790
1791 1791
1792 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { 1792 void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node,
1793 bool result_is_needed) {
1793 const String& setter_name = 1794 const String& setter_name =
1794 String::Handle(Field::SetterName(node->field_name())); 1795 String::Handle(Field::SetterName(node->field_name()));
1795 const Function& setter_function = 1796 const Function& setter_function =
1796 Function::ZoneHandle(node->cls().LookupStaticFunction(setter_name)); 1797 Function::ZoneHandle(node->cls().LookupStaticFunction(setter_name));
1797 ASSERT(!setter_function.IsNull()); 1798 ASSERT(!setter_function.IsNull());
1798 ValueGraphVisitor for_value(owner(), temp_index()); 1799 ValueGraphVisitor for_value(owner(), temp_index());
1799 node->value()->Visit(&for_value); 1800 node->value()->Visit(&for_value);
1800 Append(for_value); 1801 Append(for_value);
1801 StaticSetterComp* call = new StaticSetterComp(node->token_pos(), 1802 Value* value = NULL;
1802 owner()->try_index(), 1803 if (result_is_needed) {
1803 setter_function, 1804 value = Bind(
1804 for_value.value()); 1805 BuildStoreLocal(*owner()->parsed_function().expression_temp_var(),
1805 ReturnComputation(call); 1806 for_value.value()));
1807 } else {
1808 value = for_value.value();
1809 }
1810 ZoneGrowableArray<PushArgumentInstr*>* arguments =
1811 new ZoneGrowableArray<PushArgumentInstr*>(1);
1812 arguments->Add(PushArgument(value));
1813 StaticCallComp* call = new StaticCallComp(node->token_pos(),
1814 owner()->try_index(),
1815 setter_function,
1816 Array::ZoneHandle(), // No names.
1817 arguments);
1818 if (result_is_needed) {
1819 Do(call);
1820 ReturnComputation(
1821 BuildLoadLocal(*owner()->parsed_function().expression_temp_var()));
1822 } else {
1823 ReturnComputation(call);
1824 }
1825 }
1826
1827
1828 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
1829 BuildStaticSetter(node, false); // Result not needed.
1830 }
1831
1832
1833 void ValueGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
1834 BuildStaticSetter(node, true); // Result needed.
1806 } 1835 }
1807 1836
1808 1837
1809 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { 1838 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
1810 NativeCallComp* native_call = 1839 NativeCallComp* native_call =
1811 new NativeCallComp(node, owner()->try_index()); 1840 new NativeCallComp(node, owner()->try_index());
1812 ReturnComputation(native_call); 1841 ReturnComputation(native_call);
1813 } 1842 }
1814 1843
1815 1844
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 char* chars = reinterpret_cast<char*>( 2717 char* chars = reinterpret_cast<char*>(
2689 Isolate::Current()->current_zone()->Allocate(len)); 2718 Isolate::Current()->current_zone()->Allocate(len));
2690 OS::SNPrint(chars, len, kFormat, function_name, reason); 2719 OS::SNPrint(chars, len, kFormat, function_name, reason);
2691 const Error& error = Error::Handle( 2720 const Error& error = Error::Handle(
2692 LanguageError::New(String::Handle(String::New(chars)))); 2721 LanguageError::New(String::Handle(String::New(chars))));
2693 Isolate::Current()->long_jump_base()->Jump(1, error); 2722 Isolate::Current()->long_jump_base()->Jump(1, error);
2694 } 2723 }
2695 2724
2696 2725
2697 } // namespace dart 2726 } // namespace dart
OLDNEW
« no previous file with comments | « vm/flow_graph_builder.h ('k') | vm/intermediate_language.h » ('j') | vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698