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 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 Register result_reg = ToRegister(result); | 5390 Register result_reg = ToRegister(result); |
5391 | 5391 |
5392 if (instr->truncating()) { | 5392 if (instr->truncating()) { |
5393 X87Register input_reg = ToX87Register(input); | 5393 X87Register input_reg = ToX87Register(input); |
5394 X87Fxch(input_reg); | 5394 X87Fxch(input_reg); |
5395 __ TruncateX87TOSToI(result_reg); | 5395 __ TruncateX87TOSToI(result_reg); |
5396 } else { | 5396 } else { |
5397 Label lost_precision, is_nan, minus_zero, done; | 5397 Label lost_precision, is_nan, minus_zero, done; |
5398 X87Register input_reg = ToX87Register(input); | 5398 X87Register input_reg = ToX87Register(input); |
5399 X87Fxch(input_reg); | 5399 X87Fxch(input_reg); |
5400 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; | |
5401 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5400 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5402 &lost_precision, &is_nan, &minus_zero, dist); | 5401 &lost_precision, &is_nan, &minus_zero); |
5403 __ jmp(&done); | 5402 __ jmp(&done); |
5404 __ bind(&lost_precision); | 5403 __ bind(&lost_precision); |
5405 DeoptimizeIf(no_condition, instr, "lost precision"); | 5404 DeoptimizeIf(no_condition, instr, "lost precision"); |
5406 __ bind(&is_nan); | 5405 __ bind(&is_nan); |
5407 DeoptimizeIf(no_condition, instr, "NaN"); | 5406 DeoptimizeIf(no_condition, instr, "NaN"); |
5408 __ bind(&minus_zero); | 5407 __ bind(&minus_zero); |
5409 DeoptimizeIf(no_condition, instr, "minus zero"); | 5408 DeoptimizeIf(no_condition, instr, "minus zero"); |
5410 __ bind(&done); | 5409 __ bind(&done); |
5411 } | 5410 } |
5412 } | 5411 } |
5413 | 5412 |
5414 | 5413 |
5415 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { | 5414 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
5416 LOperand* input = instr->value(); | 5415 LOperand* input = instr->value(); |
5417 DCHECK(input->IsDoubleRegister()); | 5416 DCHECK(input->IsDoubleRegister()); |
5418 LOperand* result = instr->result(); | 5417 LOperand* result = instr->result(); |
5419 DCHECK(result->IsRegister()); | 5418 DCHECK(result->IsRegister()); |
5420 Register result_reg = ToRegister(result); | 5419 Register result_reg = ToRegister(result); |
5421 | 5420 |
5422 Label lost_precision, is_nan, minus_zero, done; | 5421 Label lost_precision, is_nan, minus_zero, done; |
5423 X87Register input_reg = ToX87Register(input); | 5422 X87Register input_reg = ToX87Register(input); |
5424 X87Fxch(input_reg); | 5423 X87Fxch(input_reg); |
5425 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; | |
5426 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5424 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5427 &lost_precision, &is_nan, &minus_zero, dist); | 5425 &lost_precision, &is_nan, &minus_zero); |
5428 __ jmp(&done); | 5426 __ jmp(&done); |
5429 __ bind(&lost_precision); | 5427 __ bind(&lost_precision); |
5430 DeoptimizeIf(no_condition, instr, "lost precision"); | 5428 DeoptimizeIf(no_condition, instr, "lost precision"); |
5431 __ bind(&is_nan); | 5429 __ bind(&is_nan); |
5432 DeoptimizeIf(no_condition, instr, "NaN"); | 5430 DeoptimizeIf(no_condition, instr, "NaN"); |
5433 __ bind(&minus_zero); | 5431 __ bind(&minus_zero); |
5434 DeoptimizeIf(no_condition, instr, "minus zero"); | 5432 DeoptimizeIf(no_condition, instr, "minus zero"); |
5435 __ bind(&done); | 5433 __ bind(&done); |
5436 __ SmiTag(result_reg); | 5434 __ SmiTag(result_reg); |
5437 DeoptimizeIf(overflow, instr, "overflow"); | 5435 DeoptimizeIf(overflow, instr, "overflow"); |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6338 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6336 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6339 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6337 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6340 } | 6338 } |
6341 | 6339 |
6342 | 6340 |
6343 #undef __ | 6341 #undef __ |
6344 | 6342 |
6345 } } // namespace v8::internal | 6343 } } // namespace v8::internal |
6346 | 6344 |
6347 #endif // V8_TARGET_ARCH_X87 | 6345 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |