OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6268 "check(g1, g2);"); | 6268 "check(g1, g2);"); |
6269 | 6269 |
6270 CompileRun( | 6270 CompileRun( |
6271 "function f() { return (function() { return function g() {}; })(); }" | 6271 "function f() { return (function() { return function g() {}; })(); }" |
6272 "var g1 = f();" | 6272 "var g1 = f();" |
6273 "remove(f);" | 6273 "remove(f);" |
6274 "var g2 = f();" | 6274 "var g2 = f();" |
6275 "check(g1, g2);"); | 6275 "check(g1, g2);"); |
6276 } | 6276 } |
6277 | 6277 |
| 6278 TEST(RemoveCodeFromSharedFunctionInfoButNotFromClosure) { |
| 6279 CcTest::InitializeVM(); |
| 6280 v8::Isolate* isolate = CcTest::isolate(); |
| 6281 v8::HandleScope scope(isolate); |
| 6282 v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
| 6283 global->Set(isolate, "check", v8::FunctionTemplate::New( |
| 6284 isolate, CheckEqualSharedFunctionInfos)); |
| 6285 global->Set(isolate, "remove", |
| 6286 v8::FunctionTemplate::New(isolate, RemoveCodeAndGC)); |
| 6287 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 6288 v8::Context::Scope cscope(context); |
| 6289 CompileRun( |
| 6290 "function f() { return function g() {}; }" |
| 6291 "var g1 = f();" |
| 6292 "var g2 = f();" |
| 6293 "check(g1, g2);" |
| 6294 "g1();" |
| 6295 "g2();" |
| 6296 "remove(g1);" |
| 6297 "g2();" |
| 6298 "check(g1, g2);"); |
| 6299 } |
6278 | 6300 |
6279 TEST(OldGenerationAllocationThroughput) { | 6301 TEST(OldGenerationAllocationThroughput) { |
6280 CcTest::InitializeVM(); | 6302 CcTest::InitializeVM(); |
6281 v8::HandleScope scope(CcTest::isolate()); | 6303 v8::HandleScope scope(CcTest::isolate()); |
6282 Isolate* isolate = CcTest::i_isolate(); | 6304 Isolate* isolate = CcTest::i_isolate(); |
6283 Heap* heap = isolate->heap(); | 6305 Heap* heap = isolate->heap(); |
6284 GCTracer* tracer = heap->tracer(); | 6306 GCTracer* tracer = heap->tracer(); |
6285 int time1 = 100; | 6307 int time1 = 100; |
6286 size_t counter1 = 1000; | 6308 size_t counter1 = 1000; |
6287 tracer->SampleAllocation(time1, 0, counter1); | 6309 tracer->SampleAllocation(time1, 0, counter1); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6616 CHECK(heap->new_space()->ContainsSlow(first_page->address())); | 6638 CHECK(heap->new_space()->ContainsSlow(first_page->address())); |
6617 CHECK(!heap->old_space()->ContainsSlow(first_page->address())); | 6639 CHECK(!heap->old_space()->ContainsSlow(first_page->address())); |
6618 heap->CollectGarbage(OLD_SPACE); | 6640 heap->CollectGarbage(OLD_SPACE); |
6619 CHECK(!heap->new_space()->ContainsSlow(first_page->address())); | 6641 CHECK(!heap->new_space()->ContainsSlow(first_page->address())); |
6620 CHECK(heap->old_space()->ContainsSlow(first_page->address())); | 6642 CHECK(heap->old_space()->ContainsSlow(first_page->address())); |
6621 } | 6643 } |
6622 } | 6644 } |
6623 | 6645 |
6624 } // namespace internal | 6646 } // namespace internal |
6625 } // namespace v8 | 6647 } // namespace v8 |
OLD | NEW |