OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 STATIC_ASSERT(static_cast<int>(NodeState::kMask) == | 65 STATIC_ASSERT(static_cast<int>(NodeState::kMask) == |
66 Internals::kNodeStateMask); | 66 Internals::kNodeStateMask); |
67 STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue); | 67 STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue); |
68 STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue); | 68 STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue); |
69 STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) == | 69 STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) == |
70 Internals::kNodeIsIndependentShift); | 70 Internals::kNodeIsIndependentShift); |
71 STATIC_ASSERT(static_cast<int>(IsPartiallyDependent::kShift) == | 71 STATIC_ASSERT(static_cast<int>(IsPartiallyDependent::kShift) == |
72 Internals::kNodeIsPartiallyDependentShift); | 72 Internals::kNodeIsPartiallyDependentShift); |
73 } | 73 } |
74 | 74 |
75 #ifdef DEBUG | 75 #ifdef ENABLE_EXTRA_CHECKS |
76 ~Node() { | 76 ~Node() { |
77 // TODO(1428): if it's a weak handle we should have invoked its callback. | 77 // TODO(1428): if it's a weak handle we should have invoked its callback. |
78 // Zap the values for eager trapping. | 78 // Zap the values for eager trapping. |
79 object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); | 79 object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); |
80 class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; | 80 class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; |
81 index_ = 0; | 81 index_ = 0; |
82 set_independent(false); | 82 set_independent(false); |
83 set_partially_dependent(false); | 83 set_partially_dependent(false); |
84 set_in_new_space_list(false); | 84 set_in_new_space_list(false); |
85 parameter_or_next_free_.next_free = NULL; | 85 parameter_or_next_free_.next_free = NULL; |
(...skipping 18 matching lines...) Expand all Loading... |
104 set_partially_dependent(false); | 104 set_partially_dependent(false); |
105 set_state(NORMAL); | 105 set_state(NORMAL); |
106 parameter_or_next_free_.parameter = NULL; | 106 parameter_or_next_free_.parameter = NULL; |
107 near_death_callback_ = NULL; | 107 near_death_callback_ = NULL; |
108 IncreaseBlockUses(global_handles); | 108 IncreaseBlockUses(global_handles); |
109 } | 109 } |
110 | 110 |
111 void Release(GlobalHandles* global_handles) { | 111 void Release(GlobalHandles* global_handles) { |
112 ASSERT(state() != FREE); | 112 ASSERT(state() != FREE); |
113 set_state(FREE); | 113 set_state(FREE); |
114 // TODO(mstarzinger): Put behind debug flag once embedders are stabilized. | 114 #ifdef ENABLE_EXTRA_CHECKS |
| 115 // Zap the values for eager trapping. |
115 object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); | 116 object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); |
116 #ifdef DEBUG | |
117 // Zap the values for eager trapping. | |
118 class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; | 117 class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; |
119 set_independent(false); | 118 set_independent(false); |
120 set_partially_dependent(false); | 119 set_partially_dependent(false); |
121 near_death_callback_ = NULL; | 120 near_death_callback_ = NULL; |
122 #endif | 121 #endif |
123 parameter_or_next_free_.next_free = global_handles->first_free_; | 122 parameter_or_next_free_.next_free = global_handles->first_free_; |
124 global_handles->first_free_ = this; | 123 global_handles->first_free_ = this; |
125 DecreaseBlockUses(global_handles); | 124 DecreaseBlockUses(global_handles); |
126 } | 125 } |
127 | 126 |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 implicit_ref_groups_.Clear(); | 857 implicit_ref_groups_.Clear(); |
859 } | 858 } |
860 | 859 |
861 | 860 |
862 void GlobalHandles::TearDown() { | 861 void GlobalHandles::TearDown() { |
863 // TODO(1428): invoke weak callbacks. | 862 // TODO(1428): invoke weak callbacks. |
864 } | 863 } |
865 | 864 |
866 | 865 |
867 } } // namespace v8::internal | 866 } } // namespace v8::internal |
OLD | NEW |