| 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 // 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 #ifndef V8_HANDLES_INL_H_ | 5 #ifndef V8_HANDLES_INL_H_ | 
| 6 #define V8_HANDLES_INL_H_ | 6 #define V8_HANDLES_INL_H_ | 
| 7 | 7 | 
| 8 #include "src/api.h" | 8 #include "src/api.h" | 
| 9 #include "src/handles.h" | 9 #include "src/handles.h" | 
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" | 
| 11 #include "src/isolate.h" | 11 #include "src/isolate.h" | 
| 12 | 12 | 
| 13 namespace v8 { | 13 namespace v8 { | 
| 14 namespace internal { | 14 namespace internal { | 
| 15 | 15 | 
| 16 HandleBase::HandleBase(Object* object, Isolate* isolate) | 16 HandleBase::HandleBase(Object* object, Isolate* isolate) | 
| 17     : location_(HandleScope::CreateHandle(isolate, object)) {} | 17     : location_(HandleScope::CreateHandle(isolate, object)) {} | 
| 18 | 18 | 
| 19 | 19 | 
| 20 HandleScope::HandleScope(Isolate* isolate) { | 20 HandleScope::HandleScope(Isolate* isolate) { | 
| 21   HandleScopeData* current = isolate->handle_scope_data(); | 21   HandleScopeData* current = isolate->handle_scope_data(); | 
| 22   isolate_ = isolate; | 22   isolate_ = isolate; | 
| 23   prev_next_ = current->next; | 23   prev_next_ = current->next; | 
| 24   prev_limit_ = current->limit; | 24   prev_limit_ = current->limit; | 
| 25   current->level++; | 25   current->level++; | 
| 26 } | 26 } | 
| 27 | 27 | 
| 28 | 28 | 
|  | 29 template <typename T> | 
|  | 30 inline std::ostream& operator<<(std::ostream& os, Handle<T> handle) { | 
|  | 31   return os << Brief(*handle); | 
|  | 32 } | 
|  | 33 | 
|  | 34 | 
| 29 HandleScope::~HandleScope() { | 35 HandleScope::~HandleScope() { | 
| 30 #ifdef DEBUG | 36 #ifdef DEBUG | 
| 31   if (FLAG_check_handle_count) { | 37   if (FLAG_check_handle_count) { | 
| 32     int before = NumberOfHandles(isolate_); | 38     int before = NumberOfHandles(isolate_); | 
| 33     CloseScope(isolate_, prev_next_, prev_limit_); | 39     CloseScope(isolate_, prev_next_, prev_limit_); | 
| 34     int after = NumberOfHandles(isolate_); | 40     int after = NumberOfHandles(isolate_); | 
| 35     DCHECK(after - before < kCheckHandleThreshold); | 41     DCHECK(after - before < kCheckHandleThreshold); | 
| 36     DCHECK(before < kCheckHandleThreshold); | 42     DCHECK(before < kCheckHandleThreshold); | 
| 37   } else { | 43   } else { | 
| 38 #endif  // DEBUG | 44 #endif  // DEBUG | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 122   DCHECK_EQ(current->next, current->limit); | 128   DCHECK_EQ(current->next, current->limit); | 
| 123   current->limit = limit_; | 129   current->limit = limit_; | 
| 124 } | 130 } | 
| 125 | 131 | 
| 126 #endif | 132 #endif | 
| 127 | 133 | 
| 128 }  // namespace internal | 134 }  // namespace internal | 
| 129 }  // namespace v8 | 135 }  // namespace v8 | 
| 130 | 136 | 
| 131 #endif  // V8_HANDLES_INL_H_ | 137 #endif  // V8_HANDLES_INL_H_ | 
| OLD | NEW | 
|---|