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

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

Issue 7385006: Reintroduced dictionary that can use objects as keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review from Vitaly Repeshko. Created 9 years, 4 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
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 4338 matching lines...) Expand 10 before | Expand all | Expand 10 after
4349 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { 4349 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) {
4350 return String::cast(other)->Hash(); 4350 return String::cast(other)->Hash();
4351 } 4351 }
4352 4352
4353 4353
4354 MaybeObject* StringDictionaryShape::AsObject(String* key) { 4354 MaybeObject* StringDictionaryShape::AsObject(String* key) {
4355 return key; 4355 return key;
4356 } 4356 }
4357 4357
4358 4358
4359 bool ObjectDictionaryShape::IsMatch(JSObject* key, Object* other) {
4360 ASSERT(other->IsJSObject());
Vitaly Repeshko 2011/07/26 13:53:14 JSObject::cast does the same assert.
Michael Starzinger 2011/07/26 22:30:23 Fixed.
4361 return key == JSObject::cast(other);
4362 }
4363
4364
4365 uint32_t ObjectDictionaryShape::Hash(JSObject* key) {
4366 MaybeObject* maybe_hash = key->GetIdentityHash();
4367 ASSERT(!maybe_hash->IsFailure());
4368 return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
4369 }
4370
4371
4372 uint32_t ObjectDictionaryShape::HashForObject(JSObject* key, Object* other) {
4373 ASSERT(other->IsJSObject());
Vitaly Repeshko 2011/07/26 13:53:14 Ditto.
Michael Starzinger 2011/07/26 22:30:23 Fixed.
4374 MaybeObject* maybe_hash = JSObject::cast(other)->GetIdentityHash();
4375 ASSERT(!maybe_hash->IsFailure());
4376 return Smi::cast(maybe_hash->ToObjectUnchecked())->value();
4377 }
4378
4379
4380 MaybeObject* ObjectDictionaryShape::AsObject(JSObject* key) {
4381 return key;
4382 }
4383
4384
4359 void Map::ClearCodeCache(Heap* heap) { 4385 void Map::ClearCodeCache(Heap* heap) {
4360 // No write barrier is needed since empty_fixed_array is not in new space. 4386 // No write barrier is needed since empty_fixed_array is not in new space.
4361 // Please note this function is used during marking: 4387 // Please note this function is used during marking:
4362 // - MarkCompactCollector::MarkUnmarkedObject 4388 // - MarkCompactCollector::MarkUnmarkedObject
4363 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array())); 4389 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array()));
4364 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array()); 4390 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array());
4365 } 4391 }
4366 4392
4367 4393
4368 void JSArray::EnsureSize(int required_size) { 4394 void JSArray::EnsureSize(int required_size) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4500 #undef WRITE_INT_FIELD 4526 #undef WRITE_INT_FIELD
4501 #undef READ_SHORT_FIELD 4527 #undef READ_SHORT_FIELD
4502 #undef WRITE_SHORT_FIELD 4528 #undef WRITE_SHORT_FIELD
4503 #undef READ_BYTE_FIELD 4529 #undef READ_BYTE_FIELD
4504 #undef WRITE_BYTE_FIELD 4530 #undef WRITE_BYTE_FIELD
4505 4531
4506 4532
4507 } } // namespace v8::internal 4533 } } // namespace v8::internal
4508 4534
4509 #endif // V8_OBJECTS_INL_H_ 4535 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698