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

Side by Side Diff: test/cctest/test-heap.cc

Issue 255153002: JSObject::GetHiddenProperty() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/runtime.cc ('k') | no next file » | 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 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 } 2992 }
2993 #endif // OBJECT_PRINT 2993 #endif // OBJECT_PRINT
2994 2994
2995 2995
2996 TEST(Regress2211) { 2996 TEST(Regress2211) {
2997 CcTest::InitializeVM(); 2997 CcTest::InitializeVM();
2998 v8::HandleScope scope(CcTest::isolate()); 2998 v8::HandleScope scope(CcTest::isolate());
2999 2999
3000 v8::Handle<v8::String> value = v8_str("val string"); 3000 v8::Handle<v8::String> value = v8_str("val string");
3001 Smi* hash = Smi::FromInt(321); 3001 Smi* hash = Smi::FromInt(321);
3002 Heap* heap = CcTest::heap(); 3002 Factory* factory = CcTest::i_isolate()->factory();
3003 3003
3004 for (int i = 0; i < 2; i++) { 3004 for (int i = 0; i < 2; i++) {
3005 // Store identity hash first and common hidden property second. 3005 // Store identity hash first and common hidden property second.
3006 v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate()); 3006 v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate());
3007 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj); 3007 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj);
3008 CHECK(internal_obj->HasFastProperties()); 3008 CHECK(internal_obj->HasFastProperties());
3009 3009
3010 // In the first iteration, set hidden value first and identity hash second. 3010 // In the first iteration, set hidden value first and identity hash second.
3011 // In the second iteration, reverse the order. 3011 // In the second iteration, reverse the order.
3012 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value); 3012 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value);
3013 JSObject::SetIdentityHash(internal_obj, handle(hash, CcTest::i_isolate())); 3013 JSObject::SetIdentityHash(internal_obj, handle(hash, CcTest::i_isolate()));
3014 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value); 3014 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value);
3015 3015
3016 // Check values. 3016 // Check values.
3017 CHECK_EQ(hash, 3017 CHECK_EQ(hash,
3018 internal_obj->GetHiddenProperty(heap->identity_hash_string())); 3018 internal_obj->GetHiddenProperty(factory->identity_hash_string()));
3019 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string")))); 3019 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string"))));
3020 3020
3021 // Check size. 3021 // Check size.
3022 DescriptorArray* descriptors = internal_obj->map()->instance_descriptors(); 3022 DescriptorArray* descriptors = internal_obj->map()->instance_descriptors();
3023 ObjectHashTable* hashtable = ObjectHashTable::cast( 3023 ObjectHashTable* hashtable = ObjectHashTable::cast(
3024 internal_obj->RawFastPropertyAt(descriptors->GetFieldIndex(0))); 3024 internal_obj->RawFastPropertyAt(descriptors->GetFieldIndex(0)));
3025 // HashTable header (5) and 4 initial entries (8). 3025 // HashTable header (5) and 4 initial entries (8).
3026 CHECK_LE(hashtable->SizeFor(hashtable->length()), 13 * kPointerSize); 3026 CHECK_LE(hashtable->SizeFor(hashtable->length()), 13 * kPointerSize);
3027 } 3027 }
3028 } 3028 }
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
4215 "array;"); 4215 "array;");
4216 4216
4217 Handle<JSObject> o = 4217 Handle<JSObject> o =
4218 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); 4218 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
4219 CHECK(heap->InOldPointerSpace(o->elements())); 4219 CHECK(heap->InOldPointerSpace(o->elements()));
4220 CHECK(heap->InOldPointerSpace(*o)); 4220 CHECK(heap->InOldPointerSpace(*o));
4221 Page* page = Page::FromAddress(o->elements()->address()); 4221 Page* page = Page::FromAddress(o->elements()->address());
4222 CHECK(page->WasSwept() || 4222 CHECK(page->WasSwept() ||
4223 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); 4223 Marking::IsBlack(Marking::MarkBitFrom(o->elements())));
4224 } 4224 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698