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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 5169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5180 if (*key == GetHeap()->identity_hash_string()) { | 5180 if (*key == GetHeap()->identity_hash_string()) { |
5181 return inline_value; | 5181 return inline_value; |
5182 } else { | 5182 } else { |
5183 return GetHeap()->the_hole_value(); | 5183 return GetHeap()->the_hole_value(); |
5184 } | 5184 } |
5185 } | 5185 } |
5186 | 5186 |
5187 if (inline_value->IsUndefined()) return GetHeap()->the_hole_value(); | 5187 if (inline_value->IsUndefined()) return GetHeap()->the_hole_value(); |
5188 | 5188 |
5189 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value); | 5189 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value); |
5190 Object* entry = hashtable->Lookup(*key); | 5190 Object* entry = hashtable->Lookup(key); |
5191 return entry; | 5191 return entry; |
5192 } | 5192 } |
5193 | 5193 |
5194 | 5194 |
5195 Handle<Object> JSObject::SetHiddenProperty(Handle<JSObject> object, | 5195 Handle<Object> JSObject::SetHiddenProperty(Handle<JSObject> object, |
5196 Handle<Name> key, | 5196 Handle<Name> key, |
5197 Handle<Object> value) { | 5197 Handle<Object> value) { |
5198 Isolate* isolate = object->GetIsolate(); | 5198 Isolate* isolate = object->GetIsolate(); |
5199 | 5199 |
5200 ASSERT(key->IsUniqueName()); | 5200 ASSERT(key->IsUniqueName()); |
(...skipping 10828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16029 e = PropertyCell::cast(e)->value(); | 16029 e = PropertyCell::cast(e)->value(); |
16030 } | 16030 } |
16031 if (e == value) return k; | 16031 if (e == value) return k; |
16032 } | 16032 } |
16033 } | 16033 } |
16034 Heap* heap = Dictionary::GetHeap(); | 16034 Heap* heap = Dictionary::GetHeap(); |
16035 return heap->undefined_value(); | 16035 return heap->undefined_value(); |
16036 } | 16036 } |
16037 | 16037 |
16038 | 16038 |
16039 Object* ObjectHashTable::Lookup(Object* key) { | 16039 Object* ObjectHashTable::Lookup(Handle<Object> key) { |
16040 ASSERT(IsKey(key)); | 16040 DisallowHeapAllocation no_gc; |
| 16041 ASSERT(IsKey(*key)); |
16041 | 16042 |
16042 // If the object does not have an identity hash, it was never used as a key. | 16043 // If the object does not have an identity hash, it was never used as a key. |
16043 Object* hash = key->GetHash(); | 16044 Object* hash = key->GetHash(); |
16044 if (hash->IsUndefined()) { | 16045 if (hash->IsUndefined()) { |
16045 return GetHeap()->the_hole_value(); | 16046 return GetHeap()->the_hole_value(); |
16046 } | 16047 } |
16047 int entry = FindEntry(key); | 16048 int entry = FindEntry(key); |
16048 if (entry == kNotFound) return GetHeap()->the_hole_value(); | 16049 if (entry == kNotFound) return GetHeap()->the_hole_value(); |
16049 return get(EntryToIndex(entry) + 1); | 16050 return get(EntryToIndex(entry) + 1); |
16050 } | 16051 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16404 | 16405 |
16405 Handle<OrderedHashSet> OrderedHashSet::Remove(Handle<OrderedHashSet> table, | 16406 Handle<OrderedHashSet> OrderedHashSet::Remove(Handle<OrderedHashSet> table, |
16406 Handle<Object> key) { | 16407 Handle<Object> key) { |
16407 int entry = table->FindEntry(*key); | 16408 int entry = table->FindEntry(*key); |
16408 if (entry == kNotFound) return table; | 16409 if (entry == kNotFound) return table; |
16409 table->RemoveEntry(entry); | 16410 table->RemoveEntry(entry); |
16410 return Shrink(table); | 16411 return Shrink(table); |
16411 } | 16412 } |
16412 | 16413 |
16413 | 16414 |
16414 Object* OrderedHashMap::Lookup(Object* key) { | 16415 Object* OrderedHashMap::Lookup(Handle<Object> key) { |
16415 int entry = FindEntry(key); | 16416 DisallowHeapAllocation no_gc; |
| 16417 int entry = FindEntry(*key); |
16416 if (entry == kNotFound) return GetHeap()->the_hole_value(); | 16418 if (entry == kNotFound) return GetHeap()->the_hole_value(); |
16417 return ValueAt(entry); | 16419 return ValueAt(entry); |
16418 } | 16420 } |
16419 | 16421 |
16420 | 16422 |
16421 Handle<OrderedHashMap> OrderedHashMap::Put(Handle<OrderedHashMap> table, | 16423 Handle<OrderedHashMap> OrderedHashMap::Put(Handle<OrderedHashMap> table, |
16422 Handle<Object> key, | 16424 Handle<Object> key, |
16423 Handle<Object> value) { | 16425 Handle<Object> value) { |
16424 int entry = table->FindEntry(*key); | 16426 int entry = table->FindEntry(*key); |
16425 | 16427 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17243 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17245 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17244 static const char* error_messages_[] = { | 17246 static const char* error_messages_[] = { |
17245 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17247 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17246 }; | 17248 }; |
17247 #undef ERROR_MESSAGES_TEXTS | 17249 #undef ERROR_MESSAGES_TEXTS |
17248 return error_messages_[reason]; | 17250 return error_messages_[reason]; |
17249 } | 17251 } |
17250 | 17252 |
17251 | 17253 |
17252 } } // namespace v8::internal | 17254 } } // namespace v8::internal |
OLD | NEW |