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 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 // explicitly enqueued. | 3008 // explicitly enqueued. |
3009 SimulateIncrementalMarking(); | 3009 SimulateIncrementalMarking(); |
3010 | 3010 |
3011 // Now enable the debugger which in turn will disable code flushing. | 3011 // Now enable the debugger which in turn will disable code flushing. |
3012 CHECK(isolate->debug()->Load()); | 3012 CHECK(isolate->debug()->Load()); |
3013 | 3013 |
3014 // This cycle will bust the heap and subsequent cycles will go ballistic. | 3014 // This cycle will bust the heap and subsequent cycles will go ballistic. |
3015 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3015 heap->CollectAllGarbage(Heap::kNoGCFlags); |
3016 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3016 heap->CollectAllGarbage(Heap::kNoGCFlags); |
3017 } | 3017 } |
| 3018 |
| 3019 |
| 3020 class DummyVisitor : public ObjectVisitor { |
| 3021 public: |
| 3022 void VisitPointers(Object** start, Object** end) { } |
| 3023 }; |
| 3024 |
| 3025 |
| 3026 TEST(DeferredHandles) { |
| 3027 InitializeVM(); |
| 3028 Isolate* isolate = Isolate::Current(); |
| 3029 Heap* heap = isolate->heap(); |
| 3030 v8::HandleScope scope; |
| 3031 v8::ImplementationUtilities::HandleScopeData* data = |
| 3032 isolate->handle_scope_data(); |
| 3033 Handle<Object> init(heap->empty_string(), isolate); |
| 3034 while (data->next < data->limit) { |
| 3035 Handle<Object> obj(heap->empty_string(), isolate); |
| 3036 } |
| 3037 // An entire block of handles has been filled. |
| 3038 // Next handle would require a new block. |
| 3039 ASSERT(data->next == data->limit); |
| 3040 |
| 3041 DeferredHandleScope deferred(isolate); |
| 3042 DummyVisitor visitor; |
| 3043 isolate->handle_scope_implementer()->Iterate(&visitor); |
| 3044 deferred.Detach(); |
| 3045 } |
OLD | NEW |