| 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 const ExternalLabel* label, | 1002 const ExternalLabel* label, |
| 1003 PcDescriptors::Kind kind, | 1003 PcDescriptors::Kind kind, |
| 1004 LocationSummary* locs) { | 1004 LocationSummary* locs) { |
| 1005 ASSERT(!IsLeaf()); | 1005 ASSERT(!IsLeaf()); |
| 1006 __ call(label); | 1006 __ call(label); |
| 1007 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1007 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
| 1008 RecordSafepoint(locs); | 1008 RecordSafepoint(locs); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 | 1011 |
| 1012 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1013 intptr_t token_pos, |
| 1014 const ExternalLabel* label, |
| 1015 PcDescriptors::Kind kind, |
| 1016 LocationSummary* locs) { |
| 1017 ASSERT(!IsLeaf()); |
| 1018 __ call(label); |
| 1019 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1020 RecordSafepoint(locs); |
| 1021 // Marks either the continuation point in unoptimized code or the |
| 1022 // deoptimization point in optimized code, after call. |
| 1023 if (is_optimizing()) { |
| 1024 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1025 } else { |
| 1026 // Add deoptimization continuation point after the call and before the |
| 1027 // arguments are removed. |
| 1028 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, |
| 1029 deopt_id, |
| 1030 token_pos); |
| 1031 } |
| 1032 } |
| 1033 |
| 1034 |
| 1012 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, | 1035 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, |
| 1013 intptr_t token_pos, | 1036 intptr_t token_pos, |
| 1014 const RuntimeEntry& entry, | 1037 const RuntimeEntry& entry, |
| 1015 LocationSummary* locs) { | 1038 LocationSummary* locs) { |
| 1016 ASSERT(!IsLeaf()); | 1039 ASSERT(!IsLeaf()); |
| 1017 __ CallRuntime(entry); | 1040 __ CallRuntime(entry); |
| 1018 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); | 1041 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); |
| 1019 RecordSafepoint(locs); | 1042 RecordSafepoint(locs); |
| 1020 } | 1043 } |
| 1021 | 1044 |
| 1022 | 1045 |
| 1023 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1046 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1024 const ICData& ic_data, | 1047 const ICData& ic_data, |
| 1025 const Array& arguments_descriptor, | 1048 const Array& arguments_descriptor, |
| 1026 intptr_t argument_count, | 1049 intptr_t argument_count, |
| 1027 intptr_t deopt_id, | 1050 intptr_t deopt_id, |
| 1028 intptr_t token_pos, | 1051 intptr_t token_pos, |
| 1029 LocationSummary* locs) { | 1052 LocationSummary* locs) { |
| 1030 ASSERT(!IsLeaf()); | 1053 ASSERT(!IsLeaf()); |
| 1031 __ LoadObject(RBX, ic_data); | 1054 __ LoadObject(RBX, ic_data); |
| 1032 __ LoadObject(R10, arguments_descriptor); | 1055 __ LoadObject(R10, arguments_descriptor); |
| 1033 | 1056 GenerateDartCall(deopt_id, |
| 1034 __ call(target_label); | 1057 token_pos, |
| 1035 AddCurrentDescriptor(PcDescriptors::kIcCall, deopt_id, token_pos); | 1058 target_label, |
| 1036 RecordSafepoint(locs); | 1059 PcDescriptors::kIcCall, |
| 1037 | 1060 locs); |
| 1038 __ Drop(argument_count); | 1061 __ Drop(argument_count); |
| 1039 } | 1062 } |
| 1040 | 1063 |
| 1041 | 1064 |
| 1042 void FlowGraphCompiler::EmitStaticCall(const Function& function, | 1065 void FlowGraphCompiler::EmitStaticCall(const Function& function, |
| 1043 const Array& arguments_descriptor, | 1066 const Array& arguments_descriptor, |
| 1044 intptr_t argument_count, | 1067 intptr_t argument_count, |
| 1045 intptr_t deopt_id, | 1068 intptr_t deopt_id, |
| 1046 intptr_t token_pos, | 1069 intptr_t token_pos, |
| 1047 LocationSummary* locs) { | 1070 LocationSummary* locs) { |
| 1048 ASSERT(!IsLeaf()); | 1071 ASSERT(!IsLeaf()); |
| 1049 __ LoadObject(RBX, function); | 1072 __ LoadObject(RBX, function); |
| 1050 __ LoadObject(R10, arguments_descriptor); | 1073 __ LoadObject(R10, arguments_descriptor); |
| 1051 __ call(&StubCode::CallStaticFunctionLabel()); | 1074 GenerateDartCall(deopt_id, |
| 1052 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); | 1075 token_pos, |
| 1053 RecordSafepoint(locs); | 1076 &StubCode::CallStaticFunctionLabel(), |
| 1054 if (is_optimizing()) { | 1077 PcDescriptors::kFuncCall, |
| 1055 AddDeoptIndexAtCall(deopt_id, token_pos); | 1078 locs); |
| 1056 } | |
| 1057 __ Drop(argument_count); | 1079 __ Drop(argument_count); |
| 1058 } | 1080 } |
| 1059 | 1081 |
| 1060 | 1082 |
| 1061 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | 1083 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 1062 // if no match or instance is Smi. | 1084 // if no match or instance is Smi. |
| 1063 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, | 1085 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, |
| 1064 Register instance_reg, | 1086 Register instance_reg, |
| 1065 Register temp_reg, | 1087 Register temp_reg, |
| 1066 Label* deopt) { | 1088 Label* deopt) { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1314 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1293 __ Exchange(mem1, mem2); | 1315 __ Exchange(mem1, mem2); |
| 1294 } | 1316 } |
| 1295 | 1317 |
| 1296 | 1318 |
| 1297 #undef __ | 1319 #undef __ |
| 1298 | 1320 |
| 1299 } // namespace dart | 1321 } // namespace dart |
| 1300 | 1322 |
| 1301 #endif // defined TARGET_ARCH_X64 | 1323 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |