Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/handles-inl.h

Issue 769263002: Add support for enabling DCHECKs in release mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/handles.cc ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 #ifndef V8_HANDLES_INL_H_ 6 #ifndef V8_HANDLES_INL_H_
7 #define V8_HANDLES_INL_H_ 7 #define V8_HANDLES_INL_H_
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return *bit_cast<T**>(location_); 44 return *bit_cast<T**>(location_);
45 } 45 }
46 46
47 template <typename T> 47 template <typename T>
48 inline T** Handle<T>::location() const { 48 inline T** Handle<T>::location() const {
49 SLOW_DCHECK(location_ == NULL || 49 SLOW_DCHECK(location_ == NULL ||
50 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); 50 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK));
51 return location_; 51 return location_;
52 } 52 }
53 53
54 #ifdef DEBUG 54 #ifdef ENABLE_SLOW_DCHECKS
55 template <typename T> 55 template <typename T>
56 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const { 56 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const {
57 DCHECK(location_ != NULL); 57 DCHECK(location_ != NULL);
58 Object* object = *bit_cast<T**>(location_); 58 Object* object = *bit_cast<T**>(location_);
59 if (object->IsSmi()) return true; 59 if (object->IsSmi()) return true;
60 HeapObject* heap_object = HeapObject::cast(object); 60 HeapObject* heap_object = HeapObject::cast(object);
61 Heap* heap = heap_object->GetHeap(); 61 Heap* heap = heap_object->GetHeap();
62 Object** handle = reinterpret_cast<Object**>(location_); 62 Object** handle = reinterpret_cast<Object**>(location_);
63 Object** roots_array_start = heap->roots_array_start(); 63 Object** roots_array_start = heap->roots_array_start();
64 if (roots_array_start <= handle && 64 if (roots_array_start <= handle &&
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 current->level = level_; 174 current->level = level_;
175 DCHECK_EQ(current->next, current->limit); 175 DCHECK_EQ(current->next, current->limit);
176 current->limit = limit_; 176 current->limit = limit_;
177 } 177 }
178 178
179 #endif 179 #endif
180 180
181 } } // namespace v8::internal 181 } } // namespace v8::internal
182 182
183 #endif // V8_HANDLES_INL_H_ 183 #endif // V8_HANDLES_INL_H_
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698