OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Compute number of region covering addr. See Page::GetRegionNumberForAddress | 70 // Compute number of region covering addr. See Page::GetRegionNumberForAddress |
71 // method for more details. | 71 // method for more details. |
72 and_(addr, Page::kPageAlignmentMask); | 72 and_(addr, Page::kPageAlignmentMask); |
73 shr(addr, Page::kRegionSizeLog2); | 73 shr(addr, Page::kRegionSizeLog2); |
74 | 74 |
75 // Set dirty mark for region. | 75 // Set dirty mark for region. |
76 bts(Operand(object, Page::kDirtyFlagOffset), addr); | 76 bts(Operand(object, Page::kDirtyFlagOffset), addr); |
77 } | 77 } |
78 | 78 |
79 | 79 |
| 80 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, |
| 81 XMMRegister scratch_reg, |
| 82 Register result_reg) { |
| 83 Label done; |
| 84 ExternalReference zero_ref = ExternalReference::address_of_zero(); |
| 85 movdbl(scratch_reg, Operand::StaticVariable(zero_ref)); |
| 86 Set(result_reg, Immediate(0)); |
| 87 ucomisd(input_reg, scratch_reg); |
| 88 j(below, &done, Label::kNear); |
| 89 ExternalReference half_ref = ExternalReference::address_of_one_half(); |
| 90 movdbl(scratch_reg, Operand::StaticVariable(half_ref)); |
| 91 addsd(scratch_reg, input_reg); |
| 92 cvttsd2si(result_reg, Operand(scratch_reg)); |
| 93 test(result_reg, Immediate(0xFFFFFF00)); |
| 94 j(zero, &done, Label::kNear); |
| 95 Set(result_reg, Immediate(255)); |
| 96 bind(&done); |
| 97 } |
| 98 |
| 99 |
| 100 void MacroAssembler::ClampUint8(Register reg) { |
| 101 Label done; |
| 102 test(reg, Immediate(0xFFFFFF00)); |
| 103 j(zero, &done, Label::kNear); |
| 104 setcc(negative, reg); // 1 if negative, 0 if positive. |
| 105 dec_b(reg); // 0 if negative, 255 if positive. |
| 106 bind(&done); |
| 107 } |
| 108 |
| 109 |
80 void MacroAssembler::InNewSpace(Register object, | 110 void MacroAssembler::InNewSpace(Register object, |
81 Register scratch, | 111 Register scratch, |
82 Condition cc, | 112 Condition cc, |
83 Label* branch, | 113 Label* branch, |
84 Label::Distance branch_near) { | 114 Label::Distance branch_near) { |
85 ASSERT(cc == equal || cc == not_equal); | 115 ASSERT(cc == equal || cc == not_equal); |
86 if (Serializer::enabled()) { | 116 if (Serializer::enabled()) { |
87 // Can't do arithmetic on external references if it might get serialized. | 117 // Can't do arithmetic on external references if it might get serialized. |
88 mov(scratch, Operand(object)); | 118 mov(scratch, Operand(object)); |
89 // The mask isn't really an address. We load it as an external reference in | 119 // The mask isn't really an address. We load it as an external reference in |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 | 2069 |
2040 // Check that the code was patched as expected. | 2070 // Check that the code was patched as expected. |
2041 ASSERT(masm_.pc_ == address_ + size_); | 2071 ASSERT(masm_.pc_ == address_ + size_); |
2042 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2072 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2043 } | 2073 } |
2044 | 2074 |
2045 | 2075 |
2046 } } // namespace v8::internal | 2076 } } // namespace v8::internal |
2047 | 2077 |
2048 #endif // V8_TARGET_ARCH_IA32 | 2078 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |