OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_OPERATOR_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ |
6 #define V8_COMPILER_COMMON_OPERATOR_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/unique.h" | |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 // Forward declarations. | 14 // Forward declarations. |
14 class ExternalReference; | 15 class ExternalReference; |
15 class OStream; | 16 class OStream; |
16 template <typename> | |
17 class Unique; | |
18 class Zone; | |
19 | 17 |
20 | 18 |
21 namespace compiler { | 19 namespace compiler { |
22 | 20 |
23 // Forward declarations. | 21 // Forward declarations. |
24 class CallDescriptor; | 22 class CallDescriptor; |
25 struct CommonOperatorBuilderImpl; | 23 struct CommonOperatorBuilderImpl; |
26 class Operator; | 24 class Operator; |
27 | 25 |
28 | 26 |
29 // Flag that describes how to combine the current environment with | 27 // Flag that describes how to combine the current environment with |
30 // the output of a node to obtain a framestate for lazy bailout. | 28 // the output of a node to obtain a framestate for lazy bailout. |
31 enum OutputFrameStateCombine { | 29 enum OutputFrameStateCombine { |
32 kPushOutput, // Push the output on the expression stack. | 30 kPushOutput, // Push the output on the expression stack. |
33 kIgnoreOutput // Use the frame state as-is. | 31 kIgnoreOutput // Use the frame state as-is. |
34 }; | 32 }; |
35 | 33 |
36 | 34 |
35 enum FrameStateType { JS_FRAME, ARGUMENTS_ADAPTOR }; | |
Michael Starzinger
2014/09/16 14:12:56
nit: This needs some comments I think. How about t
sigurds
2014/09/17 10:02:47
Done.
| |
36 | |
37 | |
37 class FrameStateCallInfo FINAL { | 38 class FrameStateCallInfo FINAL { |
38 public: | 39 public: |
39 FrameStateCallInfo(BailoutId bailout_id, | 40 FrameStateCallInfo(FrameStateType type, BailoutId bailout_id, |
40 OutputFrameStateCombine state_combine) | 41 OutputFrameStateCombine state_combine, |
41 : bailout_id_(bailout_id), frame_state_combine_(state_combine) {} | 42 Unique<JSFunction> jsfunction = Unique<JSFunction>()) |
43 : type_(type), | |
44 bailout_id_(bailout_id), | |
45 frame_state_combine_(state_combine), | |
46 jsfunction_(jsfunction) {} | |
42 | 47 |
48 FrameStateType type() const { return type_; } | |
43 BailoutId bailout_id() const { return bailout_id_; } | 49 BailoutId bailout_id() const { return bailout_id_; } |
44 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } | 50 OutputFrameStateCombine state_combine() const { return frame_state_combine_; } |
51 Unique<JSFunction> jsfunction() const { return jsfunction_; } | |
45 | 52 |
46 private: | 53 private: |
54 FrameStateType type_; | |
47 BailoutId bailout_id_; | 55 BailoutId bailout_id_; |
48 OutputFrameStateCombine frame_state_combine_; | 56 OutputFrameStateCombine frame_state_combine_; |
57 Unique<JSFunction> jsfunction_; | |
Michael Starzinger
2014/09/16 14:12:56
nit: IMHO we should just use Handle<JSFunction> in
sigurds
2014/09/17 10:02:47
Yes, absolutely correct. I propose leaving it as-i
| |
49 }; | 58 }; |
50 | 59 |
51 | 60 |
52 // Interface for building common operators that can be used at any level of IR, | 61 // Interface for building common operators that can be used at any level of IR, |
53 // including JavaScript, mid-level, and low-level. | 62 // including JavaScript, mid-level, and low-level. |
54 class CommonOperatorBuilder FINAL { | 63 class CommonOperatorBuilder FINAL { |
55 public: | 64 public: |
56 explicit CommonOperatorBuilder(Zone* zone); | 65 explicit CommonOperatorBuilder(Zone* zone); |
57 | 66 |
58 const Operator* Dead(); | 67 const Operator* Dead(); |
(...skipping 15 matching lines...) Expand all Loading... | |
74 const Operator* ExternalConstant(const ExternalReference&); | 83 const Operator* ExternalConstant(const ExternalReference&); |
75 const Operator* NumberConstant(volatile double); | 84 const Operator* NumberConstant(volatile double); |
76 const Operator* HeapConstant(const Unique<Object>&); | 85 const Operator* HeapConstant(const Unique<Object>&); |
77 | 86 |
78 const Operator* Phi(MachineType type, int arguments); | 87 const Operator* Phi(MachineType type, int arguments); |
79 const Operator* EffectPhi(int arguments); | 88 const Operator* EffectPhi(int arguments); |
80 const Operator* ControlEffect(); | 89 const Operator* ControlEffect(); |
81 const Operator* ValueEffect(int arguments); | 90 const Operator* ValueEffect(int arguments); |
82 const Operator* Finish(int arguments); | 91 const Operator* Finish(int arguments); |
83 const Operator* StateValues(int arguments); | 92 const Operator* StateValues(int arguments); |
84 const Operator* FrameState(BailoutId bailout_id, | 93 const Operator* FrameState( |
85 OutputFrameStateCombine combine); | 94 FrameStateType type, BailoutId bailout_id, |
95 OutputFrameStateCombine state_combine, | |
96 Unique<JSFunction> jsfunction = Unique<JSFunction>()); | |
86 const Operator* Call(const CallDescriptor* descriptor); | 97 const Operator* Call(const CallDescriptor* descriptor); |
87 const Operator* Projection(size_t index); | 98 const Operator* Projection(size_t index); |
88 | 99 |
89 private: | 100 private: |
90 Zone* zone() const { return zone_; } | 101 Zone* zone() const { return zone_; } |
91 | 102 |
92 const CommonOperatorBuilderImpl& impl_; | 103 const CommonOperatorBuilderImpl& impl_; |
93 Zone* const zone_; | 104 Zone* const zone_; |
94 }; | 105 }; |
95 | 106 |
96 } // namespace compiler | 107 } // namespace compiler |
97 } // namespace internal | 108 } // namespace internal |
98 } // namespace v8 | 109 } // namespace v8 |
99 | 110 |
100 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 111 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |