| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 Object* object = *BitCast<T**>(location_); | 84 Object* object = *BitCast<T**>(location_); |
| 85 if (object->IsSmi()) return true; | 85 if (object->IsSmi()) return true; |
| 86 HeapObject* heap_object = HeapObject::cast(object); | 86 HeapObject* heap_object = HeapObject::cast(object); |
| 87 Isolate* isolate = heap_object->GetIsolate(); | 87 Isolate* isolate = heap_object->GetIsolate(); |
| 88 Object** handle = reinterpret_cast<Object**>(location_); | 88 Object** handle = reinterpret_cast<Object**>(location_); |
| 89 Object** roots_array_start = isolate->heap()->roots_array_start(); | 89 Object** roots_array_start = isolate->heap()->roots_array_start(); |
| 90 if (roots_array_start <= handle && | 90 if (roots_array_start <= handle && |
| 91 handle < roots_array_start + Heap::kStrongRootListLength) { | 91 handle < roots_array_start + Heap::kStrongRootListLength) { |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 if (isolate->optimizing_compiler_thread()->IsOptimizerThread() && |
| 95 !Heap::RelocationLock::IsLockedByOptimizerThread(isolate->heap())) { |
| 96 return false; |
| 97 } |
| 94 switch (isolate->HandleDereferenceGuardState()) { | 98 switch (isolate->HandleDereferenceGuardState()) { |
| 95 case HandleDereferenceGuard::ALLOW: | 99 case HandleDereferenceGuard::ALLOW: |
| 96 return true; | 100 return true; |
| 97 case HandleDereferenceGuard::DISALLOW: | 101 case HandleDereferenceGuard::DISALLOW: |
| 98 return false; | 102 return false; |
| 99 case HandleDereferenceGuard::DISALLOW_DEFERRED: | 103 case HandleDereferenceGuard::DISALLOW_DEFERRED: |
| 100 // Accessing maps and internalized strings is safe. | 104 // Accessing maps and internalized strings is safe. |
| 101 if (heap_object->IsMap()) return true; | 105 if (heap_object->IsMap()) return true; |
| 102 if (heap_object->IsInternalizedString()) return true; | 106 if (heap_object->IsInternalizedString()) return true; |
| 103 return allow_deferred || !isolate->IsDeferredHandle(handle); | 107 return allow_deferred || !isolate->IsDeferredHandle(handle); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 217 |
| 214 HandleDereferenceGuard::~HandleDereferenceGuard() { | 218 HandleDereferenceGuard::~HandleDereferenceGuard() { |
| 215 isolate_->SetHandleDereferenceGuardState(old_state_); | 219 isolate_->SetHandleDereferenceGuardState(old_state_); |
| 216 } | 220 } |
| 217 | 221 |
| 218 #endif | 222 #endif |
| 219 | 223 |
| 220 } } // namespace v8::internal | 224 } } // namespace v8::internal |
| 221 | 225 |
| 222 #endif // V8_HANDLES_INL_H_ | 226 #endif // V8_HANDLES_INL_H_ |
| OLD | NEW |