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

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

Issue 1506753002: [test] Test expectations in cctest should use CHECK and not DCHECK. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « test/cctest/test-sampler-api.cc ('k') | test/cctest/test-strings.cc » ('j') | 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-2010 the V8 project authors. All rights reserved. 1 // Copyright 2007-2010 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); 287 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
288 v8_isolate->Enter(); 288 v8_isolate->Enter();
289 { 289 {
290 Heap* heap = isolate->heap(); 290 Heap* heap = isolate->heap();
291 291
292 v8::Persistent<v8::Context> env; 292 v8::Persistent<v8::Context> env;
293 { 293 {
294 HandleScope scope(isolate); 294 HandleScope scope(isolate);
295 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); 295 env.Reset(v8_isolate, v8::Context::New(v8_isolate));
296 } 296 }
297 DCHECK(!env.IsEmpty()); 297 CHECK(!env.IsEmpty());
298 { 298 {
299 v8::HandleScope handle_scope(v8_isolate); 299 v8::HandleScope handle_scope(v8_isolate);
300 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); 300 v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
301 } 301 }
302 // Make sure all builtin scripts are cached. 302 // Make sure all builtin scripts are cached.
303 { 303 {
304 HandleScope scope(isolate); 304 HandleScope scope(isolate);
305 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 305 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
306 isolate->bootstrapper()->SourceLookup<Natives>(i); 306 isolate->bootstrapper()->SourceLookup<Natives>(i);
307 } 307 }
308 } 308 }
309 heap->CollectAllGarbage(); 309 heap->CollectAllGarbage();
310 heap->CollectAllGarbage(); 310 heap->CollectAllGarbage();
311 311
312 Object* raw_foo; 312 Object* raw_foo;
313 { 313 {
314 v8::HandleScope handle_scope(v8_isolate); 314 v8::HandleScope handle_scope(v8_isolate);
315 v8::Local<v8::String> foo = v8_str("foo"); 315 v8::Local<v8::String> foo = v8_str("foo");
316 DCHECK(!foo.IsEmpty()); 316 CHECK(!foo.IsEmpty());
317 raw_foo = *(v8::Utils::OpenHandle(*foo)); 317 raw_foo = *(v8::Utils::OpenHandle(*foo));
318 } 318 }
319 319
320 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; 320 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
321 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); 321 Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
322 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); 322 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
323 323
324 { 324 {
325 v8::HandleScope handle_scope(v8_isolate); 325 v8::HandleScope handle_scope(v8_isolate);
326 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); 326 v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); 406 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
407 Heap* heap = isolate->heap(); 407 Heap* heap = isolate->heap();
408 { 408 {
409 v8::Isolate::Scope isolate_scope(v8_isolate); 409 v8::Isolate::Scope isolate_scope(v8_isolate);
410 410
411 v8::Persistent<v8::Context> env; 411 v8::Persistent<v8::Context> env;
412 { 412 {
413 HandleScope scope(isolate); 413 HandleScope scope(isolate);
414 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); 414 env.Reset(v8_isolate, v8::Context::New(v8_isolate));
415 } 415 }
416 DCHECK(!env.IsEmpty()); 416 CHECK(!env.IsEmpty());
417 { 417 {
418 v8::HandleScope handle_scope(v8_isolate); 418 v8::HandleScope handle_scope(v8_isolate);
419 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); 419 v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
420 } 420 }
421 // Make sure all builtin scripts are cached. 421 // Make sure all builtin scripts are cached.
422 { 422 {
423 HandleScope scope(isolate); 423 HandleScope scope(isolate);
424 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { 424 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
425 isolate->bootstrapper()->SourceLookup<Natives>(i); 425 isolate->bootstrapper()->SourceLookup<Natives>(i);
426 } 426 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true); 517 v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
518 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); 518 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
519 { 519 {
520 v8::Isolate::Scope isolate_scope(v8_isolate); 520 v8::Isolate::Scope isolate_scope(v8_isolate);
521 521
522 v8::Persistent<v8::Context> env; 522 v8::Persistent<v8::Context> env;
523 { 523 {
524 HandleScope scope(isolate); 524 HandleScope scope(isolate);
525 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); 525 env.Reset(v8_isolate, v8::Context::New(v8_isolate));
526 } 526 }
527 DCHECK(!env.IsEmpty()); 527 CHECK(!env.IsEmpty());
528 { 528 {
529 v8::HandleScope handle_scope(v8_isolate); 529 v8::HandleScope handle_scope(v8_isolate);
530 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); 530 v8::Local<v8::Context>::New(v8_isolate, env)->Enter();
531 // After execution, e's function context refers to the global object. 531 // After execution, e's function context refers to the global object.
532 CompileRun( 532 CompileRun(
533 "var e;" 533 "var e;"
534 "(function() {" 534 "(function() {"
535 " e = function(s) { return eval (s); }" 535 " e = function(s) { return eval (s); }"
536 "})();" 536 "})();"
537 "var o = this;" 537 "var o = this;"
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 } 1506 }
1507 CHECK(!cache->rejected); 1507 CHECK(!cache->rejected);
1508 v8::Local<v8::Value> result = script->BindToCurrentContext() 1508 v8::Local<v8::Value> result = script->BindToCurrentContext()
1509 ->Run(isolate2->GetCurrentContext()) 1509 ->Run(isolate2->GetCurrentContext())
1510 .ToLocalChecked(); 1510 .ToLocalChecked();
1511 CHECK(result->ToString(isolate2->GetCurrentContext()) 1511 CHECK(result->ToString(isolate2->GetCurrentContext())
1512 .ToLocalChecked() 1512 .ToLocalChecked()
1513 ->Equals(isolate2->GetCurrentContext(), v8_str("abcdef")) 1513 ->Equals(isolate2->GetCurrentContext(), v8_str("abcdef"))
1514 .FromJust()); 1514 .FromJust());
1515 } 1515 }
1516 DCHECK(toplevel_test_code_event_found); 1516 CHECK(toplevel_test_code_event_found);
1517 isolate2->Dispose(); 1517 isolate2->Dispose();
1518 } 1518 }
1519 1519
1520 1520
1521 TEST(SerializeToplevelFlagChange) { 1521 TEST(SerializeToplevelFlagChange) {
1522 FLAG_serialize_toplevel = true; 1522 FLAG_serialize_toplevel = true;
1523 1523
1524 const char* source = "function f() { return 'abc'; }; f() + 'def'"; 1524 const char* source = "function f() { return 'abc'; }; f() + 'def'";
1525 v8::ScriptCompiler::CachedData* cache = ProduceCache(source); 1525 v8::ScriptCompiler::CachedData* cache = ProduceCache(source);
1526 1526
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 delete script_data; 1766 delete script_data;
1767 } 1767 }
1768 1768
1769 1769
1770 TEST(SerializationMemoryStats) { 1770 TEST(SerializationMemoryStats) {
1771 FLAG_profile_deserialization = true; 1771 FLAG_profile_deserialization = true;
1772 FLAG_always_opt = false; 1772 FLAG_always_opt = false;
1773 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 1773 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
1774 delete[] blob.data; 1774 delete[] blob.data;
1775 } 1775 }
OLDNEW
« no previous file with comments | « test/cctest/test-sampler-api.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698