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

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

Issue 7349005: Added dictionary that can use objects as keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added unit test to gyp buildfile as well. Created 9 years, 5 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') | test/cctest/SConscript » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4295 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { 4295 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) {
4296 return String::cast(other)->Hash(); 4296 return String::cast(other)->Hash();
4297 } 4297 }
4298 4298
4299 4299
4300 MaybeObject* StringDictionaryShape::AsObject(String* key) { 4300 MaybeObject* StringDictionaryShape::AsObject(String* key) {
4301 return key; 4301 return key;
4302 } 4302 }
4303 4303
4304 4304
4305 bool ObjectDictionaryShape::IsMatch(JSObject* key, Object* other) {
4306 ASSERT(other->IsJSObject());
4307 return key == JSObject::cast(other);
4308 }
4309
4310
4311 uint32_t ObjectDictionaryShape::Hash(JSObject* key) {
4312 MaybeObject* maybe_hash = key->GetIdentityHash();
4313 ASSERT(!maybe_hash->IsFailure());
4314 return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
4315 }
4316
4317
4318 uint32_t ObjectDictionaryShape::HashForObject(JSObject* key, Object* other) {
4319 ASSERT(other->IsJSObject());
4320 MaybeObject* maybe_hash = JSObject::cast(other)->GetIdentityHash();
4321 ASSERT(!maybe_hash->IsFailure());
4322 return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
4323 }
4324
4325
4326 MaybeObject* ObjectDictionaryShape::AsObject(JSObject* key) {
4327 return key;
4328 }
4329
4330
4305 void Map::ClearCodeCache(Heap* heap) { 4331 void Map::ClearCodeCache(Heap* heap) {
4306 // No write barrier is needed since empty_fixed_array is not in new space. 4332 // No write barrier is needed since empty_fixed_array is not in new space.
4307 // Please note this function is used during marking: 4333 // Please note this function is used during marking:
4308 // - MarkCompactCollector::MarkUnmarkedObject 4334 // - MarkCompactCollector::MarkUnmarkedObject
4309 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array())); 4335 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array()));
4310 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array()); 4336 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array());
4311 } 4337 }
4312 4338
4313 4339
4314 void JSArray::EnsureSize(int required_size) { 4340 void JSArray::EnsureSize(int required_size) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 #undef WRITE_INT_FIELD 4472 #undef WRITE_INT_FIELD
4447 #undef READ_SHORT_FIELD 4473 #undef READ_SHORT_FIELD
4448 #undef WRITE_SHORT_FIELD 4474 #undef WRITE_SHORT_FIELD
4449 #undef READ_BYTE_FIELD 4475 #undef READ_BYTE_FIELD
4450 #undef WRITE_BYTE_FIELD 4476 #undef WRITE_BYTE_FIELD
4451 4477
4452 4478
4453 } } // namespace v8::internal 4479 } } // namespace v8::internal
4454 4480
4455 #endif // V8_OBJECTS_INL_H_ 4481 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698