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

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

Issue 22285003: tweak of Math.abs in its x64 stub (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 | « src/x64/lithium-codegen-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 Register input_reg = ToRegister(instr->value()); 3442 Register input_reg = ToRegister(instr->value());
3443 __ testl(input_reg, input_reg); 3443 __ testl(input_reg, input_reg);
3444 Label is_positive; 3444 Label is_positive;
3445 __ j(not_sign, &is_positive, Label::kNear); 3445 __ j(not_sign, &is_positive, Label::kNear);
3446 __ negl(input_reg); // Sets flags. 3446 __ negl(input_reg); // Sets flags.
3447 DeoptimizeIf(negative, instr->environment()); 3447 DeoptimizeIf(negative, instr->environment());
3448 __ bind(&is_positive); 3448 __ bind(&is_positive);
3449 } 3449 }
3450 3450
3451 3451
3452 void LCodeGen::EmitInteger64MathAbs(LMathAbs* instr) { 3452 void LCodeGen::EmitSmiMathAbs(LMathAbs* instr) {
3453 Register input_reg = ToRegister(instr->value()); 3453 Register input_reg = ToRegister(instr->value());
3454 __ testq(input_reg, input_reg); 3454 __ testq(input_reg, input_reg);
3455 Label is_positive; 3455 Label is_positive;
3456 __ j(not_sign, &is_positive, Label::kNear); 3456 __ j(not_sign, &is_positive, Label::kNear);
3457 __ neg(input_reg); // Sets flags. 3457 __ neg(input_reg); // Sets flags.
3458 DeoptimizeIf(negative, instr->environment()); 3458 DeoptimizeIf(negative, instr->environment());
3459 __ bind(&is_positive); 3459 __ bind(&is_positive);
3460 } 3460 }
3461 3461
3462 3462
(...skipping 16 matching lines...) Expand all
3479 3479
3480 if (r.IsDouble()) { 3480 if (r.IsDouble()) {
3481 XMMRegister scratch = xmm0; 3481 XMMRegister scratch = xmm0;
3482 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3482 XMMRegister input_reg = ToDoubleRegister(instr->value());
3483 __ xorps(scratch, scratch); 3483 __ xorps(scratch, scratch);
3484 __ subsd(scratch, input_reg); 3484 __ subsd(scratch, input_reg);
3485 __ andpd(input_reg, scratch); 3485 __ andpd(input_reg, scratch);
3486 } else if (r.IsInteger32()) { 3486 } else if (r.IsInteger32()) {
3487 EmitIntegerMathAbs(instr); 3487 EmitIntegerMathAbs(instr);
3488 } else if (r.IsSmi()) { 3488 } else if (r.IsSmi()) {
3489 EmitInteger64MathAbs(instr); 3489 EmitSmiMathAbs(instr);
3490 } else { // Tagged case. 3490 } else { // Tagged case.
3491 DeferredMathAbsTaggedHeapNumber* deferred = 3491 DeferredMathAbsTaggedHeapNumber* deferred =
3492 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3492 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3493 Register input_reg = ToRegister(instr->value()); 3493 Register input_reg = ToRegister(instr->value());
3494 // Smi check. 3494 // Smi check.
3495 __ JumpIfNotSmi(input_reg, deferred->entry()); 3495 __ JumpIfNotSmi(input_reg, deferred->entry());
3496 __ SmiToInteger32(input_reg, input_reg); 3496 EmitSmiMathAbs(instr);
3497 EmitIntegerMathAbs(instr);
3498 __ Integer32ToSmi(input_reg, input_reg);
3499 __ bind(deferred->exit()); 3497 __ bind(deferred->exit());
3500 } 3498 }
3501 } 3499 }
3502 3500
3503 3501
3504 void LCodeGen::DoMathFloor(LMathFloor* instr) { 3502 void LCodeGen::DoMathFloor(LMathFloor* instr) {
3505 XMMRegister xmm_scratch = xmm0; 3503 XMMRegister xmm_scratch = xmm0;
3506 Register output_reg = ToRegister(instr->result()); 3504 Register output_reg = ToRegister(instr->result());
3507 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3505 XMMRegister input_reg = ToDoubleRegister(instr->value());
3508 3506
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after
5617 FixedArray::kHeaderSize - kPointerSize)); 5615 FixedArray::kHeaderSize - kPointerSize));
5618 __ bind(&done); 5616 __ bind(&done);
5619 } 5617 }
5620 5618
5621 5619
5622 #undef __ 5620 #undef __
5623 5621
5624 } } // namespace v8::internal 5622 } } // namespace v8::internal
5625 5623
5626 #endif // V8_TARGET_ARCH_X64 5624 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698