Line data Source code
1 : // Copyright 2018 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_DEBUG_DEBUG_PROPERTY_ITERATOR_H_
6 : #define V8_DEBUG_DEBUG_PROPERTY_ITERATOR_H_
7 :
8 : #include "src/debug/debug-interface.h"
9 : #include "src/handles.h"
10 : #include "src/isolate.h"
11 : #include "src/prototype.h"
12 :
13 : #include "include/v8.h"
14 :
15 : namespace v8 {
16 : namespace internal {
17 :
18 : class JSReceiver;
19 :
20 : class DebugPropertyIterator final : public debug::PropertyIterator {
21 : public:
22 : DebugPropertyIterator(Isolate* isolate, Handle<JSReceiver> receiver);
23 158536 : ~DebugPropertyIterator() override = default;
24 :
25 : bool Done() const override;
26 : void Advance() override;
27 :
28 : v8::Local<v8::Name> name() const override;
29 : bool is_native_accessor() override;
30 : bool has_native_getter() override;
31 : bool has_native_setter() override;
32 : v8::Maybe<v8::PropertyAttribute> attributes() override;
33 : v8::Maybe<v8::debug::PropertyDescriptor> descriptor() override;
34 :
35 : bool is_own() override;
36 : bool is_array_index() override;
37 :
38 : private:
39 : void FillKeysForCurrentPrototypeAndStage();
40 : bool should_move_to_next_stage() const;
41 : void CalculateNativeAccessorFlags();
42 : Handle<Name> raw_name() const;
43 :
44 : Isolate* isolate_;
45 : PrototypeIterator prototype_iterator_;
46 : enum Stage { kExoticIndices = 0, kEnumerableStrings = 1, kAllProperties = 2 };
47 : Stage stage_ = kExoticIndices;
48 :
49 : uint32_t current_key_index_ = 0;
50 : Handle<FixedArray> keys_;
51 : uint32_t exotic_length_ = 0;
52 :
53 : bool calculated_native_accessor_flags_ = false;
54 : int native_accessor_flags_ = 0;
55 : bool is_own_ = true;
56 :
57 : DISALLOW_COPY_AND_ASSIGN(DebugPropertyIterator);
58 : };
59 : } // namespace internal
60 : } // namespace v8
61 :
62 : #endif // V8_DEBUG_DEBUG_PROPERTY_ITERATOR_H_
|