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

Side by Side Diff: src/heap.cc

Issue 6489: Exclude the bit-field bits from string hash codes. String hash codes... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/ic-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 return long_external_ascii_string_map(); 1865 return long_external_ascii_string_map();
1866 } 1866 }
1867 1867
1868 // No match found. 1868 // No match found.
1869 return NULL; 1869 return NULL;
1870 } 1870 }
1871 1871
1872 1872
1873 Object* Heap::AllocateSymbol(unibrow::CharacterStream* buffer, 1873 Object* Heap::AllocateSymbol(unibrow::CharacterStream* buffer,
1874 int chars, 1874 int chars,
1875 int hash) { 1875 uint32_t length_field) {
1876 // Ensure the chars matches the number of characters in the buffer. 1876 // Ensure the chars matches the number of characters in the buffer.
1877 ASSERT(static_cast<unsigned>(chars) == buffer->Length()); 1877 ASSERT(static_cast<unsigned>(chars) == buffer->Length());
1878 // Determine whether the string is ascii. 1878 // Determine whether the string is ascii.
1879 bool is_ascii = true; 1879 bool is_ascii = true;
1880 while (buffer->has_more()) { 1880 while (buffer->has_more()) {
1881 if (buffer->GetNext() > unibrow::Utf8::kMaxOneByteChar) is_ascii = false; 1881 if (buffer->GetNext() > unibrow::Utf8::kMaxOneByteChar) is_ascii = false;
1882 } 1882 }
1883 buffer->Rewind(); 1883 buffer->Rewind();
1884 1884
1885 // Compute map and object size. 1885 // Compute map and object size.
(...skipping 21 matching lines...) Expand all
1907 } 1907 }
1908 1908
1909 // Allocate string. 1909 // Allocate string.
1910 AllocationSpace space = 1910 AllocationSpace space =
1911 (size > MaxHeapObjectSize()) ? LO_SPACE : OLD_DATA_SPACE; 1911 (size > MaxHeapObjectSize()) ? LO_SPACE : OLD_DATA_SPACE;
1912 Object* result = AllocateRaw(size, space); 1912 Object* result = AllocateRaw(size, space);
1913 if (result->IsFailure()) return result; 1913 if (result->IsFailure()) return result;
1914 1914
1915 reinterpret_cast<HeapObject*>(result)->set_map(map); 1915 reinterpret_cast<HeapObject*>(result)->set_map(map);
1916 // The hash value contains the length of the string. 1916 // The hash value contains the length of the string.
1917 String::cast(result)->set_length_field(hash); 1917 String::cast(result)->set_length_field(length_field);
1918 1918
1919 ASSERT_EQ(size, String::cast(result)->Size()); 1919 ASSERT_EQ(size, String::cast(result)->Size());
1920 1920
1921 // Fill in the characters. 1921 // Fill in the characters.
1922 for (int i = 0; i < chars; i++) { 1922 for (int i = 0; i < chars; i++) {
1923 String::cast(result)->Set(i, buffer->GetNext()); 1923 String::cast(result)->Set(i, buffer->GetNext());
1924 } 1924 }
1925 return result; 1925 return result;
1926 } 1926 }
1927 1927
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 return "Scavenge"; 3035 return "Scavenge";
3036 case MARK_COMPACTOR: 3036 case MARK_COMPACTOR:
3037 return MarkCompactCollector::HasCompacted() ? "Mark-compact" 3037 return MarkCompactCollector::HasCompacted() ? "Mark-compact"
3038 : "Mark-sweep"; 3038 : "Mark-sweep";
3039 } 3039 }
3040 return "Unknown GC"; 3040 return "Unknown GC";
3041 } 3041 }
3042 3042
3043 3043
3044 } } // namespace v8::internal 3044 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698