Version 3.8.5
Fix broken test that assumes that no GC can clear the regexp cache (GC can happen at any time due to Crankshaft).
Fix handling of bogus receivers for Harmony collections. (issue 1884)
Add netbsd support to gyp build.
Determine page size at runtime on posix platforms.
Ensure that store buffer filtering hash sets are cleared after StoreBuffer::Filter.
Randomize the seed used for string hashing. This helps guard against CPU-eating DOS attacks against node.js servers. Based on code from Bert Belder. This version only solves the issue for those that compile V8 themselves or those that do not use snapshots. A snapshot-based precompiled V8 will still have predictable string hash codes.
Implement callback when script finishes running in V8 API.
Improve performance of Math.min and Math.max for the case of two arguments. (issue 1325)
git-svn-id: http://v8.googlecode.com/svn/trunk@10346 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 99a0bb0..c5cf060 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2062,8 +2062,9 @@
// EnsureCapacity will guarantee the hash table is never full.
while (true) {
Object* element = KeyAt(entry);
- if (element == isolate->heap()->undefined_value()) break; // Empty entry.
- if (element != isolate->heap()->the_hole_value() &&
+ // Empty entry.
+ if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
+ if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
Shape::IsMatch(key, element)) return entry;
entry = NextProbe(entry, count++, capacity);
}
@@ -4320,13 +4321,15 @@
}
-StringHasher::StringHasher(int length)
+StringHasher::StringHasher(int length, uint32_t seed)
: length_(length),
- raw_running_hash_(0),
+ raw_running_hash_(seed),
array_index_(0),
is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
is_first_char_(true),
- is_valid_(true) { }
+ is_valid_(true) {
+ ASSERT(FLAG_randomize_string_hashes || raw_running_hash_ == 0);
+}
bool StringHasher::has_trivial_hash() {
@@ -4378,7 +4381,7 @@
result += (result << 3);
result ^= (result >> 11);
result += (result << 15);
- if (result == 0) {
+ if ((result & String::kHashBitMask) == 0) {
result = 27;
}
return result;
@@ -4386,8 +4389,8 @@
template <typename schar>
-uint32_t HashSequentialString(const schar* chars, int length) {
- StringHasher hasher(length);
+uint32_t HashSequentialString(const schar* chars, int length, uint32_t seed) {
+ StringHasher hasher(length, seed);
if (!hasher.has_trivial_hash()) {
int i;
for (i = 0; hasher.is_array_index() && (i < length); i++) {