OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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/global-handles.h" | 5 #include "src/global-handles.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "src/vm-state-inl.h" | 9 #include "src/vm-state-inl.h" |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 bool IsRetainer() const { | 198 bool IsRetainer() const { |
199 return state() != FREE && | 199 return state() != FREE && |
200 !(state() == NEAR_DEATH && weakness_type() != NORMAL_WEAK && | 200 !(state() == NEAR_DEATH && weakness_type() != NORMAL_WEAK && |
201 weakness_type() != FINALIZER_WEAK); | 201 weakness_type() != FINALIZER_WEAK); |
202 } | 202 } |
203 | 203 |
204 bool IsStrongRetainer() const { return state() == NORMAL; } | 204 bool IsStrongRetainer() const { return state() == NORMAL; } |
205 | 205 |
206 bool IsWeakRetainer() const { | 206 bool IsWeakRetainer() const { |
207 return state() == WEAK || state() == PENDING || | 207 return state() == WEAK || state() == PENDING || |
208 (state() == NEAR_DEATH && weakness_type() == NORMAL_WEAK && | 208 (state() == NEAR_DEATH && (weakness_type() == NORMAL_WEAK || |
209 weakness_type() != FINALIZER_WEAK); | 209 weakness_type() == FINALIZER_WEAK)); |
210 } | 210 } |
211 | 211 |
212 void MarkPending() { | 212 void MarkPending() { |
213 DCHECK(state() == WEAK); | 213 DCHECK(state() == WEAK); |
214 set_state(PENDING); | 214 set_state(PENDING); |
215 } | 215 } |
216 | 216 |
217 // Independent flag accessors. | 217 // Independent flag accessors. |
218 void MarkIndependent() { | 218 void MarkIndependent() { |
219 DCHECK(IsInUse()); | 219 DCHECK(IsInUse()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 CHECK_NE(object_, reinterpret_cast<Object*>(kGlobalHandleZapValue)); | 270 CHECK_NE(object_, reinterpret_cast<Object*>(kGlobalHandleZapValue)); |
271 set_state(WEAK); | 271 set_state(WEAK); |
272 switch (type) { | 272 switch (type) { |
273 case v8::WeakCallbackType::kParameter: | 273 case v8::WeakCallbackType::kParameter: |
274 set_weakness_type(PHANTOM_WEAK); | 274 set_weakness_type(PHANTOM_WEAK); |
275 break; | 275 break; |
276 case v8::WeakCallbackType::kInternalFields: | 276 case v8::WeakCallbackType::kInternalFields: |
277 set_weakness_type(PHANTOM_WEAK_2_INTERNAL_FIELDS); | 277 set_weakness_type(PHANTOM_WEAK_2_INTERNAL_FIELDS); |
278 break; | 278 break; |
279 case v8::WeakCallbackType::kFinalizer: | 279 case v8::WeakCallbackType::kFinalizer: |
280 set_weakness_type(NORMAL_WEAK); | 280 set_weakness_type(FINALIZER_WEAK); |
281 break; | 281 break; |
282 } | 282 } |
283 set_parameter(parameter); | 283 set_parameter(parameter); |
284 weak_callback_ = reinterpret_cast<WeakCallback>(phantom_callback); | 284 weak_callback_ = reinterpret_cast<WeakCallback>(phantom_callback); |
285 } | 285 } |
286 | 286 |
287 void* ClearWeakness() { | 287 void* ClearWeakness() { |
288 DCHECK(IsInUse()); | 288 DCHECK(IsInUse()); |
289 void* p = parameter(); | 289 void* p = parameter(); |
290 set_state(NORMAL); | 290 set_state(NORMAL); |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 blocks_[block][offset] = object; | 1502 blocks_[block][offset] = object; |
1503 if (isolate->heap()->InNewSpace(object)) { | 1503 if (isolate->heap()->InNewSpace(object)) { |
1504 new_space_indices_.Add(size_); | 1504 new_space_indices_.Add(size_); |
1505 } | 1505 } |
1506 *index = size_++; | 1506 *index = size_++; |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 } // namespace internal | 1510 } // namespace internal |
1511 } // namespace v8 | 1511 } // namespace v8 |
OLD | NEW |