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 5075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 Register descriptors) { | 5086 Register descriptors) { |
5087 lw(descriptors, | 5087 lw(descriptors, |
5088 FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); | 5088 FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); |
5089 Label not_smi; | 5089 Label not_smi; |
5090 JumpIfNotSmi(descriptors, ¬_smi); | 5090 JumpIfNotSmi(descriptors, ¬_smi); |
5091 li(descriptors, Operand(FACTORY->empty_descriptor_array())); | 5091 li(descriptors, Operand(FACTORY->empty_descriptor_array())); |
5092 bind(¬_smi); | 5092 bind(¬_smi); |
5093 } | 5093 } |
5094 | 5094 |
5095 | 5095 |
| 5096 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
| 5097 Label next; |
| 5098 // Preload a couple of values used in the loop. |
| 5099 Register empty_fixed_array_value = t2; |
| 5100 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
| 5101 Register empty_descriptor_array_value = t3; |
| 5102 LoadRoot(empty_descriptor_array_value, |
| 5103 Heap::kEmptyDescriptorArrayRootIndex); |
| 5104 mov(a1, a0); |
| 5105 bind(&next); |
| 5106 |
| 5107 // Check that there are no elements. Register a1 contains the |
| 5108 // current JS object we've reached through the prototype chain. |
| 5109 lw(a2, FieldMemOperand(a1, JSObject::kElementsOffset)); |
| 5110 Branch(call_runtime, ne, a2, Operand(empty_fixed_array_value)); |
| 5111 |
| 5112 // Check that instance descriptors are not empty so that we can |
| 5113 // check for an enum cache. Leave the map in a2 for the subsequent |
| 5114 // prototype load. |
| 5115 lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 5116 lw(a3, FieldMemOperand(a2, Map::kInstanceDescriptorsOrBitField3Offset)); |
| 5117 JumpIfSmi(a3, call_runtime); |
| 5118 |
| 5119 // Check that there is an enum cache in the non-empty instance |
| 5120 // descriptors (a3). This is the case if the next enumeration |
| 5121 // index field does not contain a smi. |
| 5122 lw(a3, FieldMemOperand(a3, DescriptorArray::kEnumerationIndexOffset)); |
| 5123 JumpIfSmi(a3, call_runtime); |
| 5124 |
| 5125 // For all objects but the receiver, check that the cache is empty. |
| 5126 Label check_prototype; |
| 5127 Branch(&check_prototype, eq, a1, Operand(a0)); |
| 5128 lw(a3, FieldMemOperand(a3, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
| 5129 Branch(call_runtime, ne, a3, Operand(empty_fixed_array_value)); |
| 5130 |
| 5131 // Load the prototype from the map and loop if non-null. |
| 5132 bind(&check_prototype); |
| 5133 lw(a1, FieldMemOperand(a2, Map::kPrototypeOffset)); |
| 5134 Branch(&next, ne, a1, Operand(null_value)); |
| 5135 } |
| 5136 |
| 5137 |
5096 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) { | 5138 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) { |
5097 ASSERT(!output_reg.is(input_reg)); | 5139 ASSERT(!output_reg.is(input_reg)); |
5098 Label done; | 5140 Label done; |
5099 li(output_reg, Operand(255)); | 5141 li(output_reg, Operand(255)); |
5100 // Normal branch: nop in delay slot. | 5142 // Normal branch: nop in delay slot. |
5101 Branch(&done, gt, input_reg, Operand(output_reg)); | 5143 Branch(&done, gt, input_reg, Operand(output_reg)); |
5102 // Use delay slot in this branch. | 5144 // Use delay slot in this branch. |
5103 Branch(USE_DELAY_SLOT, &done, lt, input_reg, Operand(zero_reg)); | 5145 Branch(USE_DELAY_SLOT, &done, lt, input_reg, Operand(zero_reg)); |
5104 mov(output_reg, zero_reg); // In delay slot. | 5146 mov(output_reg, zero_reg); // In delay slot. |
5105 mov(output_reg, input_reg); // Value is in range 0..255. | 5147 mov(output_reg, input_reg); // Value is in range 0..255. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5197 opcode == BGTZL); | 5239 opcode == BGTZL); |
5198 opcode = (cond == eq) ? BEQ : BNE; | 5240 opcode = (cond == eq) ? BEQ : BNE; |
5199 instr = (instr & ~kOpcodeMask) | opcode; | 5241 instr = (instr & ~kOpcodeMask) | opcode; |
5200 masm_.emit(instr); | 5242 masm_.emit(instr); |
5201 } | 5243 } |
5202 | 5244 |
5203 | 5245 |
5204 } } // namespace v8::internal | 5246 } } // namespace v8::internal |
5205 | 5247 |
5206 #endif // V8_TARGET_ARCH_MIPS | 5248 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |