| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 token_pos, | 1103 token_pos, |
| 1104 &StubCode::CallStaticFunctionLabel(), | 1104 &StubCode::CallStaticFunctionLabel(), |
| 1105 PcDescriptors::kFuncCall, | 1105 PcDescriptors::kFuncCall, |
| 1106 locs); | 1106 locs); |
| 1107 AddStaticCallTarget(function); | 1107 AddStaticCallTarget(function); |
| 1108 __ Drop(argument_count); | 1108 __ Drop(argument_count); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 | 1111 |
| 1112 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1112 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1113 const Object& obj) { | 1113 const Object& obj, |
| 1114 bool needs_number_check) { |
| 1115 if (needs_number_check) { |
| 1116 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { |
| 1117 needs_number_check = false; |
| 1118 } |
| 1119 } |
| 1120 |
| 1114 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1121 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1122 ASSERT(!needs_number_check); |
| 1115 __ testq(reg, reg); | 1123 __ testq(reg, reg); |
| 1124 return; |
| 1125 } |
| 1126 |
| 1127 if (needs_number_check) { |
| 1128 __ pushq(reg); |
| 1129 __ PushObject(obj); |
| 1130 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1131 __ popq(reg); // Discard constant. |
| 1132 __ popq(reg); // Restore 'reg'. |
| 1133 return; |
| 1134 } |
| 1135 |
| 1136 __ CompareObject(reg, obj); |
| 1137 } |
| 1138 |
| 1139 |
| 1140 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1141 Register right, |
| 1142 bool needs_number_check) { |
| 1143 if (needs_number_check) { |
| 1144 __ pushq(left); |
| 1145 __ pushq(right); |
| 1146 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1147 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1148 __ popq(right); |
| 1149 __ popq(left); |
| 1116 } else { | 1150 } else { |
| 1117 __ CompareObject(reg, obj); | 1151 __ cmpl(left, right); |
| 1118 } | 1152 } |
| 1119 } | 1153 } |
| 1120 | 1154 |
| 1121 | 1155 |
| 1122 // Implement equality spec: if any of the arguments is null do identity check. | 1156 // Implement equality spec: if any of the arguments is null do identity check. |
| 1123 // Fallthrough calls super equality. | 1157 // Fallthrough calls super equality. |
| 1124 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, | 1158 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, |
| 1125 Label* skip_call) { | 1159 Label* skip_call) { |
| 1126 const Immediate raw_null = | 1160 const Immediate raw_null = |
| 1127 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1161 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1397 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1364 __ Exchange(mem1, mem2); | 1398 __ Exchange(mem1, mem2); |
| 1365 } | 1399 } |
| 1366 | 1400 |
| 1367 | 1401 |
| 1368 #undef __ | 1402 #undef __ |
| 1369 | 1403 |
| 1370 } // namespace dart | 1404 } // namespace dart |
| 1371 | 1405 |
| 1372 #endif // defined TARGET_ARCH_X64 | 1406 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |