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 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 InitializeVM(); | 2429 InitializeVM(); |
2430 v8::HandleScope scope; | 2430 v8::HandleScope scope; |
2431 SourceResource* resource = new SourceResource(i::StrDup(source)); | 2431 SourceResource* resource = new SourceResource(i::StrDup(source)); |
2432 { | 2432 { |
2433 v8::HandleScope scope; | 2433 v8::HandleScope scope; |
2434 v8::Handle<v8::String> source_string = v8::String::NewExternal(resource); | 2434 v8::Handle<v8::String> source_string = v8::String::NewExternal(resource); |
2435 v8::Script::Compile(source_string)->Run(); | 2435 v8::Script::Compile(source_string)->Run(); |
2436 CHECK(!resource->IsDisposed()); | 2436 CHECK(!resource->IsDisposed()); |
2437 } | 2437 } |
2438 HEAP->CollectAllAvailableGarbage(); | 2438 HEAP->CollectAllAvailableGarbage(); |
2439 // External source is being retained by the stack trace. | |
2440 CHECK(!resource->IsDisposed()); | |
2441 | 2439 |
2442 CompileRun("error.stack;"); | |
2443 HEAP->CollectAllAvailableGarbage(); | |
2444 // External source has been released. | 2440 // External source has been released. |
2445 CHECK(resource->IsDisposed()); | 2441 CHECK(resource->IsDisposed()); |
2446 delete resource; | 2442 delete resource; |
2447 } | 2443 } |
2448 | 2444 |
2449 | 2445 |
2450 TEST(ReleaseStackTraceData) { | 2446 TEST(ReleaseStackTraceData) { |
2451 static const char* source1 = "var error = null; " | 2447 static const char* source1 = "var error = null; " |
2452 /* Normal Error */ "try { " | 2448 /* Normal Error */ "try { " |
2453 " throw new Error(); " | 2449 " throw new Error(); " |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 #ifdef DEBUG | 2687 #ifdef DEBUG |
2692 FLAG_stop_at = "f"; | 2688 FLAG_stop_at = "f"; |
2693 #endif | 2689 #endif |
2694 CompileRun("%OptimizeFunctionOnNextCall(g);" | 2690 CompileRun("%OptimizeFunctionOnNextCall(g);" |
2695 "g(false);"); | 2691 "g(false);"); |
2696 | 2692 |
2697 // Finish garbage collection cycle. | 2693 // Finish garbage collection cycle. |
2698 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 2694 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
2699 CHECK(shared1->code()->gc_metadata() == NULL); | 2695 CHECK(shared1->code()->gc_metadata() == NULL); |
2700 } | 2696 } |
OLD | NEW |