OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "compilation-cache.h" | 7 #include "compilation-cache.h" |
8 #include "execution.h" | 8 #include "execution.h" |
9 #include "factory.h" | 9 #include "factory.h" |
10 #include "macro-assembler.h" | 10 #include "macro-assembler.h" |
(...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 InitializeVM(); | 2422 InitializeVM(); |
2423 v8::HandleScope scope; | 2423 v8::HandleScope scope; |
2424 SourceResource* resource = new SourceResource(i::StrDup(source)); | 2424 SourceResource* resource = new SourceResource(i::StrDup(source)); |
2425 { | 2425 { |
2426 v8::HandleScope scope; | 2426 v8::HandleScope scope; |
2427 v8::Handle<v8::String> source_string = v8::String::NewExternal(resource); | 2427 v8::Handle<v8::String> source_string = v8::String::NewExternal(resource); |
2428 v8::Script::Compile(source_string)->Run(); | 2428 v8::Script::Compile(source_string)->Run(); |
2429 CHECK(!resource->IsDisposed()); | 2429 CHECK(!resource->IsDisposed()); |
2430 } | 2430 } |
2431 HEAP->CollectAllAvailableGarbage(); | 2431 HEAP->CollectAllAvailableGarbage(); |
| 2432 // External source is being retained by the stack trace. |
| 2433 CHECK(!resource->IsDisposed()); |
2432 | 2434 |
| 2435 CompileRun("error.stack;"); |
| 2436 HEAP->CollectAllAvailableGarbage(); |
2433 // External source has been released. | 2437 // External source has been released. |
2434 CHECK(resource->IsDisposed()); | 2438 CHECK(resource->IsDisposed()); |
2435 delete resource; | 2439 delete resource; |
2436 } | 2440 } |
2437 | 2441 |
2438 | 2442 |
2439 TEST(ReleaseStackTraceData) { | 2443 TEST(ReleaseStackTraceData) { |
2440 static const char* source1 = "var error = null; " | 2444 static const char* source1 = "var error = null; " |
2441 /* Normal Error */ "try { " | 2445 /* Normal Error */ "try { " |
2442 " throw new Error(); " | 2446 " throw new Error(); " |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 | 2613 |
2610 // Simulate incremental marking so that unoptimized code is flushed | 2614 // Simulate incremental marking so that unoptimized code is flushed |
2611 // even though it still is cached in the optimized code map. | 2615 // even though it still is cached in the optimized code map. |
2612 SimulateIncrementalMarking(); | 2616 SimulateIncrementalMarking(); |
2613 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 2617 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
2614 | 2618 |
2615 // Make a new closure that will get code installed from the code map. | 2619 // Make a new closure that will get code installed from the code map. |
2616 // Unoptimized code is missing and the deoptimizer will go ballistic. | 2620 // Unoptimized code is missing and the deoptimizer will go ballistic. |
2617 CompileRun("var g = mkClosure(); g('bozo');"); | 2621 CompileRun("var g = mkClosure(); g('bozo');"); |
2618 } | 2622 } |
OLD | NEW |