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 5287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
5306 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5306 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5307 &lost_precision, &is_nan, &minus_zero, dist); | 5307 &lost_precision, &is_nan, &minus_zero, dist); |
5308 __ jmp(&done, dist); | 5308 __ jmp(&done, Label::kFar); |
Weiliang
2014/09/25 12:56:55
The default jmp is far. So you don't need to do it
| |
5309 __ bind(&lost_precision); | 5309 __ bind(&lost_precision); |
5310 DeoptimizeIf(no_condition, instr, "lost precision"); | 5310 DeoptimizeIf(no_condition, instr, "lost precision"); |
5311 __ bind(&is_nan); | 5311 __ bind(&is_nan); |
5312 DeoptimizeIf(no_condition, instr, "NaN"); | 5312 DeoptimizeIf(no_condition, instr, "NaN"); |
5313 __ bind(&minus_zero); | 5313 __ bind(&minus_zero); |
5314 DeoptimizeIf(no_condition, instr, "minus zero"); | 5314 DeoptimizeIf(no_condition, instr, "minus zero"); |
5315 __ bind(&done); | 5315 __ bind(&done); |
5316 } | 5316 } |
5317 } | 5317 } |
5318 | 5318 |
5319 | 5319 |
5320 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { | 5320 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
5321 LOperand* input = instr->value(); | 5321 LOperand* input = instr->value(); |
5322 DCHECK(input->IsDoubleRegister()); | 5322 DCHECK(input->IsDoubleRegister()); |
5323 LOperand* result = instr->result(); | 5323 LOperand* result = instr->result(); |
5324 DCHECK(result->IsRegister()); | 5324 DCHECK(result->IsRegister()); |
5325 Register result_reg = ToRegister(result); | 5325 Register result_reg = ToRegister(result); |
5326 | 5326 |
5327 Label lost_precision, is_nan, minus_zero, done; | 5327 Label lost_precision, is_nan, minus_zero, done; |
5328 X87Register input_reg = ToX87Register(input); | 5328 X87Register input_reg = ToX87Register(input); |
5329 X87Fxch(input_reg); | 5329 X87Fxch(input_reg); |
5330 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; | 5330 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
5331 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), | 5331 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), |
5332 &lost_precision, &is_nan, &minus_zero, dist); | 5332 &lost_precision, &is_nan, &minus_zero, dist); |
5333 __ jmp(&done, dist); | 5333 __ jmp(&done, Label::kFar); |
5334 __ bind(&lost_precision); | 5334 __ bind(&lost_precision); |
5335 DeoptimizeIf(no_condition, instr, "lost precision"); | 5335 DeoptimizeIf(no_condition, instr, "lost precision"); |
5336 __ bind(&is_nan); | 5336 __ bind(&is_nan); |
5337 DeoptimizeIf(no_condition, instr, "NaN"); | 5337 DeoptimizeIf(no_condition, instr, "NaN"); |
5338 __ bind(&minus_zero); | 5338 __ bind(&minus_zero); |
5339 DeoptimizeIf(no_condition, instr, "minus zero"); | 5339 DeoptimizeIf(no_condition, instr, "minus zero"); |
5340 __ bind(&done); | 5340 __ bind(&done); |
5341 __ SmiTag(result_reg); | 5341 __ SmiTag(result_reg); |
5342 DeoptimizeIf(overflow, instr, "overflow"); | 5342 DeoptimizeIf(overflow, instr, "overflow"); |
5343 } | 5343 } |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6243 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6243 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6244 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6244 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6245 } | 6245 } |
6246 | 6246 |
6247 | 6247 |
6248 #undef __ | 6248 #undef __ |
6249 | 6249 |
6250 } } // namespace v8::internal | 6250 } } // namespace v8::internal |
6251 | 6251 |
6252 #endif // V8_TARGET_ARCH_X87 | 6252 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |