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

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

Issue 77053003: Remove the first_right_arg hack for HMod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/ia32/lithium-ia32.cc ('k') | 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 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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 __ negl(left_reg); 1006 __ negl(left_reg);
1007 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { 1007 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1008 DeoptimizeIf(zero, instr->environment()); 1008 DeoptimizeIf(zero, instr->environment());
1009 } 1009 }
1010 __ jmp(&done, Label::kNear); 1010 __ jmp(&done, Label::kNear);
1011 } 1011 }
1012 1012
1013 __ bind(&left_is_not_negative); 1013 __ bind(&left_is_not_negative);
1014 __ andl(left_reg, Immediate(divisor - 1)); 1014 __ andl(left_reg, Immediate(divisor - 1));
1015 __ bind(&done); 1015 __ bind(&done);
1016
1017 } else if (hmod->fixed_right_arg().has_value) {
1018 Register left_reg = ToRegister(instr->left());
1019 ASSERT(left_reg.is(ToRegister(instr->result())));
1020 Register right_reg = ToRegister(instr->right());
1021
1022 int32_t divisor = hmod->fixed_right_arg().value;
1023 ASSERT(IsPowerOf2(divisor));
1024
1025 // Check if our assumption of a fixed right operand still holds.
1026 __ cmpl(right_reg, Immediate(divisor));
1027 DeoptimizeIf(not_equal, instr->environment());
1028
1029 Label left_is_not_negative, done;
1030 if (left->CanBeNegative()) {
1031 __ testl(left_reg, left_reg);
1032 __ j(not_sign, &left_is_not_negative, Label::kNear);
1033 __ negl(left_reg);
1034 __ andl(left_reg, Immediate(divisor - 1));
1035 __ negl(left_reg);
1036 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
1037 DeoptimizeIf(zero, instr->environment());
1038 }
1039 __ jmp(&done, Label::kNear);
1040 }
1041
1042 __ bind(&left_is_not_negative);
1043 __ andl(left_reg, Immediate(divisor - 1));
1044 __ bind(&done);
1045
1046 } else { 1016 } else {
1047 Register left_reg = ToRegister(instr->left()); 1017 Register left_reg = ToRegister(instr->left());
1048 ASSERT(left_reg.is(rax)); 1018 ASSERT(left_reg.is(rax));
1049 Register right_reg = ToRegister(instr->right()); 1019 Register right_reg = ToRegister(instr->right());
1050 ASSERT(!right_reg.is(rax)); 1020 ASSERT(!right_reg.is(rax));
1051 ASSERT(!right_reg.is(rdx)); 1021 ASSERT(!right_reg.is(rdx));
1052 Register result_reg = ToRegister(instr->result()); 1022 Register result_reg = ToRegister(instr->result());
1053 ASSERT(result_reg.is(rdx)); 1023 ASSERT(result_reg.is(rdx));
1054 1024
1055 Label done; 1025 Label done;
(...skipping 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after
5694 FixedArray::kHeaderSize - kPointerSize)); 5664 FixedArray::kHeaderSize - kPointerSize));
5695 __ bind(&done); 5665 __ bind(&done);
5696 } 5666 }
5697 5667
5698 5668
5699 #undef __ 5669 #undef __
5700 5670
5701 } } // namespace v8::internal 5671 } } // namespace v8::internal
5702 5672
5703 #endif // V8_TARGET_ARCH_X64 5673 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698