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 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 Heap::kSlicedAsciiStringMapRootIndex, | 2015 Heap::kSlicedAsciiStringMapRootIndex, |
2016 scratch1, | 2016 scratch1, |
2017 scratch2); | 2017 scratch2); |
2018 } | 2018 } |
2019 | 2019 |
2020 | 2020 |
2021 void MacroAssembler::CompareObjectType(Register object, | 2021 void MacroAssembler::CompareObjectType(Register object, |
2022 Register map, | 2022 Register map, |
2023 Register type_reg, | 2023 Register type_reg, |
2024 InstanceType type) { | 2024 InstanceType type) { |
| 2025 const Register temp = type_reg.is(no_reg) ? ip : type_reg; |
| 2026 |
2025 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2027 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
2026 CompareInstanceType(map, type_reg, type); | 2028 CompareInstanceType(map, temp, type); |
| 2029 } |
| 2030 |
| 2031 |
| 2032 void MacroAssembler::CheckObjectTypeRange(Register object, |
| 2033 Register map, |
| 2034 InstanceType min_type, |
| 2035 InstanceType max_type, |
| 2036 Label* false_label) { |
| 2037 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); |
| 2038 STATIC_ASSERT(LAST_TYPE < 256); |
| 2039 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 2040 ldrb(ip, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
| 2041 sub(ip, ip, Operand(min_type)); |
| 2042 cmp(ip, Operand(max_type - min_type)); |
| 2043 b(hi, false_label); |
2027 } | 2044 } |
2028 | 2045 |
2029 | 2046 |
2030 void MacroAssembler::CompareInstanceType(Register map, | 2047 void MacroAssembler::CompareInstanceType(Register map, |
2031 Register type_reg, | 2048 Register type_reg, |
2032 InstanceType type) { | 2049 InstanceType type) { |
| 2050 // Registers map and type_reg can be ip. These two lines assert |
| 2051 // that ip can be used with the two instructions (the constants |
| 2052 // will never need ip). |
| 2053 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); |
| 2054 STATIC_ASSERT(LAST_TYPE < 256); |
2033 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2055 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2034 cmp(type_reg, Operand(type)); | 2056 cmp(type_reg, Operand(type)); |
2035 } | 2057 } |
2036 | 2058 |
2037 | 2059 |
2038 void MacroAssembler::CompareRoot(Register obj, | 2060 void MacroAssembler::CompareRoot(Register obj, |
2039 Heap::RootListIndex index) { | 2061 Heap::RootListIndex index) { |
2040 ASSERT(!obj.is(ip)); | 2062 ASSERT(!obj.is(ip)); |
2041 LoadRoot(ip, index); | 2063 LoadRoot(ip, index); |
2042 cmp(obj, ip); | 2064 cmp(obj, ip); |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4056 void CodePatcher::EmitCondition(Condition cond) { | 4078 void CodePatcher::EmitCondition(Condition cond) { |
4057 Instr instr = Assembler::instr_at(masm_.pc_); | 4079 Instr instr = Assembler::instr_at(masm_.pc_); |
4058 instr = (instr & ~kCondMask) | cond; | 4080 instr = (instr & ~kCondMask) | cond; |
4059 masm_.emit(instr); | 4081 masm_.emit(instr); |
4060 } | 4082 } |
4061 | 4083 |
4062 | 4084 |
4063 } } // namespace v8::internal | 4085 } } // namespace v8::internal |
4064 | 4086 |
4065 #endif // V8_TARGET_ARCH_ARM | 4087 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |