OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 // Value is a smi. convert to a double and store. | 2732 // Value is a smi. convert to a double and store. |
2733 // Preserve original value. | 2733 // Preserve original value. |
2734 SmiToInteger32(kScratchRegister, maybe_number); | 2734 SmiToInteger32(kScratchRegister, maybe_number); |
2735 cvtlsi2sd(xmm_scratch, kScratchRegister); | 2735 cvtlsi2sd(xmm_scratch, kScratchRegister); |
2736 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), | 2736 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), |
2737 xmm_scratch); | 2737 xmm_scratch); |
2738 bind(&done); | 2738 bind(&done); |
2739 } | 2739 } |
2740 | 2740 |
2741 | 2741 |
| 2742 void MacroAssembler::CompareMap(Register obj, |
| 2743 Handle<Map> map, |
| 2744 Label* early_success, |
| 2745 CompareMapMode mode) { |
| 2746 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
| 2747 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { |
| 2748 Map* transitioned_fast_element_map( |
| 2749 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL)); |
| 2750 ASSERT(transitioned_fast_element_map == NULL || |
| 2751 map->elements_kind() != FAST_ELEMENTS); |
| 2752 if (transitioned_fast_element_map != NULL) { |
| 2753 j(equal, early_success, Label::kNear); |
| 2754 Cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 2755 Handle<Map>(transitioned_fast_element_map)); |
| 2756 } |
| 2757 |
| 2758 Map* transitioned_double_map( |
| 2759 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL)); |
| 2760 ASSERT(transitioned_double_map == NULL || |
| 2761 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS); |
| 2762 if (transitioned_double_map != NULL) { |
| 2763 j(equal, early_success, Label::kNear); |
| 2764 Cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 2765 Handle<Map>(transitioned_double_map)); |
| 2766 } |
| 2767 } |
| 2768 } |
| 2769 |
| 2770 |
2742 void MacroAssembler::CheckMap(Register obj, | 2771 void MacroAssembler::CheckMap(Register obj, |
2743 Handle<Map> map, | 2772 Handle<Map> map, |
2744 Label* fail, | 2773 Label* fail, |
2745 SmiCheckType smi_check_type) { | 2774 SmiCheckType smi_check_type, |
| 2775 CompareMapMode mode) { |
2746 if (smi_check_type == DO_SMI_CHECK) { | 2776 if (smi_check_type == DO_SMI_CHECK) { |
2747 JumpIfSmi(obj, fail); | 2777 JumpIfSmi(obj, fail); |
2748 } | 2778 } |
2749 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 2779 |
| 2780 Label success; |
| 2781 CompareMap(obj, map, &success, mode); |
2750 j(not_equal, fail); | 2782 j(not_equal, fail); |
| 2783 bind(&success); |
2751 } | 2784 } |
2752 | 2785 |
2753 | 2786 |
2754 void MacroAssembler::ClampUint8(Register reg) { | 2787 void MacroAssembler::ClampUint8(Register reg) { |
2755 Label done; | 2788 Label done; |
2756 testl(reg, Immediate(0xFFFFFF00)); | 2789 testl(reg, Immediate(0xFFFFFF00)); |
2757 j(zero, &done, Label::kNear); | 2790 j(zero, &done, Label::kNear); |
2758 setcc(negative, reg); // 1 if negative, 0 if positive. | 2791 setcc(negative, reg); // 1 if negative, 0 if positive. |
2759 decb(reg); // 0 if negative, 255 if positive. | 2792 decb(reg); // 0 if negative, 255 if positive. |
2760 bind(&done); | 2793 bind(&done); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4279 | 4312 |
4280 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4313 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4281 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4314 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4282 | 4315 |
4283 bind(&done); | 4316 bind(&done); |
4284 } | 4317 } |
4285 | 4318 |
4286 } } // namespace v8::internal | 4319 } } // namespace v8::internal |
4287 | 4320 |
4288 #endif // V8_TARGET_ARCH_X64 | 4321 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |