Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 11230034: Fix super ==: Test first for null before call inf super ==. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, 1130 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg,
1131 const Object& obj) { 1131 const Object& obj) {
1132 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { 1132 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) {
1133 __ testl(reg, reg); 1133 __ testl(reg, reg);
1134 } else { 1134 } else {
1135 __ CompareObject(reg, obj); 1135 __ CompareObject(reg, obj);
1136 } 1136 }
1137 } 1137 }
1138 1138
1139 1139
1140 // Implement equality spec: if any of the arguments is null do identity check.
1141 // Fallthrough calls super equality.
1142 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result,
1143 Label* skip_call) {
1144 const Immediate raw_null =
1145 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1146 Label check_identity, fall_through;
1147 __ cmpl(Address(ESP, 0 * kWordSize), raw_null);
1148 __ j(EQUAL, &check_identity, Assembler::kNearJump);
1149 __ cmpl(Address(ESP, 1 * kWordSize), raw_null);
1150 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1151
1152 __ Bind(&check_identity);
1153 __ popl(result);
1154 __ cmpl(result, Address(ESP, 1 * kWordSize));
1155 Label is_false;
1156 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump);
1157 __ LoadObject(result, bool_true());
1158 __ Drop(1);
1159 __ jmp(skip_call);
1160 __ Bind(&is_false);
1161 __ LoadObject(result, bool_false());
1162 __ Drop(1);
1163 __ jmp(skip_call);
1164 __ Bind(&fall_through);
1165 }
1166
1167
1140 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, 1168 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result,
1141 Register reg, 1169 Register reg,
1142 Register temp, 1170 Register temp,
1143 Label* not_double_or_smi) { 1171 Label* not_double_or_smi) {
1144 Label is_smi, done; 1172 Label is_smi, done;
1145 __ testl(reg, Immediate(kSmiTagMask)); 1173 __ testl(reg, Immediate(kSmiTagMask));
1146 __ j(ZERO, &is_smi); 1174 __ j(ZERO, &is_smi);
1147 __ CompareClassId(reg, kDoubleCid, temp); 1175 __ CompareClassId(reg, kDoubleCid, temp);
1148 __ j(NOT_EQUAL, not_double_or_smi); 1176 __ j(NOT_EQUAL, not_double_or_smi);
1149 __ movsd(result, FieldAddress(reg, Double::value_offset())); 1177 __ movsd(result, FieldAddress(reg, Double::value_offset()));
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 __ popl(ECX); 1407 __ popl(ECX);
1380 __ popl(EAX); 1408 __ popl(EAX);
1381 } 1409 }
1382 1410
1383 1411
1384 #undef __ 1412 #undef __
1385 1413
1386 } // namespace dart 1414 } // namespace dart
1387 1415
1388 #endif // defined TARGET_ARCH_IA32 1416 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698