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

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

Issue 10827040: Limit initial size of hidden properties and store identity hashes inline. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 8 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
« no previous file with comments | « test/cctest/test-dictionary.cc ('k') | test/cctest/test-heap-profiler.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 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 CompileRun(source); 1977 CompileRun(source);
1978 Handle<JSFunction> g = 1978 Handle<JSFunction> g =
1979 v8::Utils::OpenHandle( 1979 v8::Utils::OpenHandle(
1980 *v8::Handle<v8::Function>::Cast( 1980 *v8::Handle<v8::Function>::Cast(
1981 v8::Context::GetCurrent()->Global()->Get(v8_str("g")))); 1981 v8::Context::GetCurrent()->Global()->Get(v8_str("g"))));
1982 1982
1983 AssertNoAllocation no_alloc; 1983 AssertNoAllocation no_alloc;
1984 g->shared()->PrintLn(); 1984 g->shared()->PrintLn();
1985 } 1985 }
1986 #endif // OBJECT_PRINT 1986 #endif // OBJECT_PRINT
1987
1988
1989 TEST(Regress2211) {
1990 InitializeVM();
1991 v8::HandleScope scope;
1992
1993 v8::Handle<v8::String> value = v8_str("val string");
1994 Smi* hash = Smi::FromInt(321);
1995 Heap* heap = Isolate::Current()->heap();
1996
1997 for (int i = 0; i < 2; i++) {
1998 // Store identity hash first and common hidden property second.
1999 v8::Handle<v8::Object> obj = v8::Object::New();
2000 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj);
2001 CHECK(internal_obj->HasFastProperties());
2002
2003 // In the first iteration, set hidden value first and identity hash second.
2004 // In the second iteration, reverse the order.
2005 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value);
2006 MaybeObject* maybe_obj = internal_obj->SetIdentityHash(hash,
2007 ALLOW_CREATION);
2008 CHECK(!maybe_obj->IsFailure());
2009 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value);
2010
2011 // Check values.
2012 CHECK_EQ(hash,
2013 internal_obj->GetHiddenProperty(heap->identity_hash_symbol()));
2014 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string"))));
2015
2016 // Check size.
2017 DescriptorArray* descriptors = internal_obj->map()->instance_descriptors();
2018 ObjectHashTable* hashtable = ObjectHashTable::cast(
2019 internal_obj->FastPropertyAt(descriptors->GetFieldIndex(0)));
2020 CHECK_LE(hashtable->SizeFor(hashtable->length()), 52);
2021 }
2022 }
OLDNEW
« no previous file with comments | « test/cctest/test-dictionary.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698