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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 __ cmp(FieldOperand(value, HeapNumber::kExponentOffset), | 2627 __ cmp(FieldOperand(value, HeapNumber::kExponentOffset), |
2628 Immediate(0x1)); | 2628 Immediate(0x1)); |
2629 EmitFalseBranch(instr, no_overflow); | 2629 EmitFalseBranch(instr, no_overflow); |
2630 __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset), | 2630 __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset), |
2631 Immediate(0x00000000)); | 2631 Immediate(0x00000000)); |
2632 EmitBranch(instr, equal); | 2632 EmitBranch(instr, equal); |
2633 } | 2633 } |
2634 } | 2634 } |
2635 | 2635 |
2636 | 2636 |
2637 Condition LCodeGen::EmitIsObject(Register input, | |
2638 Register temp1, | |
2639 Label* is_not_object, | |
2640 Label* is_object) { | |
2641 __ JumpIfSmi(input, is_not_object); | |
2642 | |
2643 __ cmp(input, isolate()->factory()->null_value()); | |
2644 __ j(equal, is_object); | |
2645 | |
2646 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); | |
2647 // Undetectable objects behave like undefined. | |
2648 __ test_b(FieldOperand(temp1, Map::kBitFieldOffset), | |
2649 1 << Map::kIsUndetectable); | |
2650 __ j(not_zero, is_not_object); | |
2651 | |
2652 __ movzx_b(temp1, FieldOperand(temp1, Map::kInstanceTypeOffset)); | |
2653 __ cmp(temp1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
2654 __ j(below, is_not_object); | |
2655 __ cmp(temp1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
2656 return below_equal; | |
2657 } | |
2658 | |
2659 | |
2660 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | |
2661 Register reg = ToRegister(instr->value()); | |
2662 Register temp = ToRegister(instr->temp()); | |
2663 | |
2664 Condition true_cond = EmitIsObject( | |
2665 reg, temp, instr->FalseLabel(chunk_), instr->TrueLabel(chunk_)); | |
2666 | |
2667 EmitBranch(instr, true_cond); | |
2668 } | |
2669 | |
2670 | |
2671 Condition LCodeGen::EmitIsString(Register input, | 2637 Condition LCodeGen::EmitIsString(Register input, |
2672 Register temp1, | 2638 Register temp1, |
2673 Label* is_not_string, | 2639 Label* is_not_string, |
2674 SmiCheck check_needed = INLINE_SMI_CHECK) { | 2640 SmiCheck check_needed = INLINE_SMI_CHECK) { |
2675 if (check_needed == INLINE_SMI_CHECK) { | 2641 if (check_needed == INLINE_SMI_CHECK) { |
2676 __ JumpIfSmi(input, is_not_string); | 2642 __ JumpIfSmi(input, is_not_string); |
2677 } | 2643 } |
2678 | 2644 |
2679 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); | 2645 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); |
2680 | 2646 |
(...skipping 3785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6466 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6432 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6467 } | 6433 } |
6468 | 6434 |
6469 | 6435 |
6470 #undef __ | 6436 #undef __ |
6471 | 6437 |
6472 } // namespace internal | 6438 } // namespace internal |
6473 } // namespace v8 | 6439 } // namespace v8 |
6474 | 6440 |
6475 #endif // V8_TARGET_ARCH_X87 | 6441 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |