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

Side by Side Diff: src/fast-accessor-assembler.h

Issue 1674633002: Move FastAccessorAssembler from RawMachineAssembler to CodeStubAssembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address (most) feedback. Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ 5 #ifndef V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_
6 #define V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ 6 #define V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 // Clients of this interface shouldn't depend on lots of compiler internals. 11 // Clients of this interface shouldn't depend on lots of compiler internals.
12 // Do not include anything from src/compiler here! 12 // Do not include anything from src/compiler here!
13 #include "include/v8-experimental.h" 13 #include "include/v8-experimental.h"
14 #include "src/base/macros.h" 14 #include "src/base/macros.h"
15 #include "src/base/smart-pointers.h" 15 #include "src/base/smart-pointers.h"
16 #include "src/handles.h" 16 #include "src/handles.h"
17 17
18 // For CodeStubAssembler::Label. (We cannot forward-declare inner classes.)
19 #include "src/compiler/code-stub-assembler.h"
18 20
19 namespace v8 { 21 namespace v8 {
20 namespace internal { 22 namespace internal {
21 23
22 class Code; 24 class Code;
23 class Isolate; 25 class Isolate;
24 class Zone; 26 class Zone;
25 27
26 namespace compiler { 28 namespace compiler {
27 29
28 class Node; 30 class Node;
29 class RawMachineAssembler; 31 class RawMachineAssembler;
30 class RawMachineLabel; 32 class RawMachineLabel;
31 33
32
33 // This interface "exports" an aggregated subset of RawMachineAssembler, for 34 // This interface "exports" an aggregated subset of RawMachineAssembler, for
34 // use by the API to implement Fast Dom Accessors. 35 // use by the API to implement Fast Dom Accessors.
35 // 36 //
36 // This interface is made for this single purpose only and does not attempt 37 // This interface is made for this single purpose only and does not attempt
37 // to implement a general purpose solution. If you need one, please look at 38 // to implement a general purpose solution. If you need one, please look at
38 // RawMachineAssembler instead. 39 // RawMachineAssembler instead.
39 // 40 //
40 // The life cycle of a FastAccessorAssembler has two phases: 41 // The life cycle of a FastAccessorAssembler has two phases:
41 // - After creating the instance, you can call an arbitrary sequence of 42 // - After creating the instance, you can call an arbitrary sequence of
42 // builder functions to build the desired function. 43 // builder functions to build the desired function.
(...skipping 26 matching lines...) Expand all
69 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); 70 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id);
70 71
71 // C++ callback. 72 // C++ callback.
72 ValueId Call(FunctionCallback callback, ValueId arg); 73 ValueId Call(FunctionCallback callback, ValueId arg);
73 74
74 // Assemble the code. 75 // Assemble the code.
75 MaybeHandle<Code> Build(); 76 MaybeHandle<Code> Build();
76 77
77 private: 78 private:
78 ValueId FromRaw(Node* node); 79 ValueId FromRaw(Node* node);
79 LabelId FromRaw(RawMachineLabel* label); 80 LabelId FromRaw(CodeStubAssembler::Label* label);
80 Node* FromId(ValueId value) const; 81 Node* FromId(ValueId value) const;
81 RawMachineLabel* FromId(LabelId value) const; 82 CodeStubAssembler::Label* FromId(LabelId value) const;
82 83
84 void Clear();
83 Zone* zone() { return &zone_; } 85 Zone* zone() { return &zone_; }
86 Isolate* isolate() const { return isolate_; }
84 87
85 Zone zone_; 88 Zone zone_;
86 base::SmartPointer<RawMachineAssembler> assembler_; 89 Isolate* isolate_;
90 base::SmartPointer<CodeStubAssembler> assembler_;
87 91
88 // To prevent exposing the RMA internals to the outside world, we'll map 92 // To prevent exposing the RMA internals to the outside world, we'll map
89 // Node + Label pointers integers wrapped in ValueId and LabelId instances. 93 // Node + Label pointers integers wrapped in ValueId and LabelId instances.
90 // These vectors maintain this mapping. 94 // These vectors maintain this mapping.
91 std::vector<Node*> nodes_; 95 std::vector<Node*> nodes_;
92 std::vector<RawMachineLabel*> labels_; 96 std::vector<CodeStubAssembler::Label*> labels_;
93 97
94 // Remember the current state for easy error checking. (We prefer to be 98 // Remember the current state for easy error checking. (We prefer to be
95 // strict as this class will be exposed at the API.) 99 // strict as this class will be exposed at the API.)
96 enum { kBuilding, kBuilt, kError } state_; 100 enum { kBuilding, kBuilt, kError } state_;
97 101
98 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler); 102 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler);
99 }; 103 };
100 104
101 } // namespace compiler 105 } // namespace compiler
102 } // namespace internal 106 } // namespace internal
103 } // namespace v8 107 } // namespace v8
104 108
105 #endif // V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ 109 #endif // V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698