| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 5181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5192 void MacroAssembler::JumpIfNotHeapNumber(Register object, | 5192 void MacroAssembler::JumpIfNotHeapNumber(Register object, |
| 5193 Register heap_number_map, | 5193 Register heap_number_map, |
| 5194 Register scratch, | 5194 Register scratch, |
| 5195 Label* on_not_heap_number) { | 5195 Label* on_not_heap_number) { |
| 5196 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 5196 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 5197 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 5197 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
| 5198 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); | 5198 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); |
| 5199 } | 5199 } |
| 5200 | 5200 |
| 5201 | 5201 |
| 5202 void MacroAssembler::LookupNumberStringCache(Register object, | |
| 5203 Register result, | |
| 5204 Register scratch1, | |
| 5205 Register scratch2, | |
| 5206 Register scratch3, | |
| 5207 Label* not_found) { | |
| 5208 // Use of registers. Register result is used as a temporary. | |
| 5209 Register number_string_cache = result; | |
| 5210 Register mask = scratch3; | |
| 5211 | |
| 5212 // Load the number string cache. | |
| 5213 LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); | |
| 5214 | |
| 5215 // Make the hash mask from the length of the number string cache. It | |
| 5216 // contains two elements (number and string) for each cache entry. | |
| 5217 lw(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); | |
| 5218 // Divide length by two (length is a smi). | |
| 5219 sra(mask, mask, kSmiTagSize + 1); | |
| 5220 Addu(mask, mask, -1); // Make mask. | |
| 5221 | |
| 5222 // Calculate the entry in the number string cache. The hash value in the | |
| 5223 // number string cache for smis is just the smi value, and the hash for | |
| 5224 // doubles is the xor of the upper and lower words. See | |
| 5225 // Heap::GetNumberStringCache. | |
| 5226 Label is_smi; | |
| 5227 Label load_result_from_cache; | |
| 5228 JumpIfSmi(object, &is_smi); | |
| 5229 CheckMap(object, | |
| 5230 scratch1, | |
| 5231 Heap::kHeapNumberMapRootIndex, | |
| 5232 not_found, | |
| 5233 DONT_DO_SMI_CHECK); | |
| 5234 | |
| 5235 STATIC_ASSERT(8 == kDoubleSize); | |
| 5236 Addu(scratch1, | |
| 5237 object, | |
| 5238 Operand(HeapNumber::kValueOffset - kHeapObjectTag)); | |
| 5239 lw(scratch2, MemOperand(scratch1, kPointerSize)); | |
| 5240 lw(scratch1, MemOperand(scratch1, 0)); | |
| 5241 Xor(scratch1, scratch1, Operand(scratch2)); | |
| 5242 And(scratch1, scratch1, Operand(mask)); | |
| 5243 | |
| 5244 // Calculate address of entry in string cache: each entry consists | |
| 5245 // of two pointer sized fields. | |
| 5246 sll(scratch1, scratch1, kPointerSizeLog2 + 1); | |
| 5247 Addu(scratch1, number_string_cache, scratch1); | |
| 5248 | |
| 5249 Register probe = mask; | |
| 5250 lw(probe, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); | |
| 5251 JumpIfSmi(probe, not_found); | |
| 5252 ldc1(f12, FieldMemOperand(object, HeapNumber::kValueOffset)); | |
| 5253 ldc1(f14, FieldMemOperand(probe, HeapNumber::kValueOffset)); | |
| 5254 BranchF(&load_result_from_cache, NULL, eq, f12, f14); | |
| 5255 Branch(not_found); | |
| 5256 | |
| 5257 bind(&is_smi); | |
| 5258 Register scratch = scratch1; | |
| 5259 sra(scratch, object, 1); // Shift away the tag. | |
| 5260 And(scratch, mask, Operand(scratch)); | |
| 5261 | |
| 5262 // Calculate address of entry in string cache: each entry consists | |
| 5263 // of two pointer sized fields. | |
| 5264 sll(scratch, scratch, kPointerSizeLog2 + 1); | |
| 5265 Addu(scratch, number_string_cache, scratch); | |
| 5266 | |
| 5267 // Check if the entry is the smi we are looking for. | |
| 5268 lw(probe, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | |
| 5269 Branch(not_found, ne, object, Operand(probe)); | |
| 5270 | |
| 5271 // Get the result from the cache. | |
| 5272 bind(&load_result_from_cache); | |
| 5273 lw(result, FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize)); | |
| 5274 | |
| 5275 IncrementCounter(isolate()->counters()->number_to_string_native(), | |
| 5276 1, | |
| 5277 scratch1, | |
| 5278 scratch2); | |
| 5279 } | |
| 5280 | |
| 5281 | |
| 5282 void MacroAssembler::JumpIfNonSmisNotBothSequentialOneByteStrings( | 5202 void MacroAssembler::JumpIfNonSmisNotBothSequentialOneByteStrings( |
| 5283 Register first, Register second, Register scratch1, Register scratch2, | 5203 Register first, Register second, Register scratch1, Register scratch2, |
| 5284 Label* failure) { | 5204 Label* failure) { |
| 5285 // Test that both first and second are sequential one-byte strings. | 5205 // Test that both first and second are sequential one-byte strings. |
| 5286 // Assume that they are non-smis. | 5206 // Assume that they are non-smis. |
| 5287 lw(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); | 5207 lw(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); |
| 5288 lw(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); | 5208 lw(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); |
| 5289 lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 5209 lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
| 5290 lbu(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); | 5210 lbu(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); |
| 5291 | 5211 |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5999 if (mag.shift > 0) sra(result, result, mag.shift); | 5919 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6000 srl(at, dividend, 31); | 5920 srl(at, dividend, 31); |
| 6001 Addu(result, result, Operand(at)); | 5921 Addu(result, result, Operand(at)); |
| 6002 } | 5922 } |
| 6003 | 5923 |
| 6004 | 5924 |
| 6005 } // namespace internal | 5925 } // namespace internal |
| 6006 } // namespace v8 | 5926 } // namespace v8 |
| 6007 | 5927 |
| 6008 #endif // V8_TARGET_ARCH_MIPS | 5928 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |