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()); | |
2434 | 2432 |
2435 CompileRun("error.stack;"); | |
2436 HEAP->CollectAllAvailableGarbage(); | |
2437 // External source has been released. | 2433 // External source has been released. |
2438 CHECK(resource->IsDisposed()); | 2434 CHECK(resource->IsDisposed()); |
2439 delete resource; | 2435 delete resource; |
2440 } | 2436 } |
2441 | 2437 |
2442 | 2438 |
2443 TEST(ReleaseStackTraceData) { | 2439 TEST(ReleaseStackTraceData) { |
2444 static const char* source1 = "var error = null; " | 2440 static const char* source1 = "var error = null; " |
2445 /* Normal Error */ "try { " | 2441 /* Normal Error */ "try { " |
2446 " throw new Error(); " | 2442 " throw new Error(); " |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 // Simulate incremental marking so that the functions are enqueued as | 2564 // Simulate incremental marking so that the functions are enqueued as |
2569 // code flushing candidates. Then optimize one function. Finally | 2565 // code flushing candidates. Then optimize one function. Finally |
2570 // finish the GC to complete code flushing. | 2566 // finish the GC to complete code flushing. |
2571 SimulateIncrementalMarking(); | 2567 SimulateIncrementalMarking(); |
2572 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); | 2568 CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); |
2573 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 2569 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
2574 | 2570 |
2575 // Unoptimized code is missing and the deoptimizer will go ballistic. | 2571 // Unoptimized code is missing and the deoptimizer will go ballistic. |
2576 CompileRun("g('bozo');"); | 2572 CompileRun("g('bozo');"); |
2577 } | 2573 } |
OLD | NEW |