| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 270 |
| 241 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { | 271 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { |
| 242 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), | 272 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), |
| 243 static_cast<int8_t>(type)); | 273 static_cast<int8_t>(type)); |
| 244 } | 274 } |
| 245 | 275 |
| 246 | 276 |
| 247 void MacroAssembler::CheckMap(Register obj, | 277 void MacroAssembler::CheckMap(Register obj, |
| 248 Handle<Map> map, | 278 Handle<Map> map, |
| 249 Label* fail, | 279 Label* fail, |
| 250 bool is_heap_object) { | 280 SmiCheckType smi_check_type) { |
| 251 if (!is_heap_object) { | 281 if (smi_check_type == DONT_DO_SMI_CHECK) { |
| 252 test(obj, Immediate(kSmiTagMask)); | 282 JumpIfSmi(obj, fail); |
| 253 j(zero, fail); | |
| 254 } | 283 } |
| 255 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); | 284 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); |
| 256 j(not_equal, fail); | 285 j(not_equal, fail); |
| 257 } | 286 } |
| 258 | 287 |
| 259 | 288 |
| 260 Condition MacroAssembler::IsObjectStringType(Register heap_object, | 289 Condition MacroAssembler::IsObjectStringType(Register heap_object, |
| 261 Register map, | 290 Register map, |
| 262 Register instance_type) { | 291 Register instance_type) { |
| 263 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 292 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
| (...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 mov(function, Operand(function, Context::SlotOffset(index))); | 1734 mov(function, Operand(function, Context::SlotOffset(index))); |
| 1706 } | 1735 } |
| 1707 | 1736 |
| 1708 | 1737 |
| 1709 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 1738 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 1710 Register map) { | 1739 Register map) { |
| 1711 // Load the initial map. The global functions all have initial maps. | 1740 // Load the initial map. The global functions all have initial maps. |
| 1712 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 1741 mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1713 if (emit_debug_code()) { | 1742 if (emit_debug_code()) { |
| 1714 Label ok, fail; | 1743 Label ok, fail; |
| 1715 CheckMap(map, isolate()->factory()->meta_map(), &fail, false); | 1744 CheckMap(map, isolate()->factory()->meta_map(), &fail, DO_SMI_CHECK); |
| 1716 jmp(&ok); | 1745 jmp(&ok); |
| 1717 bind(&fail); | 1746 bind(&fail); |
| 1718 Abort("Global functions must have initial map"); | 1747 Abort("Global functions must have initial map"); |
| 1719 bind(&ok); | 1748 bind(&ok); |
| 1720 } | 1749 } |
| 1721 } | 1750 } |
| 1722 | 1751 |
| 1723 | 1752 |
| 1724 // Store the value in register src in the safepoint register stack | 1753 // Store the value in register src in the safepoint register stack |
| 1725 // slot for register dst. | 1754 // slot for register dst. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2068 |
| 2040 // Check that the code was patched as expected. | 2069 // Check that the code was patched as expected. |
| 2041 ASSERT(masm_.pc_ == address_ + size_); | 2070 ASSERT(masm_.pc_ == address_ + size_); |
| 2042 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2071 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2043 } | 2072 } |
| 2044 | 2073 |
| 2045 | 2074 |
| 2046 } } // namespace v8::internal | 2075 } } // namespace v8::internal |
| 2047 | 2076 |
| 2048 #endif // V8_TARGET_ARCH_IA32 | 2077 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |