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

Side by Side Diff: test/cctest/test-feedback-vector.cc

Issue 1082973003: Force full GC whenever CollectAllGarbage is meant to trigger a full GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « test/cctest/test-deoptimization.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 CallICNexus nexus(feedback_vector, FeedbackVectorICSlot(ic_slot)); 188 CallICNexus nexus(feedback_vector, FeedbackVectorICSlot(ic_slot));
189 CHECK_EQ(1, feedback_vector->ic_with_type_info_count()); 189 CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
190 CHECK_EQ(0, feedback_vector->ic_generic_count()); 190 CHECK_EQ(0, feedback_vector->ic_generic_count());
191 191
192 // Now send the information generic. 192 // Now send the information generic.
193 CompileRun("f(Object);"); 193 CompileRun("f(Object);");
194 CHECK_EQ(0, feedback_vector->ic_with_type_info_count()); 194 CHECK_EQ(0, feedback_vector->ic_with_type_info_count());
195 CHECK_EQ(1, feedback_vector->ic_generic_count()); 195 CHECK_EQ(1, feedback_vector->ic_generic_count());
196 196
197 // A collection will not affect the site. 197 // A collection will not affect the site.
198 heap->CollectAllGarbage(i::Heap::kNoGCFlags); 198 heap->CollectAllGarbage();
199 CHECK_EQ(0, feedback_vector->ic_with_type_info_count()); 199 CHECK_EQ(0, feedback_vector->ic_with_type_info_count());
200 CHECK_EQ(1, feedback_vector->ic_generic_count()); 200 CHECK_EQ(1, feedback_vector->ic_generic_count());
201 201
202 // The Array function is special. A call to array remains monomorphic 202 // The Array function is special. A call to array remains monomorphic
203 // and isn't cleared by gc because an AllocationSite is being held. 203 // and isn't cleared by gc because an AllocationSite is being held.
204 // Clear the IC manually in order to test this case. 204 // Clear the IC manually in order to test this case.
205 nexus.Clear(*code); 205 nexus.Clear(*code);
206 CompileRun("f(Array);"); 206 CompileRun("f(Array);");
207 CHECK_EQ(1, feedback_vector->ic_with_type_info_count()); 207 CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
208 CHECK_EQ(0, feedback_vector->ic_generic_count()); 208 CHECK_EQ(0, feedback_vector->ic_generic_count());
209 209
210 210
211 CHECK(nexus.GetFeedback()->IsAllocationSite()); 211 CHECK(nexus.GetFeedback()->IsAllocationSite());
212 heap->CollectAllGarbage(i::Heap::kNoGCFlags); 212 heap->CollectAllGarbage();
213 CHECK_EQ(1, feedback_vector->ic_with_type_info_count()); 213 CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
214 CHECK_EQ(0, feedback_vector->ic_generic_count()); 214 CHECK_EQ(0, feedback_vector->ic_generic_count());
215 CHECK(nexus.GetFeedback()->IsAllocationSite()); 215 CHECK(nexus.GetFeedback()->IsAllocationSite());
216 } 216 }
217 217
218 218
219 TEST(VectorCallICStates) { 219 TEST(VectorCallICStates) {
220 if (i::FLAG_always_opt) return; 220 if (i::FLAG_always_opt) return;
221 CcTest::InitializeVM(); 221 CcTest::InitializeVM();
222 LocalContext context; 222 LocalContext context;
(...skipping 13 matching lines...) Expand all
236 FeedbackVectorICSlot slot(0); 236 FeedbackVectorICSlot slot(0);
237 CallICNexus nexus(feedback_vector, slot); 237 CallICNexus nexus(feedback_vector, slot);
238 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 238 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
239 // CallIC doesn't return map feedback. 239 // CallIC doesn't return map feedback.
240 CHECK(!nexus.FindFirstMap()); 240 CHECK(!nexus.FindFirstMap());
241 241
242 CompileRun("f(function() { return 16; })"); 242 CompileRun("f(function() { return 16; })");
243 CHECK_EQ(GENERIC, nexus.StateFromFeedback()); 243 CHECK_EQ(GENERIC, nexus.StateFromFeedback());
244 244
245 // After a collection, state should remain GENERIC. 245 // After a collection, state should remain GENERIC.
246 heap->CollectAllGarbage(i::Heap::kNoGCFlags); 246 heap->CollectAllGarbage();
247 CHECK_EQ(GENERIC, nexus.StateFromFeedback()); 247 CHECK_EQ(GENERIC, nexus.StateFromFeedback());
248 248
249 // A call to Array is special, it contains an AllocationSite as feedback. 249 // A call to Array is special, it contains an AllocationSite as feedback.
250 // Clear the IC manually in order to test this case. 250 // Clear the IC manually in order to test this case.
251 nexus.Clear(f->shared()->code()); 251 nexus.Clear(f->shared()->code());
252 CompileRun("f(Array)"); 252 CompileRun("f(Array)");
253 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 253 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
254 CHECK(nexus.GetFeedback()->IsAllocationSite()); 254 CHECK(nexus.GetFeedback()->IsAllocationSite());
255 255
256 heap->CollectAllGarbage(i::Heap::kNoGCFlags); 256 heap->CollectAllGarbage();
257 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); 257 CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
258 } 258 }
259 259
260 260
261 TEST(VectorLoadICStates) { 261 TEST(VectorLoadICStates) {
262 if (i::FLAG_always_opt || !i::FLAG_vector_ics) return; 262 if (i::FLAG_always_opt || !i::FLAG_vector_ics) return;
263 CcTest::InitializeVM(); 263 CcTest::InitializeVM();
264 LocalContext context; 264 LocalContext context;
265 v8::HandleScope scope(context->GetIsolate()); 265 v8::HandleScope scope(context->GetIsolate());
266 Isolate* isolate = CcTest::i_isolate(); 266 Isolate* isolate = CcTest::i_isolate();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 MapHandleList maps; 300 MapHandleList maps;
301 nexus.FindAllMaps(&maps); 301 nexus.FindAllMaps(&maps);
302 CHECK_EQ(4, maps.length()); 302 CHECK_EQ(4, maps.length());
303 303
304 // Finally driven megamorphic. 304 // Finally driven megamorphic.
305 CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })"); 305 CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })");
306 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); 306 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
307 CHECK(!nexus.FindFirstMap()); 307 CHECK(!nexus.FindFirstMap());
308 308
309 // After a collection, state should not be reset to PREMONOMORPHIC. 309 // After a collection, state should not be reset to PREMONOMORPHIC.
310 heap->CollectAllGarbage(i::Heap::kNoGCFlags); 310 heap->CollectAllGarbage();
311 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); 311 CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
312 } 312 }
313 313
314 314
315 TEST(VectorLoadICSlotSharing) { 315 TEST(VectorLoadICSlotSharing) {
316 if (i::FLAG_always_opt || !i::FLAG_vector_ics) return; 316 if (i::FLAG_always_opt || !i::FLAG_vector_ics) return;
317 CcTest::InitializeVM(); 317 CcTest::InitializeVM();
318 LocalContext context; 318 LocalContext context;
319 v8::HandleScope scope(context->GetIsolate()); 319 v8::HandleScope scope(context->GetIsolate());
320 Isolate* isolate = CcTest::i_isolate(); 320 Isolate* isolate = CcTest::i_isolate();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 CHECK(number_map_found && o_map_found); 390 CHECK(number_map_found && o_map_found);
391 391
392 // The degree of polymorphism doesn't change. 392 // The degree of polymorphism doesn't change.
393 CompileRun("f(100)"); 393 CompileRun("f(100)");
394 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); 394 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
395 MapHandleList maps2; 395 MapHandleList maps2;
396 nexus.FindAllMaps(&maps2); 396 nexus.FindAllMaps(&maps2);
397 CHECK_EQ(2, maps2.length()); 397 CHECK_EQ(2, maps2.length());
398 } 398 }
399 } 399 }
OLDNEW
« no previous file with comments | « test/cctest/test-deoptimization.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698