v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
prototype.h
Go to the documentation of this file.
1// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_OBJECTS_PROTOTYPE_H_
6#define V8_OBJECTS_PROTOTYPE_H_
7
10
11namespace v8 {
12namespace internal {
13
27 public:
29
31 WhereToStart where_to_start = kStartAtPrototype,
32 WhereToEnd where_to_end = END_AT_NULL);
33
35 WhereToStart where_to_start = kStartAtPrototype,
36 WhereToEnd where_to_end = END_AT_NULL);
37
38 inline explicit PrototypeIterator(Isolate* isolate, Tagged<Map> receiver_map,
39 WhereToEnd where_to_end = END_AT_NULL);
40
41 inline explicit PrototypeIterator(Isolate* isolate,
42 DirectHandle<Map> receiver_map,
43 WhereToEnd where_to_end = END_AT_NULL);
44
45 ~PrototypeIterator() = default;
48
49 inline bool HasAccess() const;
50
51 template <typename T = JSPrototype>
53 DCHECK(handle_.is_null());
54 return Cast<T>(object_);
55 }
56
57 template <typename T = JSPrototype>
59 DCHECK(!iterator.handle_.is_null());
61 return Cast<T>(iterator.handle_);
62 }
63
64 inline void Advance();
65
66 inline void AdvanceIgnoringProxies();
67
68 // Returns false iff a call to JSProxy::GetPrototype throws.
70
71 V8_WARN_UNUSED_RESULT inline bool
73
74 bool IsAtEnd() const { return is_at_end_; }
75 Isolate* isolate() const { return isolate_; }
76
77 private:
80 // TODO(372390038): This handle cannot be migrated to a direct one, because
81 // the PrototypeIterator is used as a field in DebugPropertyIterator, which
82 // can be heap allocated.
87};
88
89} // namespace internal
90
91} // namespace v8
92
93#endif // V8_OBJECTS_PROTOTYPE_H_
V8_WARN_UNUSED_RESULT bool AdvanceFollowingProxies()
PrototypeIterator & operator=(const PrototypeIterator &)=delete
Isolate * isolate() const
Definition prototype.h:75
IndirectHandle< JSPrototype > handle_
Definition prototype.h:83
Tagged< JSPrototype > object_
Definition prototype.h:79
Tagged< T > GetCurrent() const
Definition prototype.h:52
PrototypeIterator(Isolate *isolate, DirectHandle< JSReceiver > receiver, WhereToStart where_to_start=kStartAtPrototype, WhereToEnd where_to_end=END_AT_NULL)
V8_WARN_UNUSED_RESULT bool AdvanceFollowingProxiesIgnoringAccessChecks()
static DirectHandle< T > GetCurrent(const PrototypeIterator &iterator)
Definition prototype.h:58
PrototypeIterator(const PrototypeIterator &)=delete
TNode< Object > receiver
@ kStartAtPrototype
Definition globals.h:1714
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671