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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 DCHECK(!env.IsEmpty()); | 290 DCHECK(!env.IsEmpty()); |
291 { | 291 { |
292 v8::HandleScope handle_scope(v8_isolate); | 292 v8::HandleScope handle_scope(v8_isolate); |
293 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 293 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
294 } | 294 } |
295 // Make sure all builtin scripts are cached. | 295 // Make sure all builtin scripts are cached. |
296 { | 296 { |
297 HandleScope scope(isolate); | 297 HandleScope scope(isolate); |
298 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 298 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
299 isolate->bootstrapper()->NativesSourceLookup(i); | 299 isolate->bootstrapper()->SourceLookup<Natives>(i); |
300 } | 300 } |
301 } | 301 } |
302 heap->CollectAllGarbage(); | 302 heap->CollectAllGarbage(); |
303 heap->CollectAllGarbage(); | 303 heap->CollectAllGarbage(); |
304 | 304 |
305 Object* raw_foo; | 305 Object* raw_foo; |
306 { | 306 { |
307 v8::HandleScope handle_scope(v8_isolate); | 307 v8::HandleScope handle_scope(v8_isolate); |
308 v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo"); | 308 v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo"); |
309 DCHECK(!foo.IsEmpty()); | 309 DCHECK(!foo.IsEmpty()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 DCHECK(!env.IsEmpty()); | 413 DCHECK(!env.IsEmpty()); |
414 { | 414 { |
415 v8::HandleScope handle_scope(v8_isolate); | 415 v8::HandleScope handle_scope(v8_isolate); |
416 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 416 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
417 } | 417 } |
418 // Make sure all builtin scripts are cached. | 418 // Make sure all builtin scripts are cached. |
419 { | 419 { |
420 HandleScope scope(isolate); | 420 HandleScope scope(isolate); |
421 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 421 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
422 isolate->bootstrapper()->NativesSourceLookup(i); | 422 isolate->bootstrapper()->SourceLookup<Natives>(i); |
423 } | 423 } |
424 } | 424 } |
425 // If we don't do this then we end up with a stray root pointing at the | 425 // If we don't do this then we end up with a stray root pointing at the |
426 // context even after we have disposed of env. | 426 // context even after we have disposed of env. |
427 heap->CollectAllGarbage(); | 427 heap->CollectAllGarbage(); |
428 | 428 |
429 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; | 429 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; |
430 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 430 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
431 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 431 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
432 | 432 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 v8::Handle<v8::String> source_str = v8::String::NewFromOneByte( | 547 v8::Handle<v8::String> source_str = v8::String::NewFromOneByte( |
548 v8_isolate, source.start(), v8::String::kNormalString, | 548 v8_isolate, source.start(), v8::String::kNormalString, |
549 source.length()); | 549 source.length()); |
550 CompileRun(source_str); | 550 CompileRun(source_str); |
551 source.Dispose(); | 551 source.Dispose(); |
552 } | 552 } |
553 // Make sure all builtin scripts are cached. | 553 // Make sure all builtin scripts are cached. |
554 { | 554 { |
555 HandleScope scope(isolate); | 555 HandleScope scope(isolate); |
556 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 556 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
557 isolate->bootstrapper()->NativesSourceLookup(i); | 557 isolate->bootstrapper()->SourceLookup<Natives>(i); |
558 } | 558 } |
559 } | 559 } |
560 // If we don't do this then we end up with a stray root pointing at the | 560 // If we don't do this then we end up with a stray root pointing at the |
561 // context even after we have disposed of env. | 561 // context even after we have disposed of env. |
562 isolate->heap()->CollectAllAvailableGarbage("snapshotting"); | 562 isolate->heap()->CollectAllAvailableGarbage("snapshotting"); |
563 | 563 |
564 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; | 564 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; |
565 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 565 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
566 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 566 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
567 | 567 |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 isolate->Dispose(); | 1569 isolate->Dispose(); |
1570 } | 1570 } |
1571 | 1571 |
1572 | 1572 |
1573 TEST(SerializationMemoryStats) { | 1573 TEST(SerializationMemoryStats) { |
1574 FLAG_profile_deserialization = true; | 1574 FLAG_profile_deserialization = true; |
1575 FLAG_always_opt = false; | 1575 FLAG_always_opt = false; |
1576 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1576 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
1577 delete[] blob.data; | 1577 delete[] blob.data; |
1578 } | 1578 } |
OLD | NEW |