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

Side by Side Diff: src/handles.h

Issue 1458603012: [Interpreter] Add CreateClosure to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Take IV. Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_H_ 5 #ifndef V8_HANDLES_H_
6 #define V8_HANDLES_H_ 6 #define V8_HANDLES_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/base/functional.h" 9 #include "src/base/functional.h"
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 }; 69 };
70 70
71 71
72 // ---------------------------------------------------------------------------- 72 // ----------------------------------------------------------------------------
73 // A Handle provides a reference to an object that survives relocation by 73 // A Handle provides a reference to an object that survives relocation by
74 // the garbage collector. 74 // the garbage collector.
75 // 75 //
76 // Handles are only valid within a HandleScope. When a handle is created 76 // Handles are only valid within a HandleScope. When a handle is created
77 // for an object a cell is allocated in the current HandleScope. 77 // for an object a cell is allocated in the current HandleScope.
78 // 78 //
79 // Also note that Handles do not provide default equality comparison or hashing 79 // Also note that Handles do not provide default equality comparison or hashing
Michael Starzinger 2015/11/20 17:11:43 Please appreciate this comment and remove the equa
oth 2015/11/21 14:19:47 Yes! This wasn't intended to be part of the CL. I
80 // operators on purpose. Such operators would be misleading, because intended 80 // operators on purpose. Such operators would be misleading, because intended
81 // semantics is ambiguous between Handle location and object identity. Instead 81 // semantics is ambiguous between Handle location and object identity. Instead
82 // use either {is_identical_to} or {location} explicitly. 82 // use either {is_identical_to} or {location} explicitly.
83 template <typename T> 83 template <typename T>
84 class Handle final : public HandleBase { 84 class Handle final : public HandleBase {
85 public: 85 public:
86 V8_INLINE explicit Handle(T** location = nullptr) 86 V8_INLINE explicit Handle(T** location = nullptr)
87 : HandleBase(reinterpret_cast<Object**>(location)) { 87 : HandleBase(reinterpret_cast<Object**>(location)) {
88 Object* a = nullptr; 88 Object* a = nullptr;
89 T* b = nullptr; 89 T* b = nullptr;
(...skipping 17 matching lines...) Expand all
107 USE(a); 107 USE(a);
108 } 108 }
109 109
110 V8_INLINE T* operator->() const { return operator*(); } 110 V8_INLINE T* operator->() const { return operator*(); }
111 111
112 // Provides the C++ dereference operator. 112 // Provides the C++ dereference operator.
113 V8_INLINE T* operator*() const { 113 V8_INLINE T* operator*() const {
114 return reinterpret_cast<T*>(HandleBase::operator*()); 114 return reinterpret_cast<T*>(HandleBase::operator*());
115 } 115 }
116 116
117 V8_INLINE bool operator==(const Handle<T>& other) {
118 return is_identical_to(other);
119 }
120
117 // Returns the address to where the raw pointer is stored. 121 // Returns the address to where the raw pointer is stored.
118 V8_INLINE T** location() const { 122 V8_INLINE T** location() const {
119 return reinterpret_cast<T**>(HandleBase::location()); 123 return reinterpret_cast<T**>(HandleBase::location());
120 } 124 }
121 125
122 template <typename S> 126 template <typename S>
123 static const Handle<T> cast(Handle<S> that) { 127 static const Handle<T> cast(Handle<S> that) {
124 T::cast(*reinterpret_cast<T**>(that.location_)); 128 T::cast(*reinterpret_cast<T**>(that.location_));
125 return Handle<T>(reinterpret_cast<T**>(that.location_)); 129 return Handle<T>(reinterpret_cast<T**>(that.location_));
126 } 130 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 next = limit = NULL; 403 next = limit = NULL;
400 sealed_level = level = 0; 404 sealed_level = level = 0;
401 canonical_scope = NULL; 405 canonical_scope = NULL;
402 } 406 }
403 }; 407 };
404 408
405 } // namespace internal 409 } // namespace internal
406 } // namespace v8 410 } // namespace v8
407 411
408 #endif // V8_HANDLES_H_ 412 #endif // V8_HANDLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698