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

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

Issue 18654006: Make test-heap/TestInternalWeakLists pass with the i18n extension loaded (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years, 5 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 | « no previous file | 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 Heap* heap = isolate->heap(); 1320 Heap* heap = isolate->heap();
1321 HandleScope scope(isolate); 1321 HandleScope scope(isolate);
1322 v8::Handle<v8::Context> ctx[kNumTestContexts]; 1322 v8::Handle<v8::Context> ctx[kNumTestContexts];
1323 1323
1324 CHECK_EQ(0, CountNativeContexts()); 1324 CHECK_EQ(0, CountNativeContexts());
1325 1325
1326 // Create a number of global contests which gets linked together. 1326 // Create a number of global contests which gets linked together.
1327 for (int i = 0; i < kNumTestContexts; i++) { 1327 for (int i = 0; i < kNumTestContexts; i++) {
1328 ctx[i] = v8::Context::New(v8::Isolate::GetCurrent()); 1328 ctx[i] = v8::Context::New(v8::Isolate::GetCurrent());
1329 1329
1330 // Collect garbage that might have been created by one of the
1331 // installed extensions.
1332 isolate->compilation_cache()->Clear();
1333 heap->CollectAllGarbage(Heap::kNoGCFlags);
1334
1330 bool opt = (FLAG_always_opt && i::V8::UseCrankshaft()); 1335 bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
1331 1336
1332 CHECK_EQ(i + 1, CountNativeContexts()); 1337 CHECK_EQ(i + 1, CountNativeContexts());
1333 1338
1334 ctx[i]->Enter(); 1339 ctx[i]->Enter();
1335 1340
1336 // Create a handle scope so no function objects get stuch in the outer 1341 // Create a handle scope so no function objects get stuch in the outer
1337 // handle scope 1342 // handle scope
1338 HandleScope scope(isolate); 1343 HandleScope scope(isolate);
1339 const char* source = "function f1() { };" 1344 const char* source = "function f1() { };"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 HEAP->PerformScavenge(); 1386 HEAP->PerformScavenge();
1382 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i])); 1387 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
1383 } 1388 }
1384 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1389 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1385 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i])); 1390 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i]));
1386 1391
1387 ctx[i]->Exit(); 1392 ctx[i]->Exit();
1388 } 1393 }
1389 1394
1390 // Force compilation cache cleanup. 1395 // Force compilation cache cleanup.
1396 HEAP->NotifyContextDisposed();
1391 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1397 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1392 1398
1393 // Dispose the native contexts one by one. 1399 // Dispose the native contexts one by one.
1394 for (int i = 0; i < kNumTestContexts; i++) { 1400 for (int i = 0; i < kNumTestContexts; i++) {
1395 // TODO(dcarney): is there a better way to do this? 1401 // TODO(dcarney): is there a better way to do this?
1396 i::Object** unsafe = reinterpret_cast<i::Object**>(*ctx[i]); 1402 i::Object** unsafe = reinterpret_cast<i::Object**>(*ctx[i]);
1397 *unsafe = HEAP->undefined_value(); 1403 *unsafe = HEAP->undefined_value();
1398 ctx[i].Clear(); 1404 ctx[i].Clear();
1399 1405
1400 // Scavenge treats these references as strong. 1406 // Scavenge treats these references as strong.
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 i::FLAG_stress_compaction = false; 3010 i::FLAG_stress_compaction = false;
3005 i::FLAG_allow_natives_syntax = true; 3011 i::FLAG_allow_natives_syntax = true;
3006 i::FLAG_flush_code_incrementally = true; 3012 i::FLAG_flush_code_incrementally = true;
3007 3013
3008 // Experimental natives are compiled during snapshot deserialization. 3014 // Experimental natives are compiled during snapshot deserialization.
3009 // This test breaks because heap layout changes in a way that closure 3015 // This test breaks because heap layout changes in a way that closure
3010 // is visited before shared function info. 3016 // is visited before shared function info.
3011 i::FLAG_harmony_typed_arrays = false; 3017 i::FLAG_harmony_typed_arrays = false;
3012 i::FLAG_harmony_array_buffer = false; 3018 i::FLAG_harmony_array_buffer = false;
3013 3019
3020 // Disable loading the i18n extension which breaks the assumptions of this
3021 // test about the heap layout.
3022 i::FLAG_enable_i18n = false;
3023
3014 CcTest::InitializeVM(); 3024 CcTest::InitializeVM();
3015 Isolate* isolate = Isolate::Current(); 3025 Isolate* isolate = Isolate::Current();
3016 Heap* heap = isolate->heap(); 3026 Heap* heap = isolate->heap();
3017 HandleScope scope(isolate); 3027 HandleScope scope(isolate);
3018 3028
3019 // Perform one initial GC to enable code flushing. 3029 // Perform one initial GC to enable code flushing.
3020 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 3030 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
3021 3031
3022 // Prepare a shared function info eligible for code flushing for which 3032 // Prepare a shared function info eligible for code flushing for which
3023 // the unoptimized code will be replaced during optimization. 3033 // the unoptimized code will be replaced during optimization.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 " var a = new Array(n);" 3323 " var a = new Array(n);"
3314 " for (var i = 0; i < n; i += 100) a[i] = i;" 3324 " for (var i = 0; i < n; i += 100) a[i] = i;"
3315 "};" 3325 "};"
3316 "f(10 * 1024 * 1024);"); 3326 "f(10 * 1024 * 1024);");
3317 IncrementalMarking* marking = HEAP->incremental_marking(); 3327 IncrementalMarking* marking = HEAP->incremental_marking();
3318 if (marking->IsStopped()) marking->Start(); 3328 if (marking->IsStopped()) marking->Start();
3319 // This big step should be sufficient to mark the whole array. 3329 // This big step should be sufficient to mark the whole array.
3320 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3330 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3321 ASSERT(marking->IsComplete()); 3331 ASSERT(marking->IsComplete());
3322 } 3332 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698