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

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

Issue 450034: Remove the last context dependent reference from the Script object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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
« src/compiler.cc ('K') | « src/objects-inl.h ('k') | 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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 8507 matching lines...) Expand 10 before | Expand all | Expand 10 after
8518 int count = 0; 8518 int count = 0;
8519 v8::internal::HeapIterator it; 8519 v8::internal::HeapIterator it;
8520 while (it.has_next()) { 8520 while (it.has_next()) {
8521 v8::internal::HeapObject* object = it.next(); 8521 v8::internal::HeapObject* object = it.next();
8522 if (object->IsJSGlobalObject()) count++; 8522 if (object->IsJSGlobalObject()) count++;
8523 } 8523 }
8524 return count; 8524 return count;
8525 } 8525 }
8526 8526
8527 8527
8528 TEST(Bug528) { 8528 TEST(Regress528) {
8529 v8::V8::Initialize(); 8529 v8::V8::Initialize();
8530 8530
8531 v8::HandleScope scope; 8531 v8::HandleScope scope;
8532 v8::Persistent<Context> context; 8532 v8::Persistent<Context> context;
8533 v8::Persistent<Context> other_context; 8533 v8::Persistent<Context> other_context;
8534 int gc_count; 8534 int gc_count;
8535 8535
8536 // Create a context used to keep the code from aging in the compilation 8536 // Create a context used to keep the code from aging in the compilation
8537 // cache. 8537 // cache.
8538 other_context = Context::New(); 8538 other_context = Context::New();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8573 context->Exit(); 8573 context->Exit();
8574 } 8574 }
8575 context.Dispose(); 8575 context.Dispose();
8576 for (gc_count = 1; gc_count < 10; gc_count++) { 8576 for (gc_count = 1; gc_count < 10; gc_count++) {
8577 other_context->Enter(); 8577 other_context->Enter();
8578 CompileRun(source_eval); 8578 CompileRun(source_eval);
8579 other_context->Exit(); 8579 other_context->Exit();
8580 v8::internal::Heap::CollectAllGarbage(false); 8580 v8::internal::Heap::CollectAllGarbage(false);
8581 if (GetGlobalObjectsCount() == 1) break; 8581 if (GetGlobalObjectsCount() == 1) break;
8582 } 8582 }
8583 CHECK_EQ(10, gc_count); // Should be 1 or 2 when the bug is resolved. 8583 CHECK_GE(2, gc_count);
8584 CHECK_EQ(2, GetGlobalObjectsCount()); // Should be 1 when resolved. 8584 CHECK_EQ(1, GetGlobalObjectsCount());
8585 8585
8586 // Looking up the line number for an exception creates reference from the 8586 // Looking up the line number for an exception creates reference from the
8587 // compilation cache to the global object. 8587 // compilation cache to the global object.
8588 const char* source_exception = "function f(){throw 1;} f()"; 8588 const char* source_exception = "function f(){throw 1;} f()";
8589 context = Context::New(); 8589 context = Context::New();
8590 { 8590 {
8591 v8::HandleScope scope; 8591 v8::HandleScope scope;
8592 8592
8593 context->Enter(); 8593 context->Enter();
8594 v8::TryCatch try_catch; 8594 v8::TryCatch try_catch;
(...skipping 10 matching lines...) Expand all
8605 CompileRun(source_exception); 8605 CompileRun(source_exception);
8606 other_context->Exit(); 8606 other_context->Exit();
8607 v8::internal::Heap::CollectAllGarbage(false); 8607 v8::internal::Heap::CollectAllGarbage(false);
8608 if (GetGlobalObjectsCount() == 1) break; 8608 if (GetGlobalObjectsCount() == 1) break;
8609 } 8609 }
8610 CHECK_GE(2, gc_count); 8610 CHECK_GE(2, gc_count);
8611 CHECK_EQ(1, GetGlobalObjectsCount()); 8611 CHECK_EQ(1, GetGlobalObjectsCount());
8612 8612
8613 other_context.Dispose(); 8613 other_context.Dispose();
8614 } 8614 }
OLDNEW
« src/compiler.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698