Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 23526072: MIPS: Move NumberToStringStub::GenerateLookupNumberStringCache to the MacroAssembler. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after
4938 void MacroAssembler::JumpIfNotHeapNumber(Register object, 4938 void MacroAssembler::JumpIfNotHeapNumber(Register object,
4939 Register heap_number_map, 4939 Register heap_number_map,
4940 Register scratch, 4940 Register scratch,
4941 Label* on_not_heap_number) { 4941 Label* on_not_heap_number) {
4942 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); 4942 lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
4943 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 4943 AssertIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
4944 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map)); 4944 Branch(on_not_heap_number, ne, scratch, Operand(heap_number_map));
4945 } 4945 }
4946 4946
4947 4947
4948 void MacroAssembler::LookupNumberStringCache(Register object,
4949 Register result,
4950 Register scratch1,
4951 Register scratch2,
4952 Register scratch3,
4953 Label* not_found) {
4954 // Use of registers. Register result is used as a temporary.
4955 Register number_string_cache = result;
4956 Register mask = scratch3;
4957
4958 // Load the number string cache.
4959 LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex);
4960
4961 // Make the hash mask from the length of the number string cache. It
4962 // contains two elements (number and string) for each cache entry.
4963 lw(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset));
4964 // Divide length by two (length is a smi).
4965 sra(mask, mask, kSmiTagSize + 1);
4966 Addu(mask, mask, -1); // Make mask.
4967
4968 // Calculate the entry in the number string cache. The hash value in the
4969 // number string cache for smis is just the smi value, and the hash for
4970 // doubles is the xor of the upper and lower words. See
4971 // Heap::GetNumberStringCache.
4972 Label is_smi;
4973 Label load_result_from_cache;
4974 JumpIfSmi(object, &is_smi);
4975 CheckMap(object,
4976 scratch1,
4977 Heap::kHeapNumberMapRootIndex,
4978 not_found,
4979 DONT_DO_SMI_CHECK);
4980
4981 STATIC_ASSERT(8 == kDoubleSize);
4982 Addu(scratch1,
4983 object,
4984 Operand(HeapNumber::kValueOffset - kHeapObjectTag));
4985 lw(scratch2, MemOperand(scratch1, kPointerSize));
4986 lw(scratch1, MemOperand(scratch1, 0));
4987 Xor(scratch1, scratch1, Operand(scratch2));
4988 And(scratch1, scratch1, Operand(mask));
4989
4990 // Calculate address of entry in string cache: each entry consists
4991 // of two pointer sized fields.
4992 sll(scratch1, scratch1, kPointerSizeLog2 + 1);
4993 Addu(scratch1, number_string_cache, scratch1);
4994
4995 Register probe = mask;
4996 lw(probe, FieldMemOperand(scratch1, FixedArray::kHeaderSize));
4997 JumpIfSmi(probe, not_found);
4998 ldc1(f12, FieldMemOperand(object, HeapNumber::kValueOffset));
4999 ldc1(f14, FieldMemOperand(probe, HeapNumber::kValueOffset));
5000 BranchF(&load_result_from_cache, NULL, eq, f12, f14);
5001 Branch(not_found);
5002
5003 bind(&is_smi);
5004 Register scratch = scratch1;
5005 sra(scratch, object, 1); // Shift away the tag.
5006 And(scratch, mask, Operand(scratch));
5007
5008 // Calculate address of entry in string cache: each entry consists
5009 // of two pointer sized fields.
5010 sll(scratch, scratch, kPointerSizeLog2 + 1);
5011 Addu(scratch, number_string_cache, scratch);
5012
5013 // Check if the entry is the smi we are looking for.
5014 lw(probe, FieldMemOperand(scratch, FixedArray::kHeaderSize));
5015 Branch(not_found, ne, object, Operand(probe));
5016
5017 // Get the result from the cache.
5018 bind(&load_result_from_cache);
5019 lw(result, FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize));
5020
5021 IncrementCounter(isolate()->counters()->number_to_string_native(),
5022 1,
5023 scratch1,
5024 scratch2);
5025 }
5026
5027
4948 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings( 5028 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings(
4949 Register first, 5029 Register first,
4950 Register second, 5030 Register second,
4951 Register scratch1, 5031 Register scratch1,
4952 Register scratch2, 5032 Register scratch2,
4953 Label* failure) { 5033 Label* failure) {
4954 // Test that both first and second are sequential ASCII strings. 5034 // Test that both first and second are sequential ASCII strings.
4955 // Assume that they are non-smis. 5035 // Assume that they are non-smis.
4956 lw(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); 5036 lw(scratch1, FieldMemOperand(first, HeapObject::kMapOffset));
4957 lw(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); 5037 lw(scratch2, FieldMemOperand(second, HeapObject::kMapOffset));
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
5612 opcode == BGTZL); 5692 opcode == BGTZL);
5613 opcode = (cond == eq) ? BEQ : BNE; 5693 opcode = (cond == eq) ? BEQ : BNE;
5614 instr = (instr & ~kOpcodeMask) | opcode; 5694 instr = (instr & ~kOpcodeMask) | opcode;
5615 masm_.emit(instr); 5695 masm_.emit(instr);
5616 } 5696 }
5617 5697
5618 5698
5619 } } // namespace v8::internal 5699 } } // namespace v8::internal
5620 5700
5621 #endif // V8_TARGET_ARCH_MIPS 5701 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698