| 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 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 arguments->Add(for_index.value()); | 1913 arguments->Add(for_index.value()); |
| 1914 const String& name = | 1914 const String& name = |
| 1915 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kINDEX))); | 1915 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kINDEX))); |
| 1916 InstanceCallComp* call = new InstanceCallComp( | 1916 InstanceCallComp* call = new InstanceCallComp( |
| 1917 node->token_index(), owner()->try_index(), name, | 1917 node->token_index(), owner()->try_index(), name, |
| 1918 arguments, Array::ZoneHandle(), 1); | 1918 arguments, Array::ZoneHandle(), 1); |
| 1919 ReturnComputation(call); | 1919 ReturnComputation(call); |
| 1920 } | 1920 } |
| 1921 | 1921 |
| 1922 | 1922 |
| 1923 void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { | 1923 void EffectGraphVisitor::BuildStoreIndexedValues( |
| 1924 StoreIndexedNode* node, Value** array, Value** index, Value** value) { |
| 1924 ValueGraphVisitor for_array(owner(), temp_index()); | 1925 ValueGraphVisitor for_array(owner(), temp_index()); |
| 1925 node->array()->Visit(&for_array); | 1926 node->array()->Visit(&for_array); |
| 1926 Append(for_array); | 1927 Append(for_array); |
| 1927 ValueGraphVisitor for_index(owner(), for_array.temp_index()); | 1928 ValueGraphVisitor for_index(owner(), for_array.temp_index()); |
| 1928 node->index_expr()->Visit(&for_index); | 1929 node->index_expr()->Visit(&for_index); |
| 1929 Append(for_index); | 1930 Append(for_index); |
| 1930 ValueGraphVisitor for_value(owner(), for_index.temp_index()); | 1931 ValueGraphVisitor for_value(owner(), for_index.temp_index()); |
| 1931 node->value()->Visit(&for_value); | 1932 node->value()->Visit(&for_value); |
| 1932 Append(for_value); | 1933 Append(for_value); |
| 1934 *array = for_array.value(); |
| 1935 *index = for_index.value(); |
| 1936 *value = for_value.value(); |
| 1937 } |
| 1938 |
| 1939 |
| 1940 void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { |
| 1941 Value *array, *index, *value; |
| 1942 BuildStoreIndexedValues(node, &array, &index, &value); |
| 1933 StoreIndexedComp* store = new StoreIndexedComp(node->token_index(), | 1943 StoreIndexedComp* store = new StoreIndexedComp(node->token_index(), |
| 1934 owner()->try_index(), | 1944 owner()->try_index(), |
| 1935 for_array.value(), | 1945 array, |
| 1936 for_index.value(), | 1946 index, |
| 1937 for_value.value()); | 1947 value); |
| 1938 ReturnComputation(store); | 1948 ReturnComputation(store); |
| 1939 } | 1949 } |
| 1940 | 1950 |
| 1941 | 1951 |
| 1952 void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { |
| 1953 Value *array, *index, *value; |
| 1954 BuildStoreIndexedValues(node, &array, &index, &value); |
| 1955 BindInstr* store_local_instr = new BindInstr( |
| 1956 BuildStoreLocal(*owner()->parsed_function().expression_temp_var(), |
| 1957 value)); |
| 1958 AddInstruction(store_local_instr); |
| 1959 UseVal* saved_value = new UseVal(store_local_instr); |
| 1960 StoreIndexedComp* store = new StoreIndexedComp(node->token_index(), |
| 1961 owner()->try_index(), |
| 1962 array, |
| 1963 index, |
| 1964 saved_value); |
| 1965 AddInstruction(new DoInstr(store)); |
| 1966 ReturnComputation( |
| 1967 BuildLoadLocal(*owner()->parsed_function().expression_temp_var())); |
| 1968 } |
| 1969 |
| 1970 |
| 1942 bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const { | 1971 bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const { |
| 1943 return (node == owner()->parsed_function().node_sequence()) && | 1972 return (node == owner()->parsed_function().node_sequence()) && |
| 1944 (owner()->parsed_function().saved_context_var() != NULL); | 1973 (owner()->parsed_function().saved_context_var() != NULL); |
| 1945 } | 1974 } |
| 1946 | 1975 |
| 1947 | 1976 |
| 1948 void EffectGraphVisitor::UnchainContext() { | 1977 void EffectGraphVisitor::UnchainContext() { |
| 1949 BindInstr* context = new BindInstr(new CurrentContextComp()); | 1978 BindInstr* context = new BindInstr(new CurrentContextComp()); |
| 1950 AddInstruction(context); | 1979 AddInstruction(context); |
| 1951 BindInstr* parent = | 1980 BindInstr* parent = |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 char* chars = reinterpret_cast<char*>( | 2436 char* chars = reinterpret_cast<char*>( |
| 2408 Isolate::Current()->current_zone()->Allocate(len)); | 2437 Isolate::Current()->current_zone()->Allocate(len)); |
| 2409 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2438 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2410 const Error& error = Error::Handle( | 2439 const Error& error = Error::Handle( |
| 2411 LanguageError::New(String::Handle(String::New(chars)))); | 2440 LanguageError::New(String::Handle(String::New(chars)))); |
| 2412 Isolate::Current()->long_jump_base()->Jump(1, error); | 2441 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2413 } | 2442 } |
| 2414 | 2443 |
| 2415 | 2444 |
| 2416 } // namespace dart | 2445 } // namespace dart |
| OLD | NEW |