OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/block_scheduler.h" | 7 #include "vm/block_scheduler.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 if ((constant != NULL) && constant->HasUses()) { | 986 if ((constant != NULL) && constant->HasUses()) { |
987 constant->ReplaceUsesWith( | 987 constant->ReplaceUsesWith( |
988 caller_graph_->GetConstant(constant->value())); | 988 caller_graph_->GetConstant(constant->value())); |
989 } | 989 } |
990 CurrentContextInstr* context = (*defns)[i]->AsCurrentContext(); | 990 CurrentContextInstr* context = (*defns)[i]->AsCurrentContext(); |
991 if ((context != NULL) && context->HasUses()) { | 991 if ((context != NULL) && context->HasUses()) { |
992 ASSERT(call->IsClosureCall()); | 992 ASSERT(call->IsClosureCall()); |
993 LoadFieldInstr* context_load = new(Z) LoadFieldInstr( | 993 LoadFieldInstr* context_load = new(Z) LoadFieldInstr( |
994 new Value((*arguments)[0]->definition()), | 994 new Value((*arguments)[0]->definition()), |
995 Closure::context_offset(), | 995 Closure::context_offset(), |
996 AbstractType::ZoneHandle(isolate(), AbstractType::null()), | 996 AbstractType::ZoneHandle(zone(), AbstractType::null()), |
997 call_data->call->token_pos()); | 997 call_data->call->token_pos()); |
998 context_load->set_is_immutable(true); | 998 context_load->set_is_immutable(true); |
999 context_load->set_ssa_temp_index( | 999 context_load->set_ssa_temp_index( |
1000 caller_graph_->alloc_ssa_temp_index()); | 1000 caller_graph_->alloc_ssa_temp_index()); |
1001 context_load->InsertBefore(callee_entry->next()); | 1001 context_load->InsertBefore(callee_entry->next()); |
1002 context->ReplaceUsesWith(context_load); | 1002 context->ReplaceUsesWith(context_load); |
1003 } | 1003 } |
1004 } | 1004 } |
1005 | 1005 |
1006 // Check that inlining maintains use lists. | 1006 // Check that inlining maintains use lists. |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 if ((constant != NULL) && constant->HasUses()) { | 1429 if ((constant != NULL) && constant->HasUses()) { |
1430 constant->ReplaceUsesWith( | 1430 constant->ReplaceUsesWith( |
1431 owner_->caller_graph()->GetConstant(constant->value())); | 1431 owner_->caller_graph()->GetConstant(constant->value())); |
1432 } | 1432 } |
1433 CurrentContextInstr* context = (*defns)[i]->AsCurrentContext(); | 1433 CurrentContextInstr* context = (*defns)[i]->AsCurrentContext(); |
1434 if ((context != NULL) && context->HasUses()) { | 1434 if ((context != NULL) && context->HasUses()) { |
1435 ASSERT(call_data.call->IsClosureCall()); | 1435 ASSERT(call_data.call->IsClosureCall()); |
1436 LoadFieldInstr* context_load = new(Z) LoadFieldInstr( | 1436 LoadFieldInstr* context_load = new(Z) LoadFieldInstr( |
1437 new Value(redefinition), | 1437 new Value(redefinition), |
1438 Closure::context_offset(), | 1438 Closure::context_offset(), |
1439 AbstractType::ZoneHandle(isolate(), AbstractType::null()), | 1439 AbstractType::ZoneHandle(zone(), AbstractType::null()), |
1440 call_data.call->token_pos()); | 1440 call_data.call->token_pos()); |
1441 context_load->set_is_immutable(true); | 1441 context_load->set_is_immutable(true); |
1442 context_load->set_ssa_temp_index( | 1442 context_load->set_ssa_temp_index( |
1443 owner_->caller_graph()->alloc_ssa_temp_index()); | 1443 owner_->caller_graph()->alloc_ssa_temp_index()); |
1444 context_load->InsertAfter(redefinition); | 1444 context_load->InsertAfter(redefinition); |
1445 context->ReplaceUsesWith(context_load); | 1445 context->ReplaceUsesWith(context_load); |
1446 } | 1446 } |
1447 } | 1447 } |
1448 return true; | 1448 return true; |
1449 } | 1449 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 intptr_t FlowGraphInliner::NextInlineId(const Function& function, | 1876 intptr_t FlowGraphInliner::NextInlineId(const Function& function, |
1877 intptr_t parent_id) { | 1877 intptr_t parent_id) { |
1878 const intptr_t id = inline_id_to_function_->length(); | 1878 const intptr_t id = inline_id_to_function_->length(); |
1879 inline_id_to_function_->Add(&function); | 1879 inline_id_to_function_->Add(&function); |
1880 caller_inline_id_->Add(parent_id); | 1880 caller_inline_id_->Add(parent_id); |
1881 return id; | 1881 return id; |
1882 } | 1882 } |
1883 | 1883 |
1884 | 1884 |
1885 } // namespace dart | 1885 } // namespace dart |
OLD | NEW |