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 5334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5345 | 5345 |
5346 | 5346 |
5347 void LCodeGen::DoDeferredTaggedToINoSSE2(LTaggedToINoSSE2* instr) { | 5347 void LCodeGen::DoDeferredTaggedToINoSSE2(LTaggedToINoSSE2* instr) { |
5348 Label done, heap_number; | 5348 Label done, heap_number; |
5349 Register result_reg = ToRegister(instr->result()); | 5349 Register result_reg = ToRegister(instr->result()); |
5350 Register input_reg = ToRegister(instr->value()); | 5350 Register input_reg = ToRegister(instr->value()); |
5351 | 5351 |
5352 // Heap number map check. | 5352 // Heap number map check. |
5353 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 5353 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
5354 factory()->heap_number_map()); | 5354 factory()->heap_number_map()); |
5355 __ j(equal, &heap_number, Label::kNear); | 5355 if (instr->truncating()) { |
5356 // Check for undefined. Undefined is converted to zero for truncating | 5356 __ j(equal, &heap_number, Label::kNear); |
5357 // conversions. | 5357 // Check for undefined. Undefined is converted to zero for truncating |
5358 __ cmp(input_reg, factory()->undefined_value()); | 5358 // conversions. |
5359 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 5359 __ cmp(input_reg, factory()->undefined_value()); |
5360 DeoptimizeIf(not_equal, instr->environment()); | 5360 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
5361 __ xor_(result_reg, result_reg); | 5361 DeoptimizeIf(not_equal, instr->environment()); |
5362 __ jmp(&done, Label::kFar); | 5362 __ xor_(result_reg, result_reg); |
5363 __ bind(&heap_number); | 5363 __ jmp(&done, Label::kFar); |
| 5364 __ bind(&heap_number); |
| 5365 } else { |
| 5366 // Deoptimize if we don't have a heap number. |
| 5367 DeoptimizeIf(not_equal, instr->environment()); |
| 5368 } |
5364 | 5369 |
5365 // Surprisingly, all of this crazy bit manipulation is considerably | 5370 // Surprisingly, all of this crazy bit manipulation is considerably |
5366 // faster than using the built-in x86 CPU conversion functions (about 6x). | 5371 // faster than using the built-in x86 CPU conversion functions (about 6x). |
5367 Label right_exponent, adjust_bias, zero_result; | 5372 Label right_exponent, adjust_bias, zero_result; |
5368 Register scratch = ToRegister(instr->scratch()); | 5373 Register scratch = ToRegister(instr->scratch()); |
5369 Register scratch2 = ToRegister(instr->scratch2()); | 5374 Register scratch2 = ToRegister(instr->scratch2()); |
5370 // Get exponent word. | 5375 // Get exponent word. |
5371 __ mov(scratch, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 5376 __ mov(scratch, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
5372 // Get exponent alone in scratch2. | 5377 // Get exponent alone in scratch2. |
5373 __ mov(scratch2, scratch); | 5378 __ mov(scratch2, scratch); |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6596 FixedArray::kHeaderSize - kPointerSize)); | 6601 FixedArray::kHeaderSize - kPointerSize)); |
6597 __ bind(&done); | 6602 __ bind(&done); |
6598 } | 6603 } |
6599 | 6604 |
6600 | 6605 |
6601 #undef __ | 6606 #undef __ |
6602 | 6607 |
6603 } } // namespace v8::internal | 6608 } } // namespace v8::internal |
6604 | 6609 |
6605 #endif // V8_TARGET_ARCH_IA32 | 6610 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |