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

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

Issue 449053: Fix presubmit errors (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
« 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 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 8501 matching lines...) Expand 10 before | Expand all | Expand 10 after
8512 v8::String::Utf8Value value(try_catch.Exception()); 8512 v8::String::Utf8Value value(try_catch.Exception());
8513 CHECK_EQ(0, strcmp(*value, "Hey!")); 8513 CHECK_EQ(0, strcmp(*value, "Hey!"));
8514 } 8514 }
8515 8515
8516 8516
8517 static int GetGlobalObjectsCount() { 8517 static int GetGlobalObjectsCount() {
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()) { 8522 if (object->IsJSGlobalObject()) count++;
8523 count++;
8524 //object->PrintLn();
8525 }
8526 } 8523 }
8527 return count; 8524 return count;
8528 } 8525 }
8529 8526
8530 8527
8531 TEST(Bug528) { 8528 TEST(Bug528) {
8532 v8::V8::Initialize(); 8529 v8::V8::Initialize();
8533 8530
8534 v8::HandleScope scope; 8531 v8::HandleScope scope;
8535 v8::Persistent<Context> context; 8532 v8::Persistent<Context> context;
(...skipping 18 matching lines...) Expand all
8554 context->Exit(); 8551 context->Exit();
8555 } 8552 }
8556 context.Dispose(); 8553 context.Dispose();
8557 for (gc_count = 1; gc_count < 10; gc_count++) { 8554 for (gc_count = 1; gc_count < 10; gc_count++) {
8558 other_context->Enter(); 8555 other_context->Enter();
8559 CompileRun(source_simple); 8556 CompileRun(source_simple);
8560 other_context->Exit(); 8557 other_context->Exit();
8561 v8::internal::Heap::CollectAllGarbage(false); 8558 v8::internal::Heap::CollectAllGarbage(false);
8562 if (GetGlobalObjectsCount() == 1) break; 8559 if (GetGlobalObjectsCount() == 1) break;
8563 } 8560 }
8564 CHECK(gc_count <= 2); 8561 CHECK_GE(2, gc_count);
8565 CHECK_EQ(1, GetGlobalObjectsCount()); 8562 CHECK_EQ(1, GetGlobalObjectsCount());
8566 8563
8567 // Eval in a function creates reference from the compilation cache to the 8564 // Eval in a function creates reference from the compilation cache to the
8568 // global object. 8565 // global object.
8569 const char* source_eval = "function f(){eval('1')}; f()"; 8566 const char* source_eval = "function f(){eval('1')}; f()";
8570 context = Context::New(); 8567 context = Context::New();
8571 { 8568 {
8572 v8::HandleScope scope; 8569 v8::HandleScope scope;
8573 8570
8574 context->Enter(); 8571 context->Enter();
(...skipping 28 matching lines...) Expand all
8603 context->Exit(); 8600 context->Exit();
8604 } 8601 }
8605 context.Dispose(); 8602 context.Dispose();
8606 for (gc_count = 1; gc_count < 10; gc_count++) { 8603 for (gc_count = 1; gc_count < 10; gc_count++) {
8607 other_context->Enter(); 8604 other_context->Enter();
8608 CompileRun(source_exception); 8605 CompileRun(source_exception);
8609 other_context->Exit(); 8606 other_context->Exit();
8610 v8::internal::Heap::CollectAllGarbage(false); 8607 v8::internal::Heap::CollectAllGarbage(false);
8611 if (GetGlobalObjectsCount() == 1) break; 8608 if (GetGlobalObjectsCount() == 1) break;
8612 } 8609 }
8613 CHECK(gc_count <= 2); 8610 CHECK_GE(2, gc_count);
8614 CHECK_EQ(1, GetGlobalObjectsCount()); 8611 CHECK_EQ(1, GetGlobalObjectsCount());
8615 8612
8616 other_context.Dispose(); 8613 other_context.Dispose();
8617 } 8614 }
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