Chromium Code Reviews| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 assembler()->CodeSize(), | 711 assembler()->CodeSize(), |
| 712 deopt_id, | 712 deopt_id, |
| 713 token_pos, | 713 token_pos, |
| 714 CurrentTryIndex()); | 714 CurrentTryIndex()); |
| 715 } | 715 } |
| 716 | 716 |
| 717 | 717 |
| 718 void FlowGraphCompiler::AddStaticCallTarget(const Function& func) { | 718 void FlowGraphCompiler::AddStaticCallTarget(const Function& func) { |
| 719 ASSERT(func.IsZoneHandle()); | 719 ASSERT(func.IsZoneHandle()); |
| 720 static_calls_target_table_.Add( | 720 static_calls_target_table_.Add( |
| 721 StaticCallsStruct(assembler()->CodeSize(), &func, NULL)); | 721 new StaticCallsStruct(assembler()->CodeSize(), &func, NULL)); |
|
koda
2015/08/21 17:21:14
Now we need to fetch the current zone from TLS and
srdjan
2015/08/21 17:33:41
Using new(zone()), thanks for spotting it. Having
hausner
2015/08/21 17:41:20
You mean there is less data to copy when it grows?
srdjan
2015/08/21 18:12:13
In this case it is probably not measurably faster.
| |
| 722 } | 722 } |
| 723 | 723 |
| 724 | 724 |
| 725 void FlowGraphCompiler::AddStubCallTarget(const Code& code) { | 725 void FlowGraphCompiler::AddStubCallTarget(const Code& code) { |
| 726 ASSERT(code.IsZoneHandle()); | 726 ASSERT(code.IsZoneHandle()); |
| 727 static_calls_target_table_.Add( | 727 static_calls_target_table_.Add( |
| 728 StaticCallsStruct(assembler()->CodeSize(), NULL, &code)); | 728 new StaticCallsStruct(assembler()->CodeSize(), NULL, &code)); |
| 729 } | 729 } |
| 730 | 730 |
| 731 | 731 |
| 732 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, | 732 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, |
| 733 intptr_t token_pos) { | 733 intptr_t token_pos) { |
| 734 ASSERT(is_optimizing()); | 734 ASSERT(is_optimizing()); |
| 735 ASSERT(!intrinsic_mode()); | 735 ASSERT(!intrinsic_mode()); |
| 736 CompilerDeoptInfo* info = | 736 CompilerDeoptInfo* info = |
| 737 new CompilerDeoptInfo(deopt_id, | 737 new CompilerDeoptInfo(deopt_id, |
| 738 ICData::kDeoptAtCall, | 738 ICData::kDeoptAtCall, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 988 | 988 |
| 989 | 989 |
| 990 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { | 990 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
| 991 ASSERT(code.static_calls_target_table() == Array::null()); | 991 ASSERT(code.static_calls_target_table() == Array::null()); |
| 992 const Array& targets = Array::Handle(zone(), Array::New( | 992 const Array& targets = Array::Handle(zone(), Array::New( |
| 993 (static_calls_target_table_.length() * Code::kSCallTableEntryLength), | 993 (static_calls_target_table_.length() * Code::kSCallTableEntryLength), |
| 994 Heap::kOld)); | 994 Heap::kOld)); |
| 995 Smi& smi_offset = Smi::Handle(zone()); | 995 Smi& smi_offset = Smi::Handle(zone()); |
| 996 for (intptr_t i = 0; i < static_calls_target_table_.length(); i++) { | 996 for (intptr_t i = 0; i < static_calls_target_table_.length(); i++) { |
| 997 const intptr_t target_ix = Code::kSCallTableEntryLength * i; | 997 const intptr_t target_ix = Code::kSCallTableEntryLength * i; |
| 998 smi_offset = Smi::New(static_calls_target_table_[i].offset); | 998 smi_offset = Smi::New(static_calls_target_table_[i]->offset); |
| 999 targets.SetAt(target_ix + Code::kSCallTableOffsetEntry, smi_offset); | 999 targets.SetAt(target_ix + Code::kSCallTableOffsetEntry, smi_offset); |
| 1000 if (static_calls_target_table_[i].function != NULL) { | 1000 if (static_calls_target_table_[i]->function != NULL) { |
| 1001 targets.SetAt(target_ix + Code::kSCallTableFunctionEntry, | 1001 targets.SetAt(target_ix + Code::kSCallTableFunctionEntry, |
| 1002 *static_calls_target_table_[i].function); | 1002 *static_calls_target_table_[i]->function); |
| 1003 } | 1003 } |
| 1004 if (static_calls_target_table_[i].code != NULL) { | 1004 if (static_calls_target_table_[i]->code != NULL) { |
| 1005 targets.SetAt(target_ix + Code::kSCallTableCodeEntry, | 1005 targets.SetAt(target_ix + Code::kSCallTableCodeEntry, |
| 1006 *static_calls_target_table_[i].code); | 1006 *static_calls_target_table_[i]->code); |
| 1007 } | 1007 } |
| 1008 } | 1008 } |
| 1009 code.set_static_calls_target_table(targets); | 1009 code.set_static_calls_target_table(targets); |
| 1010 INC_STAT(isolate(), total_code_size, targets.Length() * sizeof(uword)); | 1010 INC_STAT(isolate(), total_code_size, targets.Length() * sizeof(uword)); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 | 1013 |
| 1014 // Returns 'true' if code generation for this function is complete, i.e., | 1014 // Returns 'true' if code generation for this function is complete, i.e., |
| 1015 // no fall-through to regular code is needed. | 1015 // no fall-through to regular code is needed. |
| 1016 void FlowGraphCompiler::TryIntrinsify() { | 1016 void FlowGraphCompiler::TryIntrinsify() { |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1822 | 1822 |
| 1823 | 1823 |
| 1824 void FlowGraphCompiler::FrameStateClear() { | 1824 void FlowGraphCompiler::FrameStateClear() { |
| 1825 ASSERT(!is_optimizing()); | 1825 ASSERT(!is_optimizing()); |
| 1826 frame_state_.TruncateTo(0); | 1826 frame_state_.TruncateTo(0); |
| 1827 } | 1827 } |
| 1828 #endif | 1828 #endif |
| 1829 | 1829 |
| 1830 | 1830 |
| 1831 } // namespace dart | 1831 } // namespace dart |
| OLD | NEW |