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

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

Issue 6548005: X64 Crankshaft: Add ModI and ModT to x64 optimizing compiler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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-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 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 676 }
677 } 677 }
678 678
679 679
680 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { 680 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
681 // Nothing to do. 681 // Nothing to do.
682 } 682 }
683 683
684 684
685 void LCodeGen::DoModI(LModI* instr) { 685 void LCodeGen::DoModI(LModI* instr) {
686 Abort("Unimplemented: %s", "DoModI"); 686 LOperand* right = instr->InputAt(1);
687 ASSERT(ToRegister(instr->result()).is(rdx));
688 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
689 ASSERT(!ToRegister(instr->InputAt(1)).is(rax));
690 ASSERT(!ToRegister(instr->InputAt(1)).is(rdx));
691
692 Register right_reg = ToRegister(right);
693
694 // Check for x % 0.
695 if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
696 __ testl(right_reg, right_reg);
697 DeoptimizeIf(zero, instr->environment());
698 }
699
700 // Sign extend eax to edx. (We are using only the low 32 bits of the values.)
701 __ cdq();
702
703 // Check for (0 % -x) that will produce negative zero.
704 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
705 NearLabel positive_left;
706 NearLabel done;
707 __ testl(rax, rax);
708 __ j(not_sign, &positive_left);
709 __ idivl(right_reg);
710
711 // Test the remainder for 0, because then the result would be -0.
712 __ testl(rdx, rdx);
713 __ j(not_zero, &done);
714
715 DeoptimizeIf(no_condition, instr->environment());
716 __ bind(&positive_left);
717 __ idivl(right_reg);
718 __ bind(&done);
719 } else {
720 __ idivl(right_reg);
721 }
687 } 722 }
688 723
689 724
690 void LCodeGen::DoDivI(LDivI* instr) { 725 void LCodeGen::DoDivI(LDivI* instr) {
691 LOperand* right = instr->InputAt(1); 726 LOperand* right = instr->InputAt(1);
692 ASSERT(ToRegister(instr->result()).is(rax)); 727 ASSERT(ToRegister(instr->result()).is(rax));
693 ASSERT(ToRegister(instr->InputAt(0)).is(rax)); 728 ASSERT(ToRegister(instr->InputAt(0)).is(rax));
694 ASSERT(!ToRegister(instr->InputAt(1)).is(rax)); 729 ASSERT(!ToRegister(instr->InputAt(1)).is(rax));
695 ASSERT(!ToRegister(instr->InputAt(1)).is(rdx)); 730 ASSERT(!ToRegister(instr->InputAt(1)).is(rdx));
696 731
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 RegisterEnvironmentForDeoptimization(environment); 3268 RegisterEnvironmentForDeoptimization(environment);
3234 ASSERT(osr_pc_offset_ == -1); 3269 ASSERT(osr_pc_offset_ == -1);
3235 osr_pc_offset_ = masm()->pc_offset(); 3270 osr_pc_offset_ = masm()->pc_offset();
3236 } 3271 }
3237 3272
3238 #undef __ 3273 #undef __
3239 3274
3240 } } // namespace v8::internal 3275 } } // namespace v8::internal
3241 3276
3242 #endif // V8_TARGET_ARCH_X64 3277 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698