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

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

Issue 259173003: Kiss goodbye to MaybeObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed comments Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « src/gdb-jit.cc ('k') | src/heap.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 "api.h" 9 #include "api.h"
10 #include "handles.h" 10 #include "handles.h"
11 #include "heap.h" 11 #include "heap.h"
12 #include "isolate.h" 12 #include "isolate.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 template<typename T> 17 template<typename T>
18 Handle<T>::Handle(T* obj) { 18 Handle<T>::Handle(T* obj) {
19 ASSERT(!obj->IsFailure());
20 location_ = HandleScope::CreateHandle(obj->GetIsolate(), obj); 19 location_ = HandleScope::CreateHandle(obj->GetIsolate(), obj);
21 } 20 }
22 21
23 22
24 template<typename T> 23 template<typename T>
25 Handle<T>::Handle(T* obj, Isolate* isolate) { 24 Handle<T>::Handle(T* obj, Isolate* isolate) {
26 ASSERT(!obj->IsFailure());
27 location_ = HandleScope::CreateHandle(isolate, obj); 25 location_ = HandleScope::CreateHandle(isolate, obj);
28 } 26 }
29 27
30 28
31 template <typename T> 29 template <typename T>
32 inline bool Handle<T>::is_identical_to(const Handle<T> o) const { 30 inline bool Handle<T>::is_identical_to(const Handle<T> o) const {
33 ASSERT(location_ == NULL || !(*location_)->IsFailure());
34 // Dereferencing deferred handles to check object equality is safe. 31 // Dereferencing deferred handles to check object equality is safe.
35 SLOW_ASSERT( 32 SLOW_ASSERT(
36 (location_ == NULL || IsDereferenceAllowed(NO_DEFERRED_CHECK)) && 33 (location_ == NULL || IsDereferenceAllowed(NO_DEFERRED_CHECK)) &&
37 (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK))); 34 (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK)));
38 if (location_ == o.location_) return true; 35 if (location_ == o.location_) return true;
39 if (location_ == NULL || o.location_ == NULL) return false; 36 if (location_ == NULL || o.location_ == NULL) return false;
40 return *location_ == *o.location_; 37 return *location_ == *o.location_;
41 } 38 }
42 39
43 40
44 template <typename T> 41 template <typename T>
45 inline T* Handle<T>::operator*() const { 42 inline T* Handle<T>::operator*() const {
46 ASSERT(location_ != NULL && !(*location_)->IsFailure());
47 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); 43 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK));
48 return *BitCast<T**>(location_); 44 return *BitCast<T**>(location_);
49 } 45 }
50 46
51 template <typename T> 47 template <typename T>
52 inline T** Handle<T>::location() const { 48 inline T** Handle<T>::location() const {
53 ASSERT(location_ == NULL || !(*location_)->IsFailure());
54 SLOW_ASSERT(location_ == NULL || 49 SLOW_ASSERT(location_ == NULL ||
55 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); 50 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK));
56 return location_; 51 return location_;
57 } 52 }
58 53
59 #ifdef DEBUG 54 #ifdef DEBUG
60 template <typename T> 55 template <typename T>
61 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const { 56 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const {
62 ASSERT(location_ != NULL); 57 ASSERT(location_ != NULL);
63 Object* object = *BitCast<T**>(location_); 58 Object* object = *BitCast<T**>(location_);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 current->level = level_; 174 current->level = level_;
180 ASSERT_EQ(current->next, current->limit); 175 ASSERT_EQ(current->next, current->limit);
181 current->limit = limit_; 176 current->limit = limit_;
182 } 177 }
183 178
184 #endif 179 #endif
185 180
186 } } // namespace v8::internal 181 } } // namespace v8::internal
187 182
188 #endif // V8_HANDLES_INL_H_ 183 #endif // V8_HANDLES_INL_H_
OLDNEW
« no previous file with comments | « src/gdb-jit.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698