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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 __ addq(new_pc, Immediate(offset)); | 993 __ addq(new_pc, Immediate(offset)); |
994 } | 994 } |
995 | 995 |
996 // Load callee's pool pointer. | 996 // Load callee's pool pointer. |
997 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset)); | 997 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset)); |
998 | 998 |
999 // Load function object using the callee's pool pointer. | 999 // Load function object using the callee's pool pointer. |
1000 __ LoadObject(function_reg, function, new_pp); | 1000 __ LoadObject(function_reg, function, new_pp); |
1001 | 1001 |
1002 // Patch point is after the eventually inlined function object. | 1002 // Patch point is after the eventually inlined function object. |
1003 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 1003 entry_patch_pc_offset_ = assembler()->CodeSize(); |
1004 Isolate::kNoDeoptId, | 1004 |
1005 0); // No token position. | |
1006 if (is_optimizing()) { | 1005 if (is_optimizing()) { |
1007 // Reoptimization of an optimized function is triggered by counting in | 1006 // Reoptimization of an optimized function is triggered by counting in |
1008 // IC stubs, but not at the entry of the function. | 1007 // IC stubs, but not at the entry of the function. |
1009 __ CompareImmediate( | 1008 __ CompareImmediate( |
1010 FieldAddress(function_reg, Function::usage_counter_offset()), | 1009 FieldAddress(function_reg, Function::usage_counter_offset()), |
1011 Immediate(FLAG_reoptimization_counter_threshold), | 1010 Immediate(FLAG_reoptimization_counter_threshold), |
1012 new_pp); | 1011 new_pp); |
1013 } else { | 1012 } else { |
1014 __ incq(FieldAddress(function_reg, Function::usage_counter_offset())); | 1013 __ incq(FieldAddress(function_reg, Function::usage_counter_offset())); |
1015 __ CompareImmediate( | 1014 __ CompareImmediate( |
(...skipping 19 matching lines...) Expand all Loading... |
1035 __ CodeSize(); | 1034 __ CodeSize(); |
1036 const intptr_t offset = | 1035 const intptr_t offset = |
1037 Assembler::kEntryPointToPcMarkerOffset - __ CodeSize(); | 1036 Assembler::kEntryPointToPcMarkerOffset - __ CodeSize(); |
1038 __ popq(new_pc); | 1037 __ popq(new_pc); |
1039 if (offset != 0) { | 1038 if (offset != 0) { |
1040 __ addq(new_pc, Immediate(offset)); | 1039 __ addq(new_pc, Immediate(offset)); |
1041 } | 1040 } |
1042 | 1041 |
1043 // Load callee's pool pointer. | 1042 // Load callee's pool pointer. |
1044 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset)); | 1043 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset)); |
1045 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 1044 |
1046 Isolate::kNoDeoptId, | 1045 entry_patch_pc_offset_ = assembler()->CodeSize(); |
1047 0); // No token position. | |
1048 } | 1046 } |
1049 __ Comment("Enter frame"); | 1047 __ Comment("Enter frame"); |
1050 if (flow_graph().IsCompiledForOsr()) { | 1048 if (flow_graph().IsCompiledForOsr()) { |
1051 intptr_t extra_slots = StackSize() | 1049 intptr_t extra_slots = StackSize() |
1052 - flow_graph().num_stack_locals() | 1050 - flow_graph().num_stack_locals() |
1053 - flow_graph().num_copied_params(); | 1051 - flow_graph().num_copied_params(); |
1054 ASSERT(extra_slots >= 0); | 1052 ASSERT(extra_slots >= 0); |
1055 __ EnterOsrFrame(extra_slots * kWordSize, new_pp, new_pc); | 1053 __ EnterOsrFrame(extra_slots * kWordSize, new_pp, new_pc); |
1056 } else { | 1054 } else { |
1057 ASSERT(StackSize() >= 0); | 1055 ASSERT(StackSize() >= 0); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 } | 1133 } |
1136 } | 1134 } |
1137 | 1135 |
1138 ASSERT(!block_order().is_empty()); | 1136 ASSERT(!block_order().is_empty()); |
1139 VisitBlocks(); | 1137 VisitBlocks(); |
1140 | 1138 |
1141 __ int3(); | 1139 __ int3(); |
1142 GenerateDeferredCode(); | 1140 GenerateDeferredCode(); |
1143 // Emit function patching code. This will be swapped with the first 13 bytes | 1141 // Emit function patching code. This will be swapped with the first 13 bytes |
1144 // at entry point. | 1142 // at entry point. |
1145 AddCurrentDescriptor(PcDescriptors::kPatchCode, | 1143 patch_code_pc_offset_ = assembler()->CodeSize(); |
1146 Isolate::kNoDeoptId, | |
1147 0); // No token position. | |
1148 // This is patched up to a point in FrameEntry where the PP for the | 1144 // This is patched up to a point in FrameEntry where the PP for the |
1149 // current function is in R13 instead of PP. | 1145 // current function is in R13 instead of PP. |
1150 __ JmpPatchable(&StubCode::FixCallersTargetLabel(), R13); | 1146 __ JmpPatchable(&StubCode::FixCallersTargetLabel(), R13); |
1151 | 1147 |
1152 AddCurrentDescriptor(PcDescriptors::kLazyDeoptJump, | 1148 if (is_optimizing()) { |
1153 Isolate::kNoDeoptId, | 1149 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
1154 0); // No token position. | 1150 __ Jmp(&StubCode::DeoptimizeLazyLabel(), PP); |
1155 __ Jmp(&StubCode::DeoptimizeLazyLabel(), PP); | 1151 } |
1156 } | 1152 } |
1157 | 1153 |
1158 | 1154 |
1159 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1155 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
1160 const ExternalLabel* label, | 1156 const ExternalLabel* label, |
1161 PcDescriptors::Kind kind, | 1157 PcDescriptors::Kind kind, |
1162 LocationSummary* locs) { | 1158 LocationSummary* locs) { |
1163 __ Call(label, PP); | 1159 __ Call(label, PP); |
1164 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1160 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
1165 RecordSafepoint(locs); | 1161 RecordSafepoint(locs); |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 __ movups(reg, Address(RSP, 0)); | 1770 __ movups(reg, Address(RSP, 0)); |
1775 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1771 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
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_X64 | 1779 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |