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

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

Issue 460013: Merge revisions r3393 - r3394 to trunk... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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
« no previous file with comments | « src/version.cc ('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 8409 matching lines...) Expand 10 before | Expand all | Expand 10 after
8420 count++; 8420 count++;
8421 } 8421 }
8422 } 8422 }
8423 #ifdef DEBUG 8423 #ifdef DEBUG
8424 if (count > 0) v8::internal::Heap::TracePathToGlobal(); 8424 if (count > 0) v8::internal::Heap::TracePathToGlobal();
8425 #endif 8425 #endif
8426 return count; 8426 return count;
8427 } 8427 }
8428 8428
8429 8429
8430 TEST(Bug528) { 8430 TEST(Regress528) {
8431 v8::V8::Initialize(); 8431 v8::V8::Initialize();
8432 8432
8433 v8::HandleScope scope; 8433 v8::HandleScope scope;
8434 v8::Persistent<Context> context; 8434 v8::Persistent<Context> context;
8435 int gc_count; 8435 int gc_count;
8436 8436
8437 // Context-dependent context data creates reference from the compilation 8437 // Context-dependent context data creates reference from the compilation
8438 // cache to the global object. 8438 // cache to the global object.
8439 context = Context::New(); 8439 context = Context::New();
8440 { 8440 {
(...skipping 21 matching lines...) Expand all
8462 8462
8463 context->Enter(); 8463 context->Enter();
8464 CompileRun("function f(){eval('1')}; f()"); 8464 CompileRun("function f(){eval('1')}; f()");
8465 context->Exit(); 8465 context->Exit();
8466 } 8466 }
8467 context.Dispose(); 8467 context.Dispose();
8468 for (gc_count = 1; gc_count < 10; gc_count++) { 8468 for (gc_count = 1; gc_count < 10; gc_count++) {
8469 v8::internal::Heap::CollectAllGarbage(false); 8469 v8::internal::Heap::CollectAllGarbage(false);
8470 if (GetGlobalObjectsCount() == 0) break; 8470 if (GetGlobalObjectsCount() == 0) break;
8471 } 8471 }
8472 CHECK_EQ(0, GetGlobalObjectsCount()); 8472 CHECK_GE(2, gc_count);
8473 CHECK_EQ(2, gc_count); 8473 CHECK_EQ(1, GetGlobalObjectsCount());
8474 8474
8475 // Looking up the line number for an exception creates reference from the 8475 // Looking up the line number for an exception creates reference from the
8476 // compilation cache to the global object. 8476 // compilation cache to the global object.
8477 context = Context::New(); 8477 context = Context::New();
8478 { 8478 {
8479 v8::HandleScope scope; 8479 v8::HandleScope scope;
8480 8480
8481 context->Enter(); 8481 context->Enter();
8482 v8::TryCatch try_catch; 8482 v8::TryCatch try_catch;
8483 CompileRun("function f(){throw 1;}; f()"); 8483 CompileRun("function f(){throw 1;}; f()");
8484 CHECK(try_catch.HasCaught()); 8484 CHECK(try_catch.HasCaught());
8485 v8::Handle<v8::Message> message = try_catch.Message(); 8485 v8::Handle<v8::Message> message = try_catch.Message();
8486 CHECK(!message.IsEmpty()); 8486 CHECK(!message.IsEmpty());
8487 CHECK_EQ(1, message->GetLineNumber()); 8487 CHECK_EQ(1, message->GetLineNumber());
8488 context->Exit(); 8488 context->Exit();
8489 } 8489 }
8490 context.Dispose(); 8490 context.Dispose();
8491 for (gc_count = 1; gc_count < 10; gc_count++) { 8491 for (gc_count = 1; gc_count < 10; gc_count++) {
8492 v8::internal::Heap::CollectAllGarbage(false); 8492 v8::internal::Heap::CollectAllGarbage(false);
8493 if (GetGlobalObjectsCount() == 0) break; 8493 if (GetGlobalObjectsCount() == 0) break;
8494 } 8494 }
8495 CHECK_EQ(0, GetGlobalObjectsCount()); 8495 CHECK_EQ(0, GetGlobalObjectsCount());
8496 CHECK_EQ(2, gc_count); 8496 CHECK_EQ(2, gc_count);
8497 } 8497 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698