OLD | NEW |
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 5365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 __ mov(temp_reg, input_reg); | 5376 __ mov(temp_reg, input_reg); |
5377 __ SmiUntag(temp_reg); // Untag smi before converting to float. | 5377 __ SmiUntag(temp_reg); // Untag smi before converting to float. |
5378 __ Cvtsi2sd(result_reg, Operand(temp_reg)); | 5378 __ Cvtsi2sd(result_reg, Operand(temp_reg)); |
5379 __ bind(&done); | 5379 __ bind(&done); |
5380 } | 5380 } |
5381 | 5381 |
5382 | 5382 |
5383 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 5383 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
5384 Register input_reg = ToRegister(instr->value()); | 5384 Register input_reg = ToRegister(instr->value()); |
5385 | 5385 |
5386 | |
5387 if (instr->truncating()) { | 5386 if (instr->truncating()) { |
5388 Label heap_number, slow_case; | 5387 Label no_heap_number, check_bools, check_false; |
5389 | 5388 |
5390 // Heap number map check. | 5389 // Heap number map check. |
5391 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 5390 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
5392 factory()->heap_number_map()); | 5391 factory()->heap_number_map()); |
5393 __ j(equal, &heap_number, Label::kNear); | 5392 __ j(not_equal, &no_heap_number, Label::kNear); |
| 5393 __ TruncateHeapNumberToI(input_reg, input_reg); |
| 5394 __ jmp(done); |
5394 | 5395 |
5395 // Check for undefined. Undefined is converted to zero for truncating | 5396 __ bind(&no_heap_number); |
5396 // conversions. | 5397 // Check for Oddballs. Undefined/False is converted to zero and True to one |
| 5398 // for truncating conversions. |
5397 __ cmp(input_reg, factory()->undefined_value()); | 5399 __ cmp(input_reg, factory()->undefined_value()); |
| 5400 __ j(not_equal, &check_bools, Label::kNear); |
| 5401 __ Set(input_reg, Immediate(0)); |
| 5402 __ jmp(done); |
| 5403 |
| 5404 __ bind(&check_bools); |
| 5405 __ cmp(input_reg, factory()->true_value()); |
| 5406 __ j(not_equal, &check_false, Label::kNear); |
| 5407 __ Set(input_reg, Immediate(1)); |
| 5408 __ jmp(done); |
| 5409 |
| 5410 __ bind(&check_false); |
| 5411 __ cmp(input_reg, factory()->false_value()); |
5398 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 5412 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
5399 DeoptimizeIf(not_equal, instr->environment()); | 5413 DeoptimizeIf(not_equal, instr->environment()); |
5400 __ mov(input_reg, 0); | 5414 __ Set(input_reg, Immediate(0)); |
5401 __ jmp(done); | 5415 __ jmp(done); |
5402 | |
5403 __ bind(&heap_number); | |
5404 __ TruncateHeapNumberToI(input_reg, input_reg); | |
5405 } else { | 5416 } else { |
5406 Label bailout; | 5417 Label bailout; |
5407 XMMRegister scratch = (instr->temp() != NULL) | 5418 XMMRegister scratch = (instr->temp() != NULL) |
5408 ? ToDoubleRegister(instr->temp()) | 5419 ? ToDoubleRegister(instr->temp()) |
5409 : no_xmm_reg; | 5420 : no_xmm_reg; |
5410 __ TaggedToI(input_reg, input_reg, scratch, | 5421 __ TaggedToI(input_reg, input_reg, scratch, |
5411 instr->hydrogen()->GetMinusZeroMode(), &bailout); | 5422 instr->hydrogen()->GetMinusZeroMode(), &bailout); |
5412 __ jmp(done); | 5423 __ jmp(done); |
5413 __ bind(&bailout); | 5424 __ bind(&bailout); |
5414 DeoptimizeIf(no_condition, instr->environment()); | 5425 DeoptimizeIf(no_condition, instr->environment()); |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6383 FixedArray::kHeaderSize - kPointerSize)); | 6394 FixedArray::kHeaderSize - kPointerSize)); |
6384 __ bind(&done); | 6395 __ bind(&done); |
6385 } | 6396 } |
6386 | 6397 |
6387 | 6398 |
6388 #undef __ | 6399 #undef __ |
6389 | 6400 |
6390 } } // namespace v8::internal | 6401 } } // namespace v8::internal |
6391 | 6402 |
6392 #endif // V8_TARGET_ARCH_IA32 | 6403 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |