| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const intptr_t offset = assem->CodeSize(); | 45 const intptr_t offset = assem->CodeSize(); |
| 46 __ Bind(&L); | 46 __ Bind(&L); |
| 47 __ popq(RAX); | 47 __ popq(RAX); |
| 48 __ subq(RAX, | 48 __ subq(RAX, |
| 49 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); | 49 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); |
| 50 __ movq(Address(RBP, -kWordSize), RAX); | 50 __ movq(Address(RBP, -kWordSize), RAX); |
| 51 __ popq(RAX); // Restore RAX. | 51 __ popq(RAX); // Restore RAX. |
| 52 } | 52 } |
| 53 __ call(&StubCode::DeoptimizeLabel()); | 53 __ call(&StubCode::DeoptimizeLabel()); |
| 54 const intptr_t deopt_info_index = stub_ix; | 54 const intptr_t deopt_info_index = stub_ix; |
| 55 compiler->pc_descriptors_list()->AddDeoptInfo( | 55 compiler->pc_descriptors_list()->AddDeoptIndex( |
| 56 compiler->assembler()->CodeSize(), | 56 compiler->assembler()->CodeSize(), |
| 57 deopt_id_, | 57 deopt_id_, |
| 58 reason_, | 58 reason_, |
| 59 deopt_info_index); | 59 deopt_info_index); |
| 60 __ int3(); | 60 __ int3(); |
| 61 #undef __ | 61 #undef __ |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 #define __ assembler()-> | 65 #define __ assembler()-> |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 const ExternalLabel* label, | 1004 const ExternalLabel* label, |
| 1005 PcDescriptors::Kind kind, | 1005 PcDescriptors::Kind kind, |
| 1006 LocationSummary* locs) { | 1006 LocationSummary* locs) { |
| 1007 ASSERT(!IsLeaf()); | 1007 ASSERT(!IsLeaf()); |
| 1008 __ call(label); | 1008 __ call(label); |
| 1009 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1009 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
| 1010 RecordSafepoint(locs); | 1010 RecordSafepoint(locs); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 | 1013 |
| 1014 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1015 intptr_t token_pos, |
| 1016 const ExternalLabel* label, |
| 1017 PcDescriptors::Kind kind, |
| 1018 LocationSummary* locs) { |
| 1019 ASSERT(!IsLeaf()); |
| 1020 __ call(label); |
| 1021 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1022 RecordSafepoint(locs); |
| 1023 // Marks either the continuation point in unoptimized code or the |
| 1024 // deoptimization point in optimized code, after call. |
| 1025 if (is_optimizing()) { |
| 1026 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1027 } else { |
| 1028 // Add deoptimization continuation point after the call and before the |
| 1029 // arguments are removed. |
| 1030 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, |
| 1031 deopt_id, |
| 1032 token_pos); |
| 1033 } |
| 1034 } |
| 1035 |
| 1036 |
| 1014 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, | 1037 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, |
| 1015 intptr_t token_pos, | 1038 intptr_t token_pos, |
| 1016 const RuntimeEntry& entry, | 1039 const RuntimeEntry& entry, |
| 1017 LocationSummary* locs) { | 1040 LocationSummary* locs) { |
| 1018 ASSERT(!IsLeaf()); | 1041 ASSERT(!IsLeaf()); |
| 1019 __ CallRuntime(entry); | 1042 __ CallRuntime(entry); |
| 1020 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); | 1043 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); |
| 1021 RecordSafepoint(locs); | 1044 RecordSafepoint(locs); |
| 1022 } | 1045 } |
| 1023 | 1046 |
| 1024 | 1047 |
| 1025 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1048 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1026 const ICData& ic_data, | 1049 const ICData& ic_data, |
| 1027 const Array& arguments_descriptor, | 1050 const Array& arguments_descriptor, |
| 1028 intptr_t argument_count, | 1051 intptr_t argument_count, |
| 1029 intptr_t deopt_id, | 1052 intptr_t deopt_id, |
| 1030 intptr_t token_pos, | 1053 intptr_t token_pos, |
| 1031 LocationSummary* locs) { | 1054 LocationSummary* locs) { |
| 1032 ASSERT(!IsLeaf()); | 1055 ASSERT(!IsLeaf()); |
| 1033 __ LoadObject(RBX, ic_data); | 1056 __ LoadObject(RBX, ic_data); |
| 1034 __ LoadObject(R10, arguments_descriptor); | 1057 __ LoadObject(R10, arguments_descriptor); |
| 1035 | 1058 GenerateDartCall(deopt_id, |
| 1036 __ call(target_label); | 1059 token_pos, |
| 1037 AddCurrentDescriptor(PcDescriptors::kIcCall, deopt_id, token_pos); | 1060 target_label, |
| 1038 RecordSafepoint(locs); | 1061 PcDescriptors::kIcCall, |
| 1039 | 1062 locs); |
| 1040 __ Drop(argument_count); | 1063 __ Drop(argument_count); |
| 1041 } | 1064 } |
| 1042 | 1065 |
| 1043 | 1066 |
| 1044 void FlowGraphCompiler::EmitStaticCall(const Function& function, | 1067 void FlowGraphCompiler::EmitStaticCall(const Function& function, |
| 1045 const Array& arguments_descriptor, | 1068 const Array& arguments_descriptor, |
| 1046 intptr_t argument_count, | 1069 intptr_t argument_count, |
| 1047 intptr_t deopt_id, | 1070 intptr_t deopt_id, |
| 1048 intptr_t token_pos, | 1071 intptr_t token_pos, |
| 1049 LocationSummary* locs) { | 1072 LocationSummary* locs) { |
| 1050 ASSERT(!IsLeaf()); | 1073 ASSERT(!IsLeaf()); |
| 1051 __ LoadObject(RBX, function); | 1074 __ LoadObject(RBX, function); |
| 1052 __ LoadObject(R10, arguments_descriptor); | 1075 __ LoadObject(R10, arguments_descriptor); |
| 1053 __ call(&StubCode::CallStaticFunctionLabel()); | 1076 GenerateDartCall(deopt_id, |
| 1054 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); | 1077 token_pos, |
| 1055 RecordSafepoint(locs); | 1078 &StubCode::CallStaticFunctionLabel(), |
| 1056 if (is_optimizing()) { | 1079 PcDescriptors::kFuncCall, |
| 1057 AddDeoptIndexAtCall(deopt_id, token_pos); | 1080 locs); |
| 1058 } | |
| 1059 __ Drop(argument_count); | 1081 __ Drop(argument_count); |
| 1060 } | 1082 } |
| 1061 | 1083 |
| 1062 | 1084 |
| 1063 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1085 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
| 1064 Register reg, | 1086 Register reg, |
| 1065 Register temp, | 1087 Register temp, |
| 1066 Label* not_double_or_smi) { | 1088 Label* not_double_or_smi) { |
| 1067 Label is_smi, done; | 1089 Label is_smi, done; |
| 1068 __ testq(reg, Immediate(kSmiTagMask)); | 1090 __ testq(reg, Immediate(kSmiTagMask)); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1293 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1272 __ Exchange(mem1, mem2); | 1294 __ Exchange(mem1, mem2); |
| 1273 } | 1295 } |
| 1274 | 1296 |
| 1275 | 1297 |
| 1276 #undef __ | 1298 #undef __ |
| 1277 | 1299 |
| 1278 } // namespace dart | 1300 } // namespace dart |
| 1279 | 1301 |
| 1280 #endif // defined TARGET_ARCH_X64 | 1302 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |