Chromium Code Reviews| 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 } | |
| 1110 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1116 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1117 ASSERT(!needs_number_check); | |
| 1111 __ testl(reg, reg); | 1118 __ testl(reg, reg); |
| 1112 } else { | 1119 } else { |
|
Florian Schneider
2012/11/23 10:33:40
Maybe reduce the nesting level by using
} else if
srdjan
2012/11/23 19:45:39
changed to use returns instead of else.
| |
| 1113 __ CompareObject(reg, obj); | 1120 if (needs_number_check) { |
| 1121 __ pushl(reg); | |
| 1122 __ PushObject(obj); | |
| 1123 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | |
|
Florian Schneider
2012/11/23 10:33:40
Maybe add comment that the stub return result in t
srdjan
2012/11/23 19:45:39
Done.
| |
| 1124 __ popl(reg); // Discard constant. | |
| 1125 __ popl(reg); // Restore 'reg'. | |
| 1126 } else { | |
| 1127 __ CompareObject(reg, obj); | |
| 1128 } | |
| 1129 } | |
| 1130 } | |
| 1131 | |
| 1132 | |
| 1133 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | |
| 1134 Register right, | |
| 1135 bool needs_number_check) { | |
| 1136 if (needs_number_check) { | |
| 1137 __ pushl(left); | |
| 1138 __ pushl(right); | |
| 1139 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | |
| 1140 __ popl(right); | |
| 1141 __ popl(left); | |
| 1142 } else { | |
| 1143 __ cmpl(left, right); | |
| 1114 } | 1144 } |
| 1115 } | 1145 } |
| 1116 | 1146 |
| 1117 | 1147 |
| 1118 // Implement equality spec: if any of the arguments is null do identity check. | 1148 // Implement equality spec: if any of the arguments is null do identity check. |
| 1119 // Fallthrough calls super equality. | 1149 // Fallthrough calls super equality. |
| 1120 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, | 1150 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, |
| 1121 Label* skip_call) { | 1151 Label* skip_call) { |
| 1122 const Immediate raw_null = | 1152 const Immediate raw_null = |
| 1123 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1153 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 __ popl(ECX); | 1415 __ popl(ECX); |
| 1386 __ popl(EAX); | 1416 __ popl(EAX); |
| 1387 } | 1417 } |
| 1388 | 1418 |
| 1389 | 1419 |
| 1390 #undef __ | 1420 #undef __ |
| 1391 | 1421 |
| 1392 } // namespace dart | 1422 } // namespace dart |
| 1393 | 1423 |
| 1394 #endif // defined TARGET_ARCH_IA32 | 1424 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |