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

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 7918012: Unify the handling of comparinsons against null and undefined. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 months 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { 208 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) {
209 stream->Add("if "); 209 stream->Add("if ");
210 InputAt(0)->PrintTo(stream); 210 InputAt(0)->PrintTo(stream);
211 stream->Add(" %s ", Token::String(op())); 211 stream->Add(" %s ", Token::String(op()));
212 InputAt(1)->PrintTo(stream); 212 InputAt(1)->PrintTo(stream);
213 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 213 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
214 } 214 }
215 215
216 216
217 void LIsNullAndBranch::PrintDataTo(StringStream* stream) { 217 void LIsNilAndBranch::PrintDataTo(StringStream* stream) {
218 stream->Add("if "); 218 stream->Add("if ");
219 InputAt(0)->PrintTo(stream); 219 InputAt(0)->PrintTo(stream);
220 stream->Add(is_strict() ? " === null" : " == null"); 220 stream->Add(kind() == kStrictEquality ? " === " : " == ");
221 stream->Add(nil() == kNullValue ? "null" : "undefined");
221 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 222 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
222 } 223 }
223 224
224 225
225 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { 226 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
226 stream->Add("if is_object("); 227 stream->Add("if is_object(");
227 InputAt(0)->PrintTo(stream); 228 InputAt(0)->PrintTo(stream);
228 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
229 } 230 }
230 231
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 return new LCmpObjectEqAndBranch(left, right); 1465 return new LCmpObjectEqAndBranch(left, right);
1465 } 1466 }
1466 1467
1467 1468
1468 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch( 1469 LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch(
1469 HCompareConstantEqAndBranch* instr) { 1470 HCompareConstantEqAndBranch* instr) {
1470 return new LCmpConstantEqAndBranch(UseRegisterAtStart(instr->value())); 1471 return new LCmpConstantEqAndBranch(UseRegisterAtStart(instr->value()));
1471 } 1472 }
1472 1473
1473 1474
1474 LInstruction* LChunkBuilder::DoIsNullAndBranch(HIsNullAndBranch* instr) { 1475 LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
1475 // We only need a temp register for non-strict compare. 1476 // We only need a temp register for non-strict compare.
1476 LOperand* temp = instr->is_strict() ? NULL : TempRegister(); 1477 LOperand* temp = instr->kind() == kStrictEquality ? NULL : TempRegister();
1477 return new LIsNullAndBranch(UseRegisterAtStart(instr->value()), temp); 1478 return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp);
1478 } 1479 }
1479 1480
1480 1481
1481 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1482 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1482 ASSERT(instr->value()->representation().IsTagged()); 1483 ASSERT(instr->value()->representation().IsTagged());
1483 LOperand* temp = TempRegister(); 1484 LOperand* temp = TempRegister();
1484 return new LIsObjectAndBranch(UseRegister(instr->value()), temp); 1485 return new LIsObjectAndBranch(UseRegister(instr->value()), temp);
1485 } 1486 }
1486 1487
1487 1488
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 LOperand* key = UseOrConstantAtStart(instr->key()); 2259 LOperand* key = UseOrConstantAtStart(instr->key());
2259 LOperand* object = UseOrConstantAtStart(instr->object()); 2260 LOperand* object = UseOrConstantAtStart(instr->object());
2260 LIn* result = new LIn(context, key, object); 2261 LIn* result = new LIn(context, key, object);
2261 return MarkAsCall(DefineFixed(result, eax), instr); 2262 return MarkAsCall(DefineFixed(result, eax), instr);
2262 } 2263 }
2263 2264
2264 2265
2265 } } // namespace v8::internal 2266 } } // namespace v8::internal
2266 2267
2267 #endif // V8_TARGET_ARCH_IA32 2268 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/mips/full-codegen-mips.cc » ('j') | src/v8.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698