Commit 5bf3e4f5 authored by bak@chromium.org's avatar bak@chromium.org

- Eliminated superfluous type tests in IsMatch.

Review URL: http://codereview.chromium.org/7622

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@523 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 33b050dd
...@@ -5344,8 +5344,8 @@ class NumberKey : public HashTableKey { ...@@ -5344,8 +5344,8 @@ class NumberKey : public HashTableKey {
} }
private: private:
bool IsMatch(Object* other) { bool IsMatch(Object* number) {
return number_ == ToUint32(other); return number_ == ToUint32(number);
} }
// Thomas Wang, Integer Hash Functions. // Thomas Wang, Integer Hash Functions.
...@@ -5391,9 +5391,8 @@ class StringKey : public HashTableKey { ...@@ -5391,9 +5391,8 @@ class StringKey : public HashTableKey {
string_ = string; string_ = string;
} }
bool IsMatch(Object* other) { bool IsMatch(Object* string) {
if (!other->IsString()) return false; return string_->Equals(String::cast(string));
return string_->Equals(String::cast(other));
} }
uint32_t Hash() { return StringHash(string_); } uint32_t Hash() { return StringHash(string_); }
...@@ -5417,9 +5416,8 @@ class Utf8SymbolKey : public HashTableKey { ...@@ -5417,9 +5416,8 @@ class Utf8SymbolKey : public HashTableKey {
explicit Utf8SymbolKey(Vector<const char> string) explicit Utf8SymbolKey(Vector<const char> string)
: string_(string), length_field_(0) { } : string_(string), length_field_(0) { }
bool IsMatch(Object* other) { bool IsMatch(Object* string) {
if (!other->IsString()) return false; return String::cast(string)->IsEqualTo(string_);
return String::cast(other)->IsEqualTo(string_);
} }
HashFunction GetHashFunction() { HashFunction GetHashFunction() {
...@@ -5463,9 +5461,8 @@ class SymbolKey : public HashTableKey { ...@@ -5463,9 +5461,8 @@ class SymbolKey : public HashTableKey {
return StringHash; return StringHash;
} }
bool IsMatch(Object* other) { bool IsMatch(Object* string) {
if (!other->IsString()) return false; return String::cast(string)->Equals(string_);
return String::cast(other)->Equals(string_);
} }
uint32_t Hash() { return string_->Hash(); } uint32_t Hash() { return string_->Hash(); }
...@@ -5712,9 +5709,8 @@ class SymbolsKey : public HashTableKey { ...@@ -5712,9 +5709,8 @@ class SymbolsKey : public HashTableKey {
symbols_ = symbols; symbols_ = symbols;
} }
bool IsMatch(Object* other) { bool IsMatch(Object* symbols) {
if (!other->IsFixedArray()) return false; FixedArray* o = FixedArray::cast(symbols);
FixedArray* o = FixedArray::cast(other);
int len = symbols_->length(); int len = symbols_->length();
if (o->length() != len) return false; if (o->length() != len) return false;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment