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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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_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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, 1135 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg,
1136 const Object& obj) { 1136 const Object& obj) {
1137 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { 1137 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) {
1138 __ testq(reg, reg); 1138 __ testq(reg, reg);
1139 } else { 1139 } else {
1140 __ CompareObject(reg, obj); 1140 __ CompareObject(reg, obj);
1141 } 1141 }
1142 } 1142 }
1143 1143
1144 1144
1145 // Implement equality spec: if any of the arguments is null do identity check.
1146 // Fallthrough calls super equality.
1147 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result,
1148 Label* skip_call) {
1149 const Immediate raw_null =
1150 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1151 Label check_identity, fall_through;
1152 __ cmpq(Address(RSP, 0 * kWordSize), raw_null);
1153 __ j(EQUAL, &check_identity, Assembler::kNearJump);
1154 __ cmpq(Address(RSP, 1 * kWordSize), raw_null);
1155 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1156
1157 __ Bind(&check_identity);
1158 __ popq(result);
1159 __ cmpq(result, Address(RSP, 1 * kWordSize));
1160 Label is_false;
1161 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump);
1162 __ LoadObject(result, bool_true());
1163 __ Drop(1);
1164 __ jmp(skip_call);
1165 __ Bind(&is_false);
1166 __ LoadObject(result, bool_false());
1167 __ Drop(1);
1168 __ jmp(skip_call);
1169 __ Bind(&fall_through);
1170 }
1171
1172
1145 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, 1173 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result,
1146 Register reg, 1174 Register reg,
1147 Register temp, 1175 Register temp,
1148 Label* not_double_or_smi) { 1176 Label* not_double_or_smi) {
1149 Label is_smi, done; 1177 Label is_smi, done;
1150 __ testq(reg, Immediate(kSmiTagMask)); 1178 __ testq(reg, Immediate(kSmiTagMask));
1151 __ j(ZERO, &is_smi); 1179 __ j(ZERO, &is_smi);
1152 __ CompareClassId(reg, kDoubleCid); 1180 __ CompareClassId(reg, kDoubleCid);
1153 __ j(NOT_EQUAL, not_double_or_smi); 1181 __ j(NOT_EQUAL, not_double_or_smi);
1154 __ movsd(result, FieldAddress(reg, Double::value_offset())); 1182 __ movsd(result, FieldAddress(reg, Double::value_offset()));
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { 1386 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) {
1359 __ Exchange(mem1, mem2); 1387 __ Exchange(mem1, mem2);
1360 } 1388 }
1361 1389
1362 1390
1363 #undef __ 1391 #undef __
1364 1392
1365 } // namespace dart 1393 } // namespace dart
1366 1394
1367 #endif // defined TARGET_ARCH_X64 1395 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698