OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 5284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5295 Register result_reg = ToRegister(result); | 5295 Register result_reg = ToRegister(result); |
5296 | 5296 |
5297 if (instr->truncating()) { | 5297 if (instr->truncating()) { |
5298 X87Register input_reg = ToX87Register(input); | 5298 X87Register input_reg = ToX87Register(input); |
5299 X87Fxch(input_reg); | 5299 X87Fxch(input_reg); |
5300 __ TruncateX87TOSToI(result_reg); | 5300 __ TruncateX87TOSToI(result_reg); |
5301 } else { | 5301 } else { |
5302 Label lost_precision, is_nan, minus_zero, done; | 5302 Label lost_precision, is_nan, minus_zero, done; |
5303 X87Register input_reg = ToX87Register(input); | 5303 X87Register input_reg = ToX87Register(input); |
5304 X87Fxch(input_reg); | 5304 X87Fxch(input_reg); |
| 5305 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
5305 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5306 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5306 &lost_precision, &is_nan, &minus_zero, Label::kNear); | 5307 &lost_precision, &is_nan, &minus_zero, dist); |
5307 __ jmp(&done, Label::kNear); | 5308 __ jmp(&done, dist); |
5308 __ bind(&lost_precision); | 5309 __ bind(&lost_precision); |
5309 DeoptimizeIf(no_condition, instr, "lost precision"); | 5310 DeoptimizeIf(no_condition, instr, "lost precision"); |
5310 __ bind(&is_nan); | 5311 __ bind(&is_nan); |
5311 DeoptimizeIf(no_condition, instr, "NaN"); | 5312 DeoptimizeIf(no_condition, instr, "NaN"); |
5312 __ bind(&minus_zero); | 5313 __ bind(&minus_zero); |
5313 DeoptimizeIf(no_condition, instr, "minus zero"); | 5314 DeoptimizeIf(no_condition, instr, "minus zero"); |
5314 __ bind(&done); | 5315 __ bind(&done); |
5315 } | 5316 } |
5316 } | 5317 } |
5317 | 5318 |
5318 | 5319 |
5319 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { | 5320 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
5320 LOperand* input = instr->value(); | 5321 LOperand* input = instr->value(); |
5321 DCHECK(input->IsDoubleRegister()); | 5322 DCHECK(input->IsDoubleRegister()); |
5322 LOperand* result = instr->result(); | 5323 LOperand* result = instr->result(); |
5323 DCHECK(result->IsRegister()); | 5324 DCHECK(result->IsRegister()); |
5324 Register result_reg = ToRegister(result); | 5325 Register result_reg = ToRegister(result); |
5325 | 5326 |
5326 Label lost_precision, is_nan, minus_zero, done; | 5327 Label lost_precision, is_nan, minus_zero, done; |
5327 X87Register input_reg = ToX87Register(input); | 5328 X87Register input_reg = ToX87Register(input); |
5328 X87Fxch(input_reg); | 5329 X87Fxch(input_reg); |
| 5330 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
5329 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5331 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5330 &lost_precision, &is_nan, &minus_zero, | 5332 &lost_precision, &is_nan, &minus_zero, dist); |
5331 DeoptEveryNTimes() ? Label::kFar : Label::kNear); | 5333 __ jmp(&done, dist); |
5332 __ jmp(&done, Label::kNear); | |
5333 __ bind(&lost_precision); | 5334 __ bind(&lost_precision); |
5334 DeoptimizeIf(no_condition, instr, "lost precision"); | 5335 DeoptimizeIf(no_condition, instr, "lost precision"); |
5335 __ bind(&is_nan); | 5336 __ bind(&is_nan); |
5336 DeoptimizeIf(no_condition, instr, "NaN"); | 5337 DeoptimizeIf(no_condition, instr, "NaN"); |
5337 __ bind(&minus_zero); | 5338 __ bind(&minus_zero); |
5338 DeoptimizeIf(no_condition, instr, "minus zero"); | 5339 DeoptimizeIf(no_condition, instr, "minus zero"); |
5339 __ bind(&done); | 5340 __ bind(&done); |
5340 __ SmiTag(result_reg); | 5341 __ SmiTag(result_reg); |
5341 DeoptimizeIf(overflow, instr, "overflow"); | 5342 DeoptimizeIf(overflow, instr, "overflow"); |
5342 } | 5343 } |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6242 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6243 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6243 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6244 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6244 } | 6245 } |
6245 | 6246 |
6246 | 6247 |
6247 #undef __ | 6248 #undef __ |
6248 | 6249 |
6249 } } // namespace v8::internal | 6250 } } // namespace v8::internal |
6250 | 6251 |
6251 #endif // V8_TARGET_ARCH_X87 | 6252 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |