| 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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 __ call(&StubCode::CallStaticFunctionLabel()); | 1051 __ call(&StubCode::CallStaticFunctionLabel()); |
| 1052 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); | 1052 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); |
| 1053 RecordSafepoint(locs); | 1053 RecordSafepoint(locs); |
| 1054 if (is_optimizing()) { | 1054 if (is_optimizing()) { |
| 1055 AddDeoptIndexAtCall(deopt_id, token_pos); | 1055 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1056 } | 1056 } |
| 1057 __ Drop(argument_count); | 1057 __ Drop(argument_count); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 | 1060 |
| 1061 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | |
| 1062 // if no match or instance is Smi. | |
| 1063 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, | |
| 1064 Register instance_reg, | |
| 1065 Register temp_reg, | |
| 1066 Label* deopt) { | |
| 1067 Label ok; | |
| 1068 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmiCid); | |
| 1069 __ testq(instance_reg, Immediate(kSmiTagMask)); | |
| 1070 __ j(ZERO, deopt); | |
| 1071 Label is_ok; | |
| 1072 const intptr_t num_checks = ic_data.NumberOfChecks(); | |
| 1073 const bool use_near_jump = num_checks < 5; | |
| 1074 __ LoadClassId(temp_reg, instance_reg); | |
| 1075 for (intptr_t i = 0; i < num_checks; i++) { | |
| 1076 __ cmpl(temp_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); | |
| 1077 if (i == (num_checks - 1)) { | |
| 1078 __ j(NOT_EQUAL, deopt); | |
| 1079 } else { | |
| 1080 if (use_near_jump) { | |
| 1081 __ j(EQUAL, &is_ok, Assembler::kNearJump); | |
| 1082 } else { | |
| 1083 __ j(EQUAL, &is_ok); | |
| 1084 } | |
| 1085 } | |
| 1086 } | |
| 1087 __ Bind(&is_ok); | |
| 1088 } | |
| 1089 | |
| 1090 | |
| 1091 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1061 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
| 1092 Register reg, | 1062 Register reg, |
| 1093 Register temp, | 1063 Register temp, |
| 1094 Label* not_double_or_smi) { | 1064 Label* not_double_or_smi) { |
| 1095 Label is_smi, done; | 1065 Label is_smi, done; |
| 1096 __ testq(reg, Immediate(kSmiTagMask)); | 1066 __ testq(reg, Immediate(kSmiTagMask)); |
| 1097 __ j(ZERO, &is_smi); | 1067 __ j(ZERO, &is_smi); |
| 1098 __ CompareClassId(reg, kDoubleCid); | 1068 __ CompareClassId(reg, kDoubleCid); |
| 1099 __ j(NOT_EQUAL, not_double_or_smi); | 1069 __ j(NOT_EQUAL, not_double_or_smi); |
| 1100 __ movsd(result, FieldAddress(reg, Double::value_offset())); | 1070 __ movsd(result, FieldAddress(reg, Double::value_offset())); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1262 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1293 __ Exchange(mem1, mem2); | 1263 __ Exchange(mem1, mem2); |
| 1294 } | 1264 } |
| 1295 | 1265 |
| 1296 | 1266 |
| 1297 #undef __ | 1267 #undef __ |
| 1298 | 1268 |
| 1299 } // namespace dart | 1269 } // namespace dart |
| 1300 | 1270 |
| 1301 #endif // defined TARGET_ARCH_X64 | 1271 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |