| OLD | NEW |
| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 | 211 |
| 212 void FileByteSink::WriteSpaceUsed( | 212 void FileByteSink::WriteSpaceUsed( |
| 213 int new_space_used, | 213 int new_space_used, |
| 214 int pointer_space_used, | 214 int pointer_space_used, |
| 215 int data_space_used, | 215 int data_space_used, |
| 216 int code_space_used, | 216 int code_space_used, |
| 217 int map_space_used, | 217 int map_space_used, |
| 218 int cell_space_used, | 218 int cell_space_used, |
| 219 int large_space_used) { | 219 int large_space_used) { |
| 220 int file_name_length = strlen(file_name_) + 10; | 220 int file_name_length = StrLength(file_name_) + 10; |
| 221 Vector<char> name = Vector<char>::New(file_name_length + 1); | 221 Vector<char> name = Vector<char>::New(file_name_length + 1); |
| 222 OS::SNPrintF(name, "%s.size", file_name_); | 222 OS::SNPrintF(name, "%s.size", file_name_); |
| 223 FILE* fp = OS::FOpen(name.start(), "w"); | 223 FILE* fp = OS::FOpen(name.start(), "w"); |
| 224 fprintf(fp, "new %d\n", new_space_used); | 224 fprintf(fp, "new %d\n", new_space_used); |
| 225 fprintf(fp, "pointer %d\n", pointer_space_used); | 225 fprintf(fp, "pointer %d\n", pointer_space_used); |
| 226 fprintf(fp, "data %d\n", data_space_used); | 226 fprintf(fp, "data %d\n", data_space_used); |
| 227 fprintf(fp, "code %d\n", code_space_used); | 227 fprintf(fp, "code %d\n", code_space_used); |
| 228 fprintf(fp, "map %d\n", map_space_used); | 228 fprintf(fp, "map %d\n", map_space_used); |
| 229 fprintf(fp, "cell %d\n", cell_space_used); | 229 fprintf(fp, "cell %d\n", cell_space_used); |
| 230 fprintf(fp, "large %d\n", large_space_used); | 230 fprintf(fp, "large %d\n", large_space_used); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 Heap::CollectAllGarbage(true); | 361 Heap::CollectAllGarbage(true); |
| 362 | 362 |
| 363 Object* raw_foo; | 363 Object* raw_foo; |
| 364 { | 364 { |
| 365 v8::HandleScope handle_scope; | 365 v8::HandleScope handle_scope; |
| 366 v8::Local<v8::String> foo = v8::String::New("foo"); | 366 v8::Local<v8::String> foo = v8::String::New("foo"); |
| 367 ASSERT(!foo.IsEmpty()); | 367 ASSERT(!foo.IsEmpty()); |
| 368 raw_foo = *(v8::Utils::OpenHandle(*foo)); | 368 raw_foo = *(v8::Utils::OpenHandle(*foo)); |
| 369 } | 369 } |
| 370 | 370 |
| 371 int file_name_length = strlen(FLAG_testing_serialization_file) + 10; | 371 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; |
| 372 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 372 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
| 373 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 373 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
| 374 | 374 |
| 375 env->Exit(); | 375 env->Exit(); |
| 376 env.Dispose(); | 376 env.Dispose(); |
| 377 | 377 |
| 378 FileByteSink startup_sink(startup_name.start()); | 378 FileByteSink startup_sink(startup_name.start()); |
| 379 StartupSerializer startup_serializer(&startup_sink); | 379 StartupSerializer startup_serializer(&startup_sink); |
| 380 startup_serializer.SerializeStrongReferences(); | 380 startup_serializer.SerializeStrongReferences(); |
| 381 | 381 |
| 382 FileByteSink partial_sink(FLAG_testing_serialization_file); | 382 FileByteSink partial_sink(FLAG_testing_serialization_file); |
| 383 PartialSerializer p_ser(&startup_serializer, &partial_sink); | 383 PartialSerializer p_ser(&startup_serializer, &partial_sink); |
| 384 p_ser.Serialize(&raw_foo); | 384 p_ser.Serialize(&raw_foo); |
| 385 startup_serializer.SerializeWeakReferences(); | 385 startup_serializer.SerializeWeakReferences(); |
| 386 partial_sink.WriteSpaceUsed(p_ser.CurrentAllocationAddress(NEW_SPACE), | 386 partial_sink.WriteSpaceUsed(p_ser.CurrentAllocationAddress(NEW_SPACE), |
| 387 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), | 387 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), |
| 388 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), | 388 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), |
| 389 p_ser.CurrentAllocationAddress(CODE_SPACE), | 389 p_ser.CurrentAllocationAddress(CODE_SPACE), |
| 390 p_ser.CurrentAllocationAddress(MAP_SPACE), | 390 p_ser.CurrentAllocationAddress(MAP_SPACE), |
| 391 p_ser.CurrentAllocationAddress(CELL_SPACE), | 391 p_ser.CurrentAllocationAddress(CELL_SPACE), |
| 392 p_ser.CurrentAllocationAddress(LO_SPACE)); | 392 p_ser.CurrentAllocationAddress(LO_SPACE)); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 DEPENDENT_TEST(PartialDeserialization, PartialSerialization) { | 396 DEPENDENT_TEST(PartialDeserialization, PartialSerialization) { |
| 397 int file_name_length = strlen(FLAG_testing_serialization_file) + 10; | 397 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; |
| 398 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 398 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
| 399 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 399 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
| 400 | 400 |
| 401 CHECK(Snapshot::Initialize(startup_name.start())); | 401 CHECK(Snapshot::Initialize(startup_name.start())); |
| 402 | 402 |
| 403 const char* file_name = FLAG_testing_serialization_file; | 403 const char* file_name = FLAG_testing_serialization_file; |
| 404 Vector<char> name = Vector<char>::New(file_name_length + 1); | 404 Vector<char> name = Vector<char>::New(file_name_length + 1); |
| 405 OS::SNPrintF(name, "%s.size", file_name); | 405 OS::SNPrintF(name, "%s.size", file_name); |
| 406 FILE* fp = OS::FOpen(name.start(), "r"); | 406 FILE* fp = OS::FOpen(name.start(), "r"); |
| 407 int new_size, pointer_size, data_size, code_size, map_size, cell_size; | 407 int new_size, pointer_size, data_size, code_size, map_size, cell_size; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 TEST(TestThatAlwaysFails) { | 561 TEST(TestThatAlwaysFails) { |
| 562 bool ArtificialFailure = false; | 562 bool ArtificialFailure = false; |
| 563 CHECK(ArtificialFailure); | 563 CHECK(ArtificialFailure); |
| 564 } | 564 } |
| 565 | 565 |
| 566 | 566 |
| 567 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { | 567 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { |
| 568 bool ArtificialFailure2 = false; | 568 bool ArtificialFailure2 = false; |
| 569 CHECK(ArtificialFailure2); | 569 CHECK(ArtificialFailure2); |
| 570 } | 570 } |
| OLD | NEW |