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

Side by Side Diff: src/objects-inl.h

Issue 252383006: NameDictionary's key type is now Handle<Name> instead of Name*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/objects.cc ('k') | src/runtime.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 6630 matching lines...) Expand 10 before | Expand all | Expand 10 after
6641 6641
6642 MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) { 6642 MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) {
6643 return heap->NumberFromUint32(key); 6643 return heap->NumberFromUint32(key);
6644 } 6644 }
6645 6645
6646 Handle<Object> NumberDictionaryShape::AsHandle(Isolate* isolate, uint32_t key) { 6646 Handle<Object> NumberDictionaryShape::AsHandle(Isolate* isolate, uint32_t key) {
6647 return isolate->factory()->NewNumberFromUint(key); 6647 return isolate->factory()->NewNumberFromUint(key);
6648 } 6648 }
6649 6649
6650 6650
6651 bool NameDictionaryShape::IsMatch(Name* key, Object* other) { 6651 bool NameDictionaryShape::IsMatch(Handle<Name> key, Object* other) {
6652 // We know that all entries in a hash table had their hash keys created. 6652 // We know that all entries in a hash table had their hash keys created.
6653 // Use that knowledge to have fast failure. 6653 // Use that knowledge to have fast failure.
6654 if (key->Hash() != Name::cast(other)->Hash()) return false; 6654 if (key->Hash() != Name::cast(other)->Hash()) return false;
6655 return key->Equals(Name::cast(other)); 6655 return key->Equals(Name::cast(other));
6656 } 6656 }
6657 6657
6658 6658
6659 uint32_t NameDictionaryShape::Hash(Name* key) { 6659 uint32_t NameDictionaryShape::Hash(Handle<Name> key) {
6660 return key->Hash(); 6660 return key->Hash();
6661 } 6661 }
6662 6662
6663 6663
6664 uint32_t NameDictionaryShape::HashForObject(Name* key, Object* other) { 6664 uint32_t NameDictionaryShape::HashForObject(Handle<Name> key, Object* other) {
6665 return Name::cast(other)->Hash(); 6665 return Name::cast(other)->Hash();
6666 } 6666 }
6667 6667
6668 6668
6669 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Name* key) { 6669 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Handle<Name> key) {
6670 ASSERT(key->IsUniqueName());
6671 return *key;
6672 }
6673
6674
6675 Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate,
6676 Handle<Name> key) {
6670 ASSERT(key->IsUniqueName()); 6677 ASSERT(key->IsUniqueName());
6671 return key; 6678 return key;
6672 } 6679 }
6673 6680
6674 6681
6675 Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate, Name* key) {
6676 ASSERT(key->IsUniqueName());
6677 // TODO(ishell): Convert Name* to Handle<Name> to avoid re-wrapping here.
6678 return handle(key, isolate);
6679 }
6680
6681
6682 bool ObjectHashTableShape::IsMatch(Object* key, Object* other) { 6682 bool ObjectHashTableShape::IsMatch(Object* key, Object* other) {
6683 return key->SameValue(other); 6683 return key->SameValue(other);
6684 } 6684 }
6685 6685
6686 6686
6687 uint32_t ObjectHashTableShape::Hash(Object* key) { 6687 uint32_t ObjectHashTableShape::Hash(Object* key) {
6688 return Smi::cast(key->GetHash())->value(); 6688 return Smi::cast(key->GetHash())->value();
6689 } 6689 }
6690 6690
6691 6691
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
7021 #undef READ_SHORT_FIELD 7021 #undef READ_SHORT_FIELD
7022 #undef WRITE_SHORT_FIELD 7022 #undef WRITE_SHORT_FIELD
7023 #undef READ_BYTE_FIELD 7023 #undef READ_BYTE_FIELD
7024 #undef WRITE_BYTE_FIELD 7024 #undef WRITE_BYTE_FIELD
7025 #undef NOBARRIER_READ_BYTE_FIELD 7025 #undef NOBARRIER_READ_BYTE_FIELD
7026 #undef NOBARRIER_WRITE_BYTE_FIELD 7026 #undef NOBARRIER_WRITE_BYTE_FIELD
7027 7027
7028 } } // namespace v8::internal 7028 } } // namespace v8::internal
7029 7029
7030 #endif // V8_OBJECTS_INL_H_ 7030 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698