| 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()); |
| 2439 | 2441 |
| 2442 CompileRun("error.stack;"); |
| 2443 HEAP->CollectAllAvailableGarbage(); |
| 2440 // External source has been released. | 2444 // External source has been released. |
| 2441 CHECK(resource->IsDisposed()); | 2445 CHECK(resource->IsDisposed()); |
| 2442 delete resource; | 2446 delete resource; |
| 2443 } | 2447 } |
| 2444 | 2448 |
| 2445 | 2449 |
| 2446 TEST(ReleaseStackTraceData) { | 2450 TEST(ReleaseStackTraceData) { |
| 2447 static const char* source1 = "var error = null; " | 2451 static const char* source1 = "var error = null; " |
| 2448 /* Normal Error */ "try { " | 2452 /* Normal Error */ "try { " |
| 2449 " throw new Error(); " | 2453 " throw new Error(); " |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 #ifdef DEBUG | 2691 #ifdef DEBUG |
| 2688 FLAG_stop_at = "f"; | 2692 FLAG_stop_at = "f"; |
| 2689 #endif | 2693 #endif |
| 2690 CompileRun("%OptimizeFunctionOnNextCall(g);" | 2694 CompileRun("%OptimizeFunctionOnNextCall(g);" |
| 2691 "g(false);"); | 2695 "g(false);"); |
| 2692 | 2696 |
| 2693 // Finish garbage collection cycle. | 2697 // Finish garbage collection cycle. |
| 2694 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 2698 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 2695 CHECK(shared1->code()->gc_metadata() == NULL); | 2699 CHECK(shared1->code()->gc_metadata() == NULL); |
| 2696 } | 2700 } |
| OLD | NEW |