OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3201 } | 3201 } |
3202 | 3202 |
3203 // Heap::detached_contexts tracks detached contexts as pairs | 3203 // Heap::detached_contexts tracks detached contexts as pairs |
3204 // (number of GC since the context was detached, the context). | 3204 // (number of GC since the context was detached, the context). |
3205 void Isolate::AddDetachedContext(Handle<Context> context) { | 3205 void Isolate::AddDetachedContext(Handle<Context> context) { |
3206 HandleScope scope(this); | 3206 HandleScope scope(this); |
3207 Handle<WeakCell> cell = factory()->NewWeakCell(context); | 3207 Handle<WeakCell> cell = factory()->NewWeakCell(context); |
3208 Handle<FixedArray> detached_contexts = factory()->detached_contexts(); | 3208 Handle<FixedArray> detached_contexts = factory()->detached_contexts(); |
3209 int length = detached_contexts->length(); | 3209 int length = detached_contexts->length(); |
3210 detached_contexts = factory()->CopyFixedArrayAndGrow(detached_contexts, 2); | 3210 detached_contexts = factory()->CopyFixedArrayAndGrow(detached_contexts, 2); |
3211 detached_contexts->set(length, Smi::kZero); | 3211 detached_contexts->set(length, Smi::FromInt(0)); |
3212 detached_contexts->set(length + 1, *cell); | 3212 detached_contexts->set(length + 1, *cell); |
3213 heap()->set_detached_contexts(*detached_contexts); | 3213 heap()->set_detached_contexts(*detached_contexts); |
3214 } | 3214 } |
3215 | 3215 |
3216 | 3216 |
3217 void Isolate::CheckDetachedContextsAfterGC() { | 3217 void Isolate::CheckDetachedContextsAfterGC() { |
3218 HandleScope scope(this); | 3218 HandleScope scope(this); |
3219 Handle<FixedArray> detached_contexts = factory()->detached_contexts(); | 3219 Handle<FixedArray> detached_contexts = factory()->detached_contexts(); |
3220 int length = detached_contexts->length(); | 3220 int length = detached_contexts->length(); |
3221 if (length == 0) return; | 3221 if (length == 0) return; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 // Then check whether this scope intercepts. | 3315 // Then check whether this scope intercepts. |
3316 if ((flag & intercept_mask_)) { | 3316 if ((flag & intercept_mask_)) { |
3317 intercepted_flags_ |= flag; | 3317 intercepted_flags_ |= flag; |
3318 return true; | 3318 return true; |
3319 } | 3319 } |
3320 return false; | 3320 return false; |
3321 } | 3321 } |
3322 | 3322 |
3323 } // namespace internal | 3323 } // namespace internal |
3324 } // namespace v8 | 3324 } // namespace v8 |
OLD | NEW |