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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 { | 631 { |
632 v8::Isolate::Scope i_scope(isolate1); | 632 v8::Isolate::Scope i_scope(isolate1); |
633 v8::HandleScope h_scope(isolate1); | 633 v8::HandleScope h_scope(isolate1); |
634 v8::Local<v8::Context> context = v8::Context::New(isolate1); | 634 v8::Local<v8::Context> context = v8::Context::New(isolate1); |
635 delete[] data1.data; // We can dispose of the snapshot blob now. | 635 delete[] data1.data; // We can dispose of the snapshot blob now. |
636 v8::Context::Scope c_scope(context); | 636 v8::Context::Scope c_scope(context); |
637 v8::Maybe<int32_t> result = | 637 v8::Maybe<int32_t> result = |
638 CompileRun("f()")->Int32Value(isolate1->GetCurrentContext()); | 638 CompileRun("f()")->Int32Value(isolate1->GetCurrentContext()); |
639 CHECK_EQ(42, result.FromJust()); | 639 CHECK_EQ(42, result.FromJust()); |
640 CHECK(CompileRun("this.g")->IsUndefined()); | 640 CHECK(CompileRun("this.g")->IsUndefined()); |
| 641 v8::Local<v8::Value> f = CompileRun("f"); |
| 642 i::Handle<i::JSFunction> function = |
| 643 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*f)); |
| 644 // Being part of the snapshot hides a script from the debugger. |
| 645 CHECK(!function->shared()->IsSubjectToDebugging()); |
641 } | 646 } |
642 isolate1->Dispose(); | 647 isolate1->Dispose(); |
643 } | 648 } |
644 | 649 |
645 TEST(CustomSnapshotDataBlob2) { | 650 TEST(CustomSnapshotDataBlob2) { |
646 DisableAlwaysOpt(); | 651 DisableAlwaysOpt(); |
647 const char* source2 = | 652 const char* source2 = |
648 "function f() { return g() * 2; }" | 653 "function f() { return g() * 2; }" |
649 "function g() { return 43; }" | 654 "function g() { return 43; }" |
650 "/./.test('a')"; | 655 "/./.test('a')"; |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 } | 2470 } |
2466 delete[] blob.data; | 2471 delete[] blob.data; |
2467 } | 2472 } |
2468 | 2473 |
2469 TEST(SerializationMemoryStats) { | 2474 TEST(SerializationMemoryStats) { |
2470 FLAG_profile_deserialization = true; | 2475 FLAG_profile_deserialization = true; |
2471 FLAG_always_opt = false; | 2476 FLAG_always_opt = false; |
2472 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2477 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
2473 delete[] blob.data; | 2478 delete[] blob.data; |
2474 } | 2479 } |
OLD | NEW |