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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 21210002: Avoid redundant smi check for Math.abs (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 4 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 3450
3451 ASSERT(instr->value()->Equals(instr->result())); 3451 ASSERT(instr->value()->Equals(instr->result()));
3452 Representation r = instr->hydrogen()->value()->representation(); 3452 Representation r = instr->hydrogen()->value()->representation();
3453 3453
3454 if (r.IsDouble()) { 3454 if (r.IsDouble()) {
3455 XMMRegister scratch = xmm0; 3455 XMMRegister scratch = xmm0;
3456 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3456 XMMRegister input_reg = ToDoubleRegister(instr->value());
3457 __ xorps(scratch, scratch); 3457 __ xorps(scratch, scratch);
3458 __ subsd(scratch, input_reg); 3458 __ subsd(scratch, input_reg);
3459 __ andpd(input_reg, scratch); 3459 __ andpd(input_reg, scratch);
3460 } else if (r.IsInteger32()) { 3460 } else if (r.IsInteger32() || r.IsSmi()) {
Jakob Kummerow 2013/07/31 12:27:27 This code is wrong. EmitIntegerMathAbs() uses test
3461 EmitIntegerMathAbs(instr); 3461 EmitIntegerMathAbs(instr);
3462 } else { // Tagged case. 3462 } else { // Tagged case.
3463 DeferredMathAbsTaggedHeapNumber* deferred = 3463 DeferredMathAbsTaggedHeapNumber* deferred =
3464 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3464 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3465 Register input_reg = ToRegister(instr->value()); 3465 Register input_reg = ToRegister(instr->value());
3466 // Smi check. 3466 // Smi check.
3467 __ JumpIfNotSmi(input_reg, deferred->entry()); 3467 __ JumpIfNotSmi(input_reg, deferred->entry());
3468 __ SmiToInteger32(input_reg, input_reg); 3468 __ SmiToInteger32(input_reg, input_reg);
3469 EmitIntegerMathAbs(instr); 3469 EmitIntegerMathAbs(instr);
3470 __ Integer32ToSmi(input_reg, input_reg); 3470 __ Integer32ToSmi(input_reg, input_reg);
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5574 FixedArray::kHeaderSize - kPointerSize)); 5574 FixedArray::kHeaderSize - kPointerSize));
5575 __ bind(&done); 5575 __ bind(&done);
5576 } 5576 }
5577 5577
5578 5578
5579 #undef __ 5579 #undef __
5580 5580
5581 } } // namespace v8::internal 5581 } } // namespace v8::internal
5582 5582
5583 #endif // V8_TARGET_ARCH_X64 5583 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/lithium-codegen-ia32.cc ('K') | « src/ia32/lithium-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698