| 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/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 arguments->Add(for_closure.value()); | 1260 arguments->Add(for_closure.value()); |
| 1261 TranslateArgumentList(*node->arguments(), temp_index() + 2, arguments); | 1261 TranslateArgumentList(*node->arguments(), temp_index() + 2, arguments); |
| 1262 // First operand is the saved context, consumed by the call. | 1262 // First operand is the saved context, consumed by the call. |
| 1263 ClosureCallComp* call = | 1263 ClosureCallComp* call = |
| 1264 new ClosureCallComp(node, new TempVal(temp_index()), arguments); | 1264 new ClosureCallComp(node, new TempVal(temp_index()), arguments); |
| 1265 ReturnComputation(call); | 1265 ReturnComputation(call); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 | 1268 |
| 1269 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { | 1269 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { |
| 1270 Bailout("EffectGraphVisitor::VisitCloneContextNode"); | 1270 AddInstruction(new BindInstr(temp_index(), new CurrentContextComp())); |
| 1271 TempVal* ctx = new TempVal(temp_index()); |
| 1272 AddInstruction(new BindInstr(temp_index(), |
| 1273 new CloneContextComp(node->id(), node->token_index(), ctx))); |
| 1274 TempVal* cloned_ctx = new TempVal(temp_index()); |
| 1275 ReturnComputation(new StoreContextComp(cloned_ctx)); |
| 1271 } | 1276 } |
| 1272 | 1277 |
| 1273 | 1278 |
| 1274 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 1279 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 1275 if (node->constructor().IsFactory()) { | 1280 if (node->constructor().IsFactory()) { |
| 1276 ZoneGrowableArray<Value*>* factory_arguments = | 1281 ZoneGrowableArray<Value*>* factory_arguments = |
| 1277 new ZoneGrowableArray<Value*>(); | 1282 new ZoneGrowableArray<Value*>(); |
| 1278 factory_arguments->Add(BuildFactoryTypeArguments(node, temp_index())); | 1283 factory_arguments->Add(BuildFactoryTypeArguments(node, temp_index())); |
| 1279 ASSERT(factory_arguments->length() == 1); | 1284 ASSERT(factory_arguments->length() == 1); |
| 1280 TranslateArgumentList(*node->arguments(), | 1285 TranslateArgumentList(*node->arguments(), |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 } | 2128 } |
| 2124 | 2129 |
| 2125 | 2130 |
| 2126 void FlowGraphPrinter::VisitChainContext(ChainContextComp* comp) { | 2131 void FlowGraphPrinter::VisitChainContext(ChainContextComp* comp) { |
| 2127 OS::Print("ChainContext("); | 2132 OS::Print("ChainContext("); |
| 2128 comp->context_value()->Accept(this); | 2133 comp->context_value()->Accept(this); |
| 2129 OS::Print(")"); | 2134 OS::Print(")"); |
| 2130 } | 2135 } |
| 2131 | 2136 |
| 2132 | 2137 |
| 2138 void FlowGraphPrinter::VisitCloneContext(CloneContextComp* comp) { |
| 2139 OS::Print("CloneContext("); |
| 2140 comp->context_value()->Accept(this); |
| 2141 OS::Print(")"); |
| 2142 } |
| 2143 |
| 2144 |
| 2133 void FlowGraphPrinter::VisitStoreContext(StoreContextComp* comp) { | 2145 void FlowGraphPrinter::VisitStoreContext(StoreContextComp* comp) { |
| 2134 OS::Print("StoreContext("); | 2146 OS::Print("StoreContext("); |
| 2135 comp->value()->Accept(this); | 2147 comp->value()->Accept(this); |
| 2136 OS::Print(")"); | 2148 OS::Print(")"); |
| 2137 } | 2149 } |
| 2138 | 2150 |
| 2139 | 2151 |
| 2140 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { | 2152 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { |
| 2141 OS::Print("%2d: [join]", reverse_index(instr->postorder_number())); | 2153 OS::Print("%2d: [join]", reverse_index(instr->postorder_number())); |
| 2142 } | 2154 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 char* chars = reinterpret_cast<char*>( | 2339 char* chars = reinterpret_cast<char*>( |
| 2328 Isolate::Current()->current_zone()->Allocate(len)); | 2340 Isolate::Current()->current_zone()->Allocate(len)); |
| 2329 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2341 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2330 const Error& error = Error::Handle( | 2342 const Error& error = Error::Handle( |
| 2331 LanguageError::New(String::Handle(String::New(chars)))); | 2343 LanguageError::New(String::Handle(String::New(chars)))); |
| 2332 Isolate::Current()->long_jump_base()->Jump(1, error); | 2344 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2333 } | 2345 } |
| 2334 | 2346 |
| 2335 | 2347 |
| 2336 } // namespace dart | 2348 } // namespace dart |
| OLD | NEW |