OLD | NEW |
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 18275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18286 bool finished = false; | 18286 bool finished = false; |
18287 for (int i = 0; i < 200 && !finished; i++) { | 18287 for (int i = 0; i < 200 && !finished; i++) { |
18288 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs); | 18288 finished = env->GetIsolate()->IdleNotification(IdlePauseInMs); |
18289 } | 18289 } |
18290 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 18290 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
18291 CHECK(finished); | 18291 CHECK(finished); |
18292 CHECK_LT(final_size, initial_size + 1); | 18292 CHECK_LT(final_size, initial_size + 1); |
18293 } | 18293 } |
18294 | 18294 |
18295 | 18295 |
18296 TEST(Regress2107) { | |
18297 const intptr_t MB = 1024 * 1024; | |
18298 const int kIdlePauseInMs = 10000; | |
18299 LocalContext env; | |
18300 v8::Isolate* isolate = env->GetIsolate(); | |
18301 v8::HandleScope scope(env->GetIsolate()); | |
18302 intptr_t initial_size = CcTest::heap()->SizeOfObjects(); | |
18303 // Send idle notification to start a round of incremental GCs. | |
18304 env->GetIsolate()->IdleNotification(kIdlePauseInMs); | |
18305 // Emulate 7 page reloads. | |
18306 for (int i = 0; i < 7; i++) { | |
18307 { | |
18308 v8::HandleScope inner_scope(env->GetIsolate()); | |
18309 v8::Local<v8::Context> ctx = v8::Context::New(isolate); | |
18310 ctx->Enter(); | |
18311 CreateGarbageInOldSpace(); | |
18312 ctx->Exit(); | |
18313 } | |
18314 env->GetIsolate()->ContextDisposedNotification(); | |
18315 env->GetIsolate()->IdleNotification(kIdlePauseInMs); | |
18316 } | |
18317 // Create garbage and check that idle notification still collects it. | |
18318 CreateGarbageInOldSpace(); | |
18319 intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects(); | |
18320 CHECK_GT(size_with_garbage, initial_size + MB); | |
18321 bool finished = false; | |
18322 for (int i = 0; i < 200 && !finished; i++) { | |
18323 finished = env->GetIsolate()->IdleNotification(kIdlePauseInMs); | |
18324 } | |
18325 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | |
18326 CHECK_LT(final_size, initial_size + 1); | |
18327 } | |
18328 | |
18329 | |
18330 TEST(Regress2333) { | 18296 TEST(Regress2333) { |
18331 LocalContext env; | 18297 LocalContext env; |
18332 for (int i = 0; i < 3; i++) { | 18298 for (int i = 0; i < 3; i++) { |
18333 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 18299 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
18334 } | 18300 } |
18335 } | 18301 } |
18336 | 18302 |
18337 static uint32_t* stack_limit; | 18303 static uint32_t* stack_limit; |
18338 | 18304 |
18339 static void GetStackLimitCallback( | 18305 static void GetStackLimitCallback( |
(...skipping 5487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23827 char chunk2[] = | 23793 char chunk2[] = |
23828 "XXr = 13;\n" | 23794 "XXr = 13;\n" |
23829 " return foob\xeb\x91\x80\xeb\x91\x80r;\n" | 23795 " return foob\xeb\x91\x80\xeb\x91\x80r;\n" |
23830 "}\n"; | 23796 "}\n"; |
23831 chunk1[strlen(chunk1) - 1] = reference[0]; | 23797 chunk1[strlen(chunk1) - 1] = reference[0]; |
23832 chunk2[0] = reference[1]; | 23798 chunk2[0] = reference[1]; |
23833 chunk2[1] = reference[2]; | 23799 chunk2[1] = reference[2]; |
23834 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 23800 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; |
23835 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); | 23801 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); |
23836 } | 23802 } |
OLD | NEW |