| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 14050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14061 ASSERT(!storage || storage->length() == counter); | 14061 ASSERT(!storage || storage->length() == counter); |
| 14062 return counter; | 14062 return counter; |
| 14063 } | 14063 } |
| 14064 | 14064 |
| 14065 | 14065 |
| 14066 int JSObject::GetEnumElementKeys(FixedArray* storage) { | 14066 int JSObject::GetEnumElementKeys(FixedArray* storage) { |
| 14067 return GetOwnElementKeys(storage, static_cast<PropertyAttributes>(DONT_ENUM)); | 14067 return GetOwnElementKeys(storage, static_cast<PropertyAttributes>(DONT_ENUM)); |
| 14068 } | 14068 } |
| 14069 | 14069 |
| 14070 | 14070 |
| 14071 // StringKey simply carries a string object as key. | |
| 14072 class StringKey : public HashTableKey { | |
| 14073 public: | |
| 14074 explicit StringKey(String* string) : | |
| 14075 string_(string), | |
| 14076 hash_(HashForObject(string)) { } | |
| 14077 | |
| 14078 bool IsMatch(Object* string) { | |
| 14079 // We know that all entries in a hash table had their hash keys created. | |
| 14080 // Use that knowledge to have fast failure. | |
| 14081 if (hash_ != HashForObject(string)) { | |
| 14082 return false; | |
| 14083 } | |
| 14084 return string_->Equals(String::cast(string)); | |
| 14085 } | |
| 14086 | |
| 14087 uint32_t Hash() { return hash_; } | |
| 14088 | |
| 14089 uint32_t HashForObject(Object* other) { return String::cast(other)->Hash(); } | |
| 14090 | |
| 14091 Object* AsObject(Heap* heap) { return string_; } | |
| 14092 | |
| 14093 String* string_; | |
| 14094 uint32_t hash_; | |
| 14095 }; | |
| 14096 | |
| 14097 | |
| 14098 // StringSharedKeys are used as keys in the eval cache. | 14071 // StringSharedKeys are used as keys in the eval cache. |
| 14099 class StringSharedKey : public HashTableKey { | 14072 class StringSharedKey : public HashTableKey { |
| 14100 public: | 14073 public: |
| 14101 StringSharedKey(Handle<String> source, | 14074 StringSharedKey(Handle<String> source, |
| 14102 Handle<SharedFunctionInfo> shared, | 14075 Handle<SharedFunctionInfo> shared, |
| 14103 StrictMode strict_mode, | 14076 StrictMode strict_mode, |
| 14104 int scope_position) | 14077 int scope_position) |
| 14105 : source_(source), | 14078 : source_(source), |
| 14106 shared_(shared), | 14079 shared_(shared), |
| 14107 strict_mode_(strict_mode), | 14080 strict_mode_(strict_mode), |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16990 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16963 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16991 static const char* error_messages_[] = { | 16964 static const char* error_messages_[] = { |
| 16992 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16965 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16993 }; | 16966 }; |
| 16994 #undef ERROR_MESSAGES_TEXTS | 16967 #undef ERROR_MESSAGES_TEXTS |
| 16995 return error_messages_[reason]; | 16968 return error_messages_[reason]; |
| 16996 } | 16969 } |
| 16997 | 16970 |
| 16998 | 16971 |
| 16999 } } // namespace v8::internal | 16972 } } // namespace v8::internal |
| OLD | NEW |