| 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/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 node->closure()->Visit(&for_closure); | 1863 node->closure()->Visit(&for_closure); |
| 1864 Append(for_closure); | 1864 Append(for_closure); |
| 1865 PushArgumentInstr* push_closure = PushArgument(for_closure.value()); | 1865 PushArgumentInstr* push_closure = PushArgument(for_closure.value()); |
| 1866 | 1866 |
| 1867 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 1867 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 1868 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); | 1868 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); |
| 1869 arguments->Add(push_closure); | 1869 arguments->Add(push_closure); |
| 1870 BuildPushArguments(*node->arguments(), arguments); | 1870 BuildPushArguments(*node->arguments(), arguments); |
| 1871 | 1871 |
| 1872 // Save context around the call. | 1872 // Save context around the call. |
| 1873 BuildStoreContext(*owner()->parsed_function().expression_temp_var()); | 1873 ASSERT(owner()->parsed_function().saved_current_context_var() != NULL); |
| 1874 BuildStoreContext(*owner()->parsed_function().saved_current_context_var()); |
| 1874 return new ClosureCallInstr(node, arguments); | 1875 return new ClosureCallInstr(node, arguments); |
| 1875 } | 1876 } |
| 1876 | 1877 |
| 1877 | 1878 |
| 1878 void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { | 1879 void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { |
| 1879 Do(BuildClosureCall(node)); | 1880 Do(BuildClosureCall(node)); |
| 1880 // Restore context from saved location. | 1881 // Restore context from saved location. |
| 1881 BuildLoadContext(*owner()->parsed_function().expression_temp_var()); | 1882 ASSERT(owner()->parsed_function().saved_current_context_var() != NULL); |
| 1883 BuildLoadContext(*owner()->parsed_function().saved_current_context_var()); |
| 1882 } | 1884 } |
| 1883 | 1885 |
| 1884 | 1886 |
| 1885 void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { | 1887 void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { |
| 1886 Value* result = Bind(BuildClosureCall(node)); | 1888 Value* result = Bind(BuildClosureCall(node)); |
| 1887 // Restore context from temp. | 1889 // Restore context from temp. |
| 1888 BuildLoadContext(*owner()->parsed_function().expression_temp_var()); | 1890 ASSERT(owner()->parsed_function().saved_current_context_var() != NULL); |
| 1891 BuildLoadContext(*owner()->parsed_function().saved_current_context_var()); |
| 1889 ReturnValue(result); | 1892 ReturnValue(result); |
| 1890 } | 1893 } |
| 1891 | 1894 |
| 1892 | 1895 |
| 1893 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { | 1896 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { |
| 1894 InlineBailout("EffectGraphVisitor::VisitCloneContextNode (context)"); | 1897 InlineBailout("EffectGraphVisitor::VisitCloneContextNode (context)"); |
| 1895 Value* context = Bind(new CurrentContextInstr()); | 1898 Value* context = Bind(new CurrentContextInstr()); |
| 1896 Value* clone = Bind(new CloneContextInstr(node->token_pos(), context)); | 1899 Value* clone = Bind(new CloneContextInstr(node->token_pos(), context)); |
| 1897 AddInstruction(new StoreContextInstr(clone)); | 1900 AddInstruction(new StoreContextInstr(clone)); |
| 1898 } | 1901 } |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3232 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3230 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3233 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3231 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3234 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3232 const Error& error = Error::Handle( | 3235 const Error& error = Error::Handle( |
| 3233 LanguageError::New(String::Handle(String::New(chars)))); | 3236 LanguageError::New(String::Handle(String::New(chars)))); |
| 3234 Isolate::Current()->long_jump_base()->Jump(1, error); | 3237 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3235 } | 3238 } |
| 3236 | 3239 |
| 3237 | 3240 |
| 3238 } // namespace dart | 3241 } // namespace dart |
| OLD | NEW |