OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 void MacroAssembler::JumpIfNotHeapNumber(Register object, | 5390 void MacroAssembler::JumpIfNotHeapNumber(Register object, |
5391 Register heap_number_map, | 5391 Register heap_number_map, |
5392 Register scratch, | 5392 Register scratch, |
5393 Label* on_not_heap_number) { | 5393 Label* on_not_heap_number) { |
5394 ld(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 5394 ld(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
5395 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 5395 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
5396 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); | 5396 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); |
5397 } | 5397 } |
5398 | 5398 |
5399 | 5399 |
5400 void MacroAssembler::LookupNumberStringCache(Register object, | |
5401 Register result, | |
5402 Register scratch1, | |
5403 Register scratch2, | |
5404 Register scratch3, | |
5405 Label* not_found) { | |
5406 // Use of registers. Register result is used as a temporary. | |
5407 Register number_string_cache = result; | |
5408 Register mask = scratch3; | |
5409 | |
5410 // Load the number string cache. | |
5411 LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); | |
5412 | |
5413 // Make the hash mask from the length of the number string cache. It | |
5414 // contains two elements (number and string) for each cache entry. | |
5415 ld(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); | |
5416 // Divide length by two (length is a smi). | |
5417 // dsra(mask, mask, kSmiTagSize + 1); | |
5418 dsra32(mask, mask, 1); | |
5419 Daddu(mask, mask, -1); // Make mask. | |
5420 | |
5421 // Calculate the entry in the number string cache. The hash value in the | |
5422 // number string cache for smis is just the smi value, and the hash for | |
5423 // doubles is the xor of the upper and lower words. See | |
5424 // Heap::GetNumberStringCache. | |
5425 Label is_smi; | |
5426 Label load_result_from_cache; | |
5427 JumpIfSmi(object, &is_smi); | |
5428 CheckMap(object, | |
5429 scratch1, | |
5430 Heap::kHeapNumberMapRootIndex, | |
5431 not_found, | |
5432 DONT_DO_SMI_CHECK); | |
5433 | |
5434 STATIC_ASSERT(8 == kDoubleSize); | |
5435 Daddu(scratch1, | |
5436 object, | |
5437 Operand(HeapNumber::kValueOffset - kHeapObjectTag)); | |
5438 ld(scratch2, MemOperand(scratch1, kPointerSize)); | |
5439 ld(scratch1, MemOperand(scratch1, 0)); | |
5440 Xor(scratch1, scratch1, Operand(scratch2)); | |
5441 And(scratch1, scratch1, Operand(mask)); | |
5442 | |
5443 // Calculate address of entry in string cache: each entry consists | |
5444 // of two pointer sized fields. | |
5445 dsll(scratch1, scratch1, kPointerSizeLog2 + 1); | |
5446 Daddu(scratch1, number_string_cache, scratch1); | |
5447 | |
5448 Register probe = mask; | |
5449 ld(probe, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); | |
5450 JumpIfSmi(probe, not_found); | |
5451 ldc1(f12, FieldMemOperand(object, HeapNumber::kValueOffset)); | |
5452 ldc1(f14, FieldMemOperand(probe, HeapNumber::kValueOffset)); | |
5453 BranchF(&load_result_from_cache, NULL, eq, f12, f14); | |
5454 Branch(not_found); | |
5455 | |
5456 bind(&is_smi); | |
5457 Register scratch = scratch1; | |
5458 // dsra(scratch, object, 1); // Shift away the tag. | |
5459 dsra32(scratch, scratch, 0); | |
5460 And(scratch, mask, Operand(scratch)); | |
5461 | |
5462 // Calculate address of entry in string cache: each entry consists | |
5463 // of two pointer sized fields. | |
5464 dsll(scratch, scratch, kPointerSizeLog2 + 1); | |
5465 Daddu(scratch, number_string_cache, scratch); | |
5466 | |
5467 // Check if the entry is the smi we are looking for. | |
5468 ld(probe, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | |
5469 Branch(not_found, ne, object, Operand(probe)); | |
5470 | |
5471 // Get the result from the cache. | |
5472 bind(&load_result_from_cache); | |
5473 ld(result, FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize)); | |
5474 | |
5475 IncrementCounter(isolate()->counters()->number_to_string_native(), | |
5476 1, | |
5477 scratch1, | |
5478 scratch2); | |
5479 } | |
5480 | |
5481 | |
5482 void MacroAssembler::JumpIfNonSmisNotBothSequentialOneByteStrings( | 5400 void MacroAssembler::JumpIfNonSmisNotBothSequentialOneByteStrings( |
5483 Register first, Register second, Register scratch1, Register scratch2, | 5401 Register first, Register second, Register scratch1, Register scratch2, |
5484 Label* failure) { | 5402 Label* failure) { |
5485 // Test that both first and second are sequential one-byte strings. | 5403 // Test that both first and second are sequential one-byte strings. |
5486 // Assume that they are non-smis. | 5404 // Assume that they are non-smis. |
5487 ld(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); | 5405 ld(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); |
5488 ld(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); | 5406 ld(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); |
5489 lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 5407 lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
5490 lbu(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); | 5408 lbu(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); |
5491 | 5409 |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6193 if (mag.shift > 0) sra(result, result, mag.shift); | 6111 if (mag.shift > 0) sra(result, result, mag.shift); |
6194 srl(at, dividend, 31); | 6112 srl(at, dividend, 31); |
6195 Addu(result, result, Operand(at)); | 6113 Addu(result, result, Operand(at)); |
6196 } | 6114 } |
6197 | 6115 |
6198 | 6116 |
6199 } // namespace internal | 6117 } // namespace internal |
6200 } // namespace v8 | 6118 } // namespace v8 |
6201 | 6119 |
6202 #endif // V8_TARGET_ARCH_MIPS64 | 6120 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |