| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 token_pos, | 1099 token_pos, |
| 1100 &StubCode::CallStaticFunctionLabel(), | 1100 &StubCode::CallStaticFunctionLabel(), |
| 1101 PcDescriptors::kFuncCall, | 1101 PcDescriptors::kFuncCall, |
| 1102 locs); | 1102 locs); |
| 1103 AddStaticCallTarget(function); | 1103 AddStaticCallTarget(function); |
| 1104 __ Drop(argument_count); | 1104 __ Drop(argument_count); |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 | 1107 |
| 1108 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1108 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1109 const Object& obj) { | 1109 const Object& obj, |
| 1110 bool needs_number_check) { |
| 1111 if (needs_number_check) { |
| 1112 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { |
| 1113 needs_number_check = false; |
| 1114 } |
| 1115 } |
| 1116 |
| 1110 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1117 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1118 ASSERT(!needs_number_check); |
| 1111 __ testl(reg, reg); | 1119 __ testl(reg, reg); |
| 1120 return; |
| 1121 } |
| 1122 |
| 1123 if (needs_number_check) { |
| 1124 __ pushl(reg); |
| 1125 __ PushObject(obj); |
| 1126 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1127 __ popl(reg); // Discard constant. |
| 1128 __ popl(reg); // Restore 'reg'. |
| 1129 return; |
| 1130 } |
| 1131 |
| 1132 __ CompareObject(reg, obj); |
| 1133 } |
| 1134 |
| 1135 |
| 1136 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1137 Register right, |
| 1138 bool needs_number_check) { |
| 1139 if (needs_number_check) { |
| 1140 __ pushl(left); |
| 1141 __ pushl(right); |
| 1142 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1143 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1144 __ popl(right); |
| 1145 __ popl(left); |
| 1112 } else { | 1146 } else { |
| 1113 __ CompareObject(reg, obj); | 1147 __ cmpl(left, right); |
| 1114 } | 1148 } |
| 1115 } | 1149 } |
| 1116 | 1150 |
| 1117 | 1151 |
| 1118 // Implement equality spec: if any of the arguments is null do identity check. | 1152 // Implement equality spec: if any of the arguments is null do identity check. |
| 1119 // Fallthrough calls super equality. | 1153 // Fallthrough calls super equality. |
| 1120 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, | 1154 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, |
| 1121 Label* skip_call) { | 1155 Label* skip_call) { |
| 1122 const Immediate raw_null = | 1156 const Immediate raw_null = |
| 1123 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1157 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 __ popl(ECX); | 1419 __ popl(ECX); |
| 1386 __ popl(EAX); | 1420 __ popl(EAX); |
| 1387 } | 1421 } |
| 1388 | 1422 |
| 1389 | 1423 |
| 1390 #undef __ | 1424 #undef __ |
| 1391 | 1425 |
| 1392 } // namespace dart | 1426 } // namespace dart |
| 1393 | 1427 |
| 1394 #endif // defined TARGET_ARCH_IA32 | 1428 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |