| 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 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 public: | 3525 public: |
| 3526 void VisitPointers(Object** start, Object** end) { } | 3526 void VisitPointers(Object** start, Object** end) { } |
| 3527 }; | 3527 }; |
| 3528 | 3528 |
| 3529 | 3529 |
| 3530 TEST(DeferredHandles) { | 3530 TEST(DeferredHandles) { |
| 3531 CcTest::InitializeVM(); | 3531 CcTest::InitializeVM(); |
| 3532 Isolate* isolate = CcTest::i_isolate(); | 3532 Isolate* isolate = CcTest::i_isolate(); |
| 3533 Heap* heap = isolate->heap(); | 3533 Heap* heap = isolate->heap(); |
| 3534 v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); | 3534 v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate)); |
| 3535 v8::ImplementationUtilities::HandleScopeData* data = | 3535 HandleScopeData* data = isolate->handle_scope_data(); |
| 3536 isolate->handle_scope_data(); | |
| 3537 Handle<Object> init(heap->empty_string(), isolate); | 3536 Handle<Object> init(heap->empty_string(), isolate); |
| 3538 while (data->next < data->limit) { | 3537 while (data->next < data->limit) { |
| 3539 Handle<Object> obj(heap->empty_string(), isolate); | 3538 Handle<Object> obj(heap->empty_string(), isolate); |
| 3540 } | 3539 } |
| 3541 // An entire block of handles has been filled. | 3540 // An entire block of handles has been filled. |
| 3542 // Next handle would require a new block. | 3541 // Next handle would require a new block. |
| 3543 ASSERT(data->next == data->limit); | 3542 ASSERT(data->next == data->limit); |
| 3544 | 3543 |
| 3545 DeferredHandleScope deferred(isolate); | 3544 DeferredHandleScope deferred(isolate); |
| 3546 DummyVisitor visitor; | 3545 DummyVisitor visitor; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3741 code = scope.CloseAndEscape(Handle<Code>(bar->code())); | 3740 code = scope.CloseAndEscape(Handle<Code>(bar->code())); |
| 3742 } | 3741 } |
| 3743 | 3742 |
| 3744 // Now make sure that a gc should get rid of the function | 3743 // Now make sure that a gc should get rid of the function |
| 3745 for (int i = 0; i < 4; i++) { | 3744 for (int i = 0; i < 4; i++) { |
| 3746 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3745 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3747 } | 3746 } |
| 3748 | 3747 |
| 3749 ASSERT(code->marked_for_deoptimization()); | 3748 ASSERT(code->marked_for_deoptimization()); |
| 3750 } | 3749 } |
| OLD | NEW |