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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.cc » ('j') | src/x64/lithium-codegen-x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3813 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 ASSERT(instr->value()->Equals(instr->result())); 3824 ASSERT(instr->value()->Equals(instr->result()));
3825 Representation r = instr->hydrogen()->value()->representation(); 3825 Representation r = instr->hydrogen()->value()->representation();
3826 3826
3827 CpuFeatureScope scope(masm(), SSE2); 3827 CpuFeatureScope scope(masm(), SSE2);
3828 if (r.IsDouble()) { 3828 if (r.IsDouble()) {
3829 XMMRegister scratch = xmm0; 3829 XMMRegister scratch = xmm0;
3830 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3830 XMMRegister input_reg = ToDoubleRegister(instr->value());
3831 __ xorps(scratch, scratch); 3831 __ xorps(scratch, scratch);
3832 __ subsd(scratch, input_reg); 3832 __ subsd(scratch, input_reg);
3833 __ pand(input_reg, scratch); 3833 __ pand(input_reg, scratch);
3834 } else if (r.IsInteger32()) { 3834 } else if (r.IsInteger32() || r.IsSmi()) {
Jakob Kummerow 2013/07/31 12:27:27 You can use r.IsSmiOrInteger32() here.
3835 EmitIntegerMathAbs(instr); 3835 EmitIntegerMathAbs(instr);
3836 } else { // Tagged case. 3836 } else { // Tagged case.
3837 DeferredMathAbsTaggedHeapNumber* deferred = 3837 DeferredMathAbsTaggedHeapNumber* deferred =
3838 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3838 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3839 Register input_reg = ToRegister(instr->value()); 3839 Register input_reg = ToRegister(instr->value());
3840 // Smi check. 3840 // Smi check.
3841 __ JumpIfNotSmi(input_reg, deferred->entry()); 3841 __ JumpIfNotSmi(input_reg, deferred->entry());
3842 EmitIntegerMathAbs(instr); 3842 EmitIntegerMathAbs(instr);
3843 __ bind(deferred->exit()); 3843 __ bind(deferred->exit());
3844 } 3844 }
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6523 FixedArray::kHeaderSize - kPointerSize)); 6523 FixedArray::kHeaderSize - kPointerSize));
6524 __ bind(&done); 6524 __ bind(&done);
6525 } 6525 }
6526 6526
6527 6527
6528 #undef __ 6528 #undef __
6529 6529
6530 } } // namespace v8::internal 6530 } } // namespace v8::internal
6531 6531
6532 #endif // V8_TARGET_ARCH_IA32 6532 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.cc » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698