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

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

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 years, 11 months 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 | « test/cctest/test-regexp.cc ('k') | test/cctest/test-thread-termination.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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return true; 244 return true;
245 } 245 }
246 246
247 247
248 static void Serialize() { 248 static void Serialize() {
249 // We have to create one context. One reason for this is so that the builtins 249 // We have to create one context. One reason for this is so that the builtins
250 // can be loaded from v8natives.js and their addresses can be processed. This 250 // can be loaded from v8natives.js and their addresses can be processed. This
251 // will clear the pending fixups array, which would otherwise contain GC roots 251 // will clear the pending fixups array, which would otherwise contain GC roots
252 // that would confuse the serialization/deserialization process. 252 // that would confuse the serialization/deserialization process.
253 v8::Persistent<v8::Context> env = v8::Context::New(); 253 v8::Persistent<v8::Context> env = v8::Context::New();
254 env.Dispose(); 254 env.Dispose(env->GetIsolate());
255 WriteToFile(FLAG_testing_serialization_file); 255 WriteToFile(FLAG_testing_serialization_file);
256 } 256 }
257 257
258 258
259 // Test that the whole heap can be serialized. 259 // Test that the whole heap can be serialized.
260 TEST(Serialize) { 260 TEST(Serialize) {
261 if (!Snapshot::HaveASnapshotToStartFrom()) { 261 if (!Snapshot::HaveASnapshotToStartFrom()) {
262 Serializer::Enable(); 262 Serializer::Enable();
263 v8::V8::Initialize(); 263 v8::V8::Initialize();
264 Serialize(); 264 Serialize();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 v8::Local<v8::String> foo = v8::String::New("foo"); 383 v8::Local<v8::String> foo = v8::String::New("foo");
384 ASSERT(!foo.IsEmpty()); 384 ASSERT(!foo.IsEmpty());
385 raw_foo = *(v8::Utils::OpenHandle(*foo)); 385 raw_foo = *(v8::Utils::OpenHandle(*foo));
386 } 386 }
387 387
388 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; 388 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
389 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); 389 Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
390 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); 390 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
391 391
392 env->Exit(); 392 env->Exit();
393 env.Dispose(); 393 env.Dispose(env->GetIsolate());
394 394
395 FileByteSink startup_sink(startup_name.start()); 395 FileByteSink startup_sink(startup_name.start());
396 StartupSerializer startup_serializer(&startup_sink); 396 StartupSerializer startup_serializer(&startup_sink);
397 startup_serializer.SerializeStrongReferences(); 397 startup_serializer.SerializeStrongReferences();
398 398
399 FileByteSink partial_sink(FLAG_testing_serialization_file); 399 FileByteSink partial_sink(FLAG_testing_serialization_file);
400 PartialSerializer p_ser(&startup_serializer, &partial_sink); 400 PartialSerializer p_ser(&startup_serializer, &partial_sink);
401 p_ser.Serialize(&raw_foo); 401 p_ser.Serialize(&raw_foo);
402 startup_serializer.SerializeWeakReferences(); 402 startup_serializer.SerializeWeakReferences();
403 403
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 511 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
512 512
513 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; 513 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
514 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); 514 Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
515 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); 515 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
516 516
517 env->Exit(); 517 env->Exit();
518 518
519 Object* raw_context = *(v8::Utils::OpenHandle(*env)); 519 Object* raw_context = *(v8::Utils::OpenHandle(*env));
520 520
521 env.Dispose(); 521 env.Dispose(env->GetIsolate());
522 522
523 FileByteSink startup_sink(startup_name.start()); 523 FileByteSink startup_sink(startup_name.start());
524 StartupSerializer startup_serializer(&startup_sink); 524 StartupSerializer startup_serializer(&startup_sink);
525 startup_serializer.SerializeStrongReferences(); 525 startup_serializer.SerializeStrongReferences();
526 526
527 FileByteSink partial_sink(FLAG_testing_serialization_file); 527 FileByteSink partial_sink(FLAG_testing_serialization_file);
528 PartialSerializer p_ser(&startup_serializer, &partial_sink); 528 PartialSerializer p_ser(&startup_serializer, &partial_sink);
529 p_ser.Serialize(&raw_context); 529 p_ser.Serialize(&raw_context);
530 startup_serializer.SerializeWeakReferences(); 530 startup_serializer.SerializeWeakReferences();
531 531
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 TEST(TestThatAlwaysFails) { 595 TEST(TestThatAlwaysFails) {
596 bool ArtificialFailure = false; 596 bool ArtificialFailure = false;
597 CHECK(ArtificialFailure); 597 CHECK(ArtificialFailure);
598 } 598 }
599 599
600 600
601 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { 601 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) {
602 bool ArtificialFailure2 = false; 602 bool ArtificialFailure2 = false;
603 CHECK(ArtificialFailure2); 603 CHECK(ArtificialFailure2);
604 } 604 }
OLDNEW
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698