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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 // Preserve PP of caller. | 966 // Preserve PP of caller. |
967 __ mov(R7, Operand(PP)); | 967 __ mov(R7, Operand(PP)); |
968 // Temporarily setup pool pointer for this dart function. | 968 // Temporarily setup pool pointer for this dart function. |
969 __ LoadPoolPointer(); | 969 __ LoadPoolPointer(); |
970 // Load function object from object pool. | 970 // Load function object from object pool. |
971 __ LoadObject(function_reg, function); // Uses PP. | 971 __ LoadObject(function_reg, function); // Uses PP. |
972 // Restore PP of caller. | 972 // Restore PP of caller. |
973 __ mov(PP, Operand(R7)); | 973 __ mov(PP, Operand(R7)); |
974 | 974 |
975 // Patch point is after the eventually inlined function object. | 975 // Patch point is after the eventually inlined function object. |
976 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 976 entry_patch_pc_offset_ = assembler()->CodeSize(); |
977 Isolate::kNoDeoptId, | 977 |
978 0); // No token position. | |
979 intptr_t threshold = FLAG_optimization_counter_threshold; | 978 intptr_t threshold = FLAG_optimization_counter_threshold; |
980 __ ldr(R7, FieldAddress(function_reg, | 979 __ ldr(R7, FieldAddress(function_reg, |
981 Function::usage_counter_offset())); | 980 Function::usage_counter_offset())); |
982 if (is_optimizing()) { | 981 if (is_optimizing()) { |
983 // Reoptimization of an optimized function is triggered by counting in | 982 // Reoptimization of an optimized function is triggered by counting in |
984 // IC stubs, but not at the entry of the function. | 983 // IC stubs, but not at the entry of the function. |
985 threshold = FLAG_reoptimization_counter_threshold; | 984 threshold = FLAG_reoptimization_counter_threshold; |
986 } else { | 985 } else { |
987 __ add(R7, R7, Operand(1)); | 986 __ add(R7, R7, Operand(1)); |
988 __ str(R7, FieldAddress(function_reg, | 987 __ str(R7, FieldAddress(function_reg, |
989 Function::usage_counter_offset())); | 988 Function::usage_counter_offset())); |
990 } | 989 } |
991 __ CompareImmediate(R7, threshold); | 990 __ CompareImmediate(R7, threshold); |
992 ASSERT(function_reg == R6); | 991 ASSERT(function_reg == R6); |
993 __ Branch(&StubCode::OptimizeFunctionLabel(), GE); | 992 __ Branch(&StubCode::OptimizeFunctionLabel(), GE); |
994 } else if (!flow_graph().IsCompiledForOsr()) { | 993 } else if (!flow_graph().IsCompiledForOsr()) { |
995 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 994 entry_patch_pc_offset_ = assembler()->CodeSize(); |
996 Isolate::kNoDeoptId, | |
997 0); // No token position. | |
998 } | 995 } |
999 __ Comment("Enter frame"); | 996 __ Comment("Enter frame"); |
1000 if (flow_graph().IsCompiledForOsr()) { | 997 if (flow_graph().IsCompiledForOsr()) { |
1001 intptr_t extra_slots = StackSize() | 998 intptr_t extra_slots = StackSize() |
1002 - flow_graph().num_stack_locals() | 999 - flow_graph().num_stack_locals() |
1003 - flow_graph().num_copied_params(); | 1000 - flow_graph().num_copied_params(); |
1004 ASSERT(extra_slots >= 0); | 1001 ASSERT(extra_slots >= 0); |
1005 __ EnterOsrFrame(extra_slots * kWordSize); | 1002 __ EnterOsrFrame(extra_slots * kWordSize); |
1006 } else { | 1003 } else { |
1007 ASSERT(StackSize() >= 0); | 1004 ASSERT(StackSize() >= 0); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); | 1087 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); |
1091 } | 1088 } |
1092 } | 1089 } |
1093 | 1090 |
1094 VisitBlocks(); | 1091 VisitBlocks(); |
1095 | 1092 |
1096 __ bkpt(0); | 1093 __ bkpt(0); |
1097 GenerateDeferredCode(); | 1094 GenerateDeferredCode(); |
1098 // Emit function patching code. This will be swapped with the first 3 | 1095 // Emit function patching code. This will be swapped with the first 3 |
1099 // instructions at entry point. | 1096 // instructions at entry point. |
1100 AddCurrentDescriptor(PcDescriptors::kPatchCode, | 1097 patch_code_pc_offset_ = assembler()->CodeSize(); |
1101 Isolate::kNoDeoptId, | |
1102 0); // No token position. | |
1103 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); | 1098 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); |
1104 AddCurrentDescriptor(PcDescriptors::kLazyDeoptJump, | 1099 |
1105 Isolate::kNoDeoptId, | 1100 if (is_optimizing()) { |
1106 0); // No token position. | 1101 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
1107 __ Branch(&StubCode::DeoptimizeLazyLabel()); | 1102 __ Branch(&StubCode::DeoptimizeLazyLabel()); |
| 1103 } |
1108 } | 1104 } |
1109 | 1105 |
1110 | 1106 |
1111 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1107 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
1112 const ExternalLabel* label, | 1108 const ExternalLabel* label, |
1113 PcDescriptors::Kind kind, | 1109 PcDescriptors::Kind kind, |
1114 LocationSummary* locs) { | 1110 LocationSummary* locs) { |
1115 __ BranchLinkPatchable(label); | 1111 __ BranchLinkPatchable(label); |
1116 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1112 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
1117 RecordSafepoint(locs); | 1113 RecordSafepoint(locs); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 DRegister dreg = EvenDRegisterOf(reg); | 1770 DRegister dreg = EvenDRegisterOf(reg); |
1775 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1771 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1776 } | 1772 } |
1777 | 1773 |
1778 | 1774 |
1779 #undef __ | 1775 #undef __ |
1780 | 1776 |
1781 } // namespace dart | 1777 } // namespace dart |
1782 | 1778 |
1783 #endif // defined TARGET_ARCH_ARM | 1779 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |