| OLD | NEW |
| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 ASSERT(delta >= 0); | 182 ASSERT(delta >= 0); |
| 183 BindInstr* context = new BindInstr(new CurrentContextComp()); | 183 BindInstr* context = new BindInstr(new CurrentContextComp()); |
| 184 AddInstruction(context); | 184 AddInstruction(context); |
| 185 Value* context_value = new UseVal(context); | 185 Value* context_value = new UseVal(context); |
| 186 while (delta-- > 0) { | 186 while (delta-- > 0) { |
| 187 BindInstr* load = new BindInstr(new LoadVMFieldComp( | 187 BindInstr* load = new BindInstr(new LoadVMFieldComp( |
| 188 context_value, Context::parent_offset(), Type::ZoneHandle())); | 188 context_value, Context::parent_offset(), Type::ZoneHandle())); |
| 189 AddInstruction(load); | 189 AddInstruction(load); |
| 190 context_value = new UseVal(load); | 190 context_value = new UseVal(load); |
| 191 } | 191 } |
| 192 return new LoadVMFieldComp( | 192 return new LoadVMFieldComp(context_value, |
| 193 context_value, Context::variable_offset(local.index()), local.type()); | 193 Context::variable_offset(local.index()), |
| 194 local.type()); |
| 194 } else { | 195 } else { |
| 195 return new LoadLocalComp(local, owner()->context_level()); | 196 return new LoadLocalComp(local, owner()->context_level()); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 | 200 |
| 200 // Stores current context into the 'variable' | 201 // Stores current context into the 'variable' |
| 201 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) { | 202 void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) { |
| 202 BindInstr* context = new BindInstr(new CurrentContextComp()); | 203 BindInstr* context = new BindInstr(new CurrentContextComp()); |
| 203 AddInstruction(context); | 204 AddInstruction(context); |
| (...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 ReturnComputation(store); | 1895 ReturnComputation(store); |
| 1895 } | 1896 } |
| 1896 | 1897 |
| 1897 | 1898 |
| 1898 void EffectGraphVisitor::VisitLoadInstanceFieldNode( | 1899 void EffectGraphVisitor::VisitLoadInstanceFieldNode( |
| 1899 LoadInstanceFieldNode* node) { | 1900 LoadInstanceFieldNode* node) { |
| 1900 ValueGraphVisitor for_instance(owner(), temp_index()); | 1901 ValueGraphVisitor for_instance(owner(), temp_index()); |
| 1901 node->instance()->Visit(&for_instance); | 1902 node->instance()->Visit(&for_instance); |
| 1902 Append(for_instance); | 1903 Append(for_instance); |
| 1903 LoadInstanceFieldComp* load = new LoadInstanceFieldComp( | 1904 LoadInstanceFieldComp* load = new LoadInstanceFieldComp( |
| 1904 node->field(), for_instance.value(), NULL, NULL); | 1905 node->field(), for_instance.value(), NULL); |
| 1905 ReturnComputation(load); | 1906 ReturnComputation(load); |
| 1906 } | 1907 } |
| 1907 | 1908 |
| 1908 | 1909 |
| 1909 void EffectGraphVisitor::VisitStoreInstanceFieldNode( | 1910 void EffectGraphVisitor::VisitStoreInstanceFieldNode( |
| 1910 StoreInstanceFieldNode* node) { | 1911 StoreInstanceFieldNode* node) { |
| 1911 ValueGraphVisitor for_instance(owner(), temp_index()); | 1912 ValueGraphVisitor for_instance(owner(), temp_index()); |
| 1912 node->instance()->Visit(&for_instance); | 1913 node->instance()->Visit(&for_instance); |
| 1913 Append(for_instance); | 1914 Append(for_instance); |
| 1914 ValueGraphVisitor for_value(owner(), for_instance.temp_index()); | 1915 ValueGraphVisitor for_value(owner(), for_instance.temp_index()); |
| 1915 node->value()->Visit(&for_value); | 1916 node->value()->Visit(&for_value); |
| 1916 Append(for_value); | 1917 Append(for_value); |
| 1917 Value* store_value = for_value.value(); | 1918 Value* store_value = for_value.value(); |
| 1918 if (FLAG_enable_type_checks) { | 1919 if (FLAG_enable_type_checks) { |
| 1919 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); | 1920 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); |
| 1920 const String& dst_name = String::ZoneHandle(node->field().name()); | 1921 const String& dst_name = String::ZoneHandle(node->field().name()); |
| 1921 store_value = BuildAssignableValue(node->value()->token_index(), | 1922 store_value = BuildAssignableValue(node->value()->token_index(), |
| 1922 store_value, | 1923 store_value, |
| 1923 type, | 1924 type, |
| 1924 dst_name); | 1925 dst_name); |
| 1925 } | 1926 } |
| 1926 StoreInstanceFieldComp* store = new StoreInstanceFieldComp( | 1927 StoreInstanceFieldComp* store = new StoreInstanceFieldComp( |
| 1927 node->field(), for_instance.value(), store_value, NULL, NULL); | 1928 node->field(), for_instance.value(), store_value, NULL); |
| 1928 ReturnComputation(store); | 1929 ReturnComputation(store); |
| 1929 } | 1930 } |
| 1930 | 1931 |
| 1931 | 1932 |
| 1932 // StoreInstanceFieldNode does not return result. | 1933 // StoreInstanceFieldNode does not return result. |
| 1933 void ValueGraphVisitor::VisitStoreInstanceFieldNode( | 1934 void ValueGraphVisitor::VisitStoreInstanceFieldNode( |
| 1934 StoreInstanceFieldNode* node) { | 1935 StoreInstanceFieldNode* node) { |
| 1935 UNIMPLEMENTED(); | 1936 UNIMPLEMENTED(); |
| 1936 } | 1937 } |
| 1937 | 1938 |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2729 char* chars = reinterpret_cast<char*>( | 2730 char* chars = reinterpret_cast<char*>( |
| 2730 Isolate::Current()->current_zone()->Allocate(len)); | 2731 Isolate::Current()->current_zone()->Allocate(len)); |
| 2731 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2732 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2732 const Error& error = Error::Handle( | 2733 const Error& error = Error::Handle( |
| 2733 LanguageError::New(String::Handle(String::New(chars)))); | 2734 LanguageError::New(String::Handle(String::New(chars)))); |
| 2734 Isolate::Current()->long_jump_base()->Jump(1, error); | 2735 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2735 } | 2736 } |
| 2736 | 2737 |
| 2737 | 2738 |
| 2738 } // namespace dart | 2739 } // namespace dart |
| OLD | NEW |