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

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

Issue 10578039: Fix Windows build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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') | no next file with comments »
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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 ASSERT(ToRegister(instr->result()).is(edx)); 1076 ASSERT(ToRegister(instr->result()).is(edx));
1077 Register scratch = ToRegister(instr->TempAt(0)); 1077 Register scratch = ToRegister(instr->TempAt(0));
1078 1078
1079 // Find b which: 2^b < divisor_abs < 2^(b+1). 1079 // Find b which: 2^b < divisor_abs < 2^(b+1).
1080 unsigned b = 31 - CompilerIntrinsics::CountLeadingZeros(divisor_abs); 1080 unsigned b = 31 - CompilerIntrinsics::CountLeadingZeros(divisor_abs);
1081 unsigned shift = 32 + b; // Precision +1bit (effectively). 1081 unsigned shift = 32 + b; // Precision +1bit (effectively).
1082 double multiplier_f = 1082 double multiplier_f =
1083 static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs; 1083 static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs;
1084 int64_t multiplier; 1084 int64_t multiplier;
1085 if (multiplier_f - floor(multiplier_f) < 0.5) { 1085 if (multiplier_f - floor(multiplier_f) < 0.5) {
1086 multiplier = floor(multiplier_f); 1086 multiplier = static_cast<int64_t>(floor(multiplier_f));
1087 } else { 1087 } else {
1088 multiplier = floor(multiplier_f) + 1; 1088 multiplier = static_cast<int64_t>(floor(multiplier_f)) + 1;
1089 } 1089 }
1090 // The multiplier is a uint32. 1090 // The multiplier is a uint32.
1091 ASSERT(multiplier > 0 && 1091 ASSERT(multiplier > 0 &&
1092 multiplier < (static_cast<int64_t>(1) << 32)); 1092 multiplier < (static_cast<int64_t>(1) << 32));
1093 __ mov(scratch, dividend); 1093 __ mov(scratch, dividend);
1094 if (divisor < 0 && 1094 if (divisor < 0 &&
1095 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1095 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1096 __ test(dividend, dividend); 1096 __ test(dividend, dividend);
1097 DeoptimizeIf(zero, instr->environment()); 1097 DeoptimizeIf(zero, instr->environment());
1098 } 1098 }
1099 __ mov(edx, multiplier); 1099 __ mov(edx, static_cast<int32_t>(multiplier));
1100 __ imul(edx); 1100 __ imul(edx);
1101 if (static_cast<int32_t>(multiplier) < 0) { 1101 if (static_cast<int32_t>(multiplier) < 0) {
1102 __ add(edx, scratch); 1102 __ add(edx, scratch);
1103 } 1103 }
1104 Register reg_lo = eax; 1104 Register reg_lo = eax;
1105 Register reg_byte_scratch = scratch; 1105 Register reg_byte_scratch = scratch;
1106 if (!reg_byte_scratch.is_byte_register()) { 1106 if (!reg_byte_scratch.is_byte_register()) {
1107 __ xchg(reg_lo, reg_byte_scratch); 1107 __ xchg(reg_lo, reg_byte_scratch);
1108 reg_lo = scratch; 1108 reg_lo = scratch;
1109 reg_byte_scratch = eax; 1109 reg_byte_scratch = eax;
(...skipping 4222 matching lines...) Expand 10 before | Expand all | Expand 10 after
5332 FixedArray::kHeaderSize - kPointerSize)); 5332 FixedArray::kHeaderSize - kPointerSize));
5333 __ bind(&done); 5333 __ bind(&done);
5334 } 5334 }
5335 5335
5336 5336
5337 #undef __ 5337 #undef __
5338 5338
5339 } } // namespace v8::internal 5339 } } // namespace v8::internal
5340 5340
5341 #endif // V8_TARGET_ARCH_IA32 5341 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698