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

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

Issue 11299098: Make test-dictionary work for GC stress builder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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-api.cc ('k') | test/cctest/test-heap.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 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Handle<JSObject> key = FACTORY->NewJSArray(0); 107 Handle<JSObject> key = FACTORY->NewJSArray(0);
108 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); 108 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key);
109 109
110 // Force allocation of hash table backing store for hidden properties. 110 // Force allocation of hash table backing store for hidden properties.
111 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); 111 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1"));
112 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); 112 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2"));
113 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); 113 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3"));
114 114
115 // Simulate a full heap so that generating an identity hash code 115 // Simulate a full heap so that generating an identity hash code
116 // in subsequent calls will request GC. 116 // in subsequent calls will request GC.
117 FLAG_gc_interval = 0; 117 SimulateFullSpace(HEAP->new_space());
118 SimulateFullSpace(HEAP->old_pointer_space());
118 119
119 // Calling Contains() should not cause GC ever. 120 // Calling Contains() should not cause GC ever.
120 CHECK(!table->Contains(*key)); 121 CHECK(!table->Contains(*key));
121 122
122 // Calling Remove() should not cause GC ever. 123 // Calling Remove() should not cause GC ever.
123 CHECK(!table->Remove(*key)->IsFailure()); 124 CHECK(!table->Remove(*key)->IsFailure());
124 125
125 // Calling Add() should request GC by returning a failure. 126 // Calling Add() should request GC by returning a failure.
126 CHECK(table->Add(*key)->IsRetryAfterGC()); 127 CHECK(table->Add(*key)->IsRetryAfterGC());
127 } 128 }
128 #endif 129 #endif
129 130
130 131
131 #ifdef DEBUG 132 #ifdef DEBUG
132 TEST(ObjectHashTableCausesGC) { 133 TEST(ObjectHashTableCausesGC) {
133 v8::HandleScope scope; 134 v8::HandleScope scope;
134 LocalContext context; 135 LocalContext context;
135 Handle<ObjectHashTable> table = FACTORY->NewObjectHashTable(1); 136 Handle<ObjectHashTable> table = FACTORY->NewObjectHashTable(1);
136 Handle<JSObject> key = FACTORY->NewJSArray(0); 137 Handle<JSObject> key = FACTORY->NewJSArray(0);
137 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); 138 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key);
138 139
139 // Force allocation of hash table backing store for hidden properties. 140 // Force allocation of hash table backing store for hidden properties.
140 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); 141 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1"));
141 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); 142 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2"));
142 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); 143 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3"));
143 144
144 // Simulate a full heap so that generating an identity hash code 145 // Simulate a full heap so that generating an identity hash code
145 // in subsequent calls will request GC. 146 // in subsequent calls will request GC.
146 FLAG_gc_interval = 0; 147 SimulateFullSpace(HEAP->new_space());
148 SimulateFullSpace(HEAP->old_pointer_space());
147 149
148 // Calling Lookup() should not cause GC ever. 150 // Calling Lookup() should not cause GC ever.
149 CHECK(table->Lookup(*key)->IsTheHole()); 151 CHECK(table->Lookup(*key)->IsTheHole());
150 152
151 // Calling Put() should request GC by returning a failure. 153 // Calling Put() should request GC by returning a failure.
152 CHECK(table->Put(*key, *key)->IsRetryAfterGC()); 154 CHECK(table->Put(*key, *key)->IsRetryAfterGC());
153 } 155 }
154 #endif 156 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698