OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
6 | 6 |
7 #include "vm/code_patcher.h" | 7 #include "vm/code_patcher.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/log.h" | 10 #include "vm/log.h" |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 for (intptr_t i = 0; i < table.Length(); i += Code::kSCallTableEntryLength) { | 742 for (intptr_t i = 0; i < table.Length(); i += Code::kSCallTableEntryLength) { |
743 pc_offset ^= table.At(i + Code::kSCallTableOffsetEntry); | 743 pc_offset ^= table.At(i + Code::kSCallTableOffsetEntry); |
744 target ^= table.At(i + Code::kSCallTableFunctionEntry); | 744 target ^= table.At(i + Code::kSCallTableFunctionEntry); |
745 if (target.IsNull()) { | 745 if (target.IsNull()) { |
746 target_code ^= table.At(i + Code::kSCallTableCodeEntry); | 746 target_code ^= table.At(i + Code::kSCallTableCodeEntry); |
747 ASSERT(!target_code.IsNull()); | 747 ASSERT(!target_code.IsNull()); |
748 ASSERT(!target_code.IsFunctionCode()); | 748 ASSERT(!target_code.IsFunctionCode()); |
749 // Allocation stub or AllocateContext or AllocateArray or ... | 749 // Allocation stub or AllocateContext or AllocateArray or ... |
750 } else { | 750 } else { |
| 751 // Static calls initially call the CallStaticFunction stub because |
| 752 // their target might not be compiled yet. After tree shaking, all |
| 753 // static call targets are compiled. |
751 // Cf. runtime entry PatchStaticCall called from CallStaticFunction stub. | 754 // Cf. runtime entry PatchStaticCall called from CallStaticFunction stub. |
752 ASSERT(target.HasCode()); | 755 ASSERT(target.HasCode()); |
753 target_code ^= target.CurrentCode(); | 756 target_code ^= target.CurrentCode(); |
754 CodePatcher::PatchStaticCallAt(pc_offset.Value() + code.EntryPoint(), | 757 CodePatcher::PatchStaticCallAt(pc_offset.Value() + code.EntryPoint(), |
755 code, target_code); | 758 code, target_code); |
756 } | 759 } |
757 } | 760 } |
| 761 |
| 762 // We won't patch static calls anymore, so drop the static call table to save |
| 763 // space. |
758 code.set_static_calls_target_table(Object::empty_array()); | 764 code.set_static_calls_target_table(Object::empty_array()); |
759 } | 765 } |
760 | 766 |
761 } // namespace dart | 767 } // namespace dart |
OLD | NEW |