| 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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // If the call has uses, create a phi of the returns. | 198 // If the call has uses, create a phi of the returns. |
| 199 if (call->HasUses()) { | 199 if (call->HasUses()) { |
| 200 // Environment count: length before call - argument count (+ return) | 200 // Environment count: length before call - argument count (+ return) |
| 201 intptr_t env_count = call->env()->Length() - call->ArgumentCount(); | 201 intptr_t env_count = call->env()->Length() - call->ArgumentCount(); |
| 202 // Add a phi of the return values. | 202 // Add a phi of the return values. |
| 203 join->InsertPhi(env_count, env_count + 1); | 203 join->InsertPhi(env_count, env_count + 1); |
| 204 PhiInstr* phi = join->phis()->Last(); | 204 PhiInstr* phi = join->phis()->Last(); |
| 205 phi->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index()); | 205 phi->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index()); |
| 206 phi->mark_alive(); | 206 phi->mark_alive(); |
| 207 for (intptr_t i = 0; i < num_exits; ++i) { | 207 for (intptr_t i = 0; i < num_exits; ++i) { |
| 208 Value* value = ValueAt(i); | 208 phi->SetInputAt(i, ValueAt(i)); |
| 209 phi->SetInputAt(i, value); | |
| 210 value->set_instruction(phi); | |
| 211 value->set_use_index(i); | |
| 212 } | 209 } |
| 213 // Replace uses of the call with the phi. | 210 // Replace uses of the call with the phi. |
| 214 call->ReplaceUsesWith(phi); | 211 call->ReplaceUsesWith(phi); |
| 215 } else { | 212 } else { |
| 216 // In the case that the result is unused, remove the return value uses | 213 // In the case that the result is unused, remove the return value uses |
| 217 // from their definition's use list. | 214 // from their definition's use list. |
| 218 for (intptr_t i = 0; i < num_exits; ++i) { | 215 for (intptr_t i = 0; i < num_exits; ++i) { |
| 219 ValueAt(i)->RemoveFromUseList(); | 216 ValueAt(i)->RemoveFromUseList(); |
| 220 } | 217 } |
| 221 } | 218 } |
| (...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3264 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3268 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3265 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3269 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3266 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3270 const Error& error = Error::Handle( | 3267 const Error& error = Error::Handle( |
| 3271 LanguageError::New(String::Handle(String::New(chars)))); | 3268 LanguageError::New(String::Handle(String::New(chars)))); |
| 3272 Isolate::Current()->long_jump_base()->Jump(1, error); | 3269 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3273 } | 3270 } |
| 3274 | 3271 |
| 3275 | 3272 |
| 3276 } // namespace dart | 3273 } // namespace dart |
| OLD | NEW |