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_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/unique.h" | 10 #include "src/unique.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 bool immutable() const { return immutable_; } | 29 bool immutable() const { return immutable_; } |
30 | 30 |
31 private: | 31 private: |
32 // For space reasons, we keep this tightly packed, otherwise we could just use | 32 // For space reasons, we keep this tightly packed, otherwise we could just use |
33 // a simple int/int/bool POD. | 33 // a simple int/int/bool POD. |
34 const bool immutable_; | 34 const bool immutable_; |
35 const uint16_t depth_; | 35 const uint16_t depth_; |
36 const uint32_t index_; | 36 const uint32_t index_; |
37 }; | 37 }; |
38 | 38 |
| 39 // Defines the property being loaded from an object by a named load. This is |
| 40 // used as a parameter by JSLoadNamed operators. |
| 41 struct LoadNamedParameters { |
| 42 PrintableUnique<Name> name; |
| 43 ContextualMode contextual_mode; |
| 44 }; |
| 45 |
39 // Defines the arity and the call flags for a JavaScript function call. This is | 46 // Defines the arity and the call flags for a JavaScript function call. This is |
40 // used as a parameter by JSCall operators. | 47 // used as a parameter by JSCall operators. |
41 struct CallParameters { | 48 struct CallParameters { |
42 int arity; | 49 int arity; |
43 CallFunctionFlags flags; | 50 CallFunctionFlags flags; |
44 }; | 51 }; |
45 | 52 |
46 // Interface for building JavaScript-level operators, e.g. directly from the | 53 // Interface for building JavaScript-level operators, e.g. directly from the |
47 // AST. Most operators have no parameters, thus can be globally shared for all | 54 // AST. Most operators have no parameters, thus can be globally shared for all |
48 // graphs. | 55 // graphs. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 arguments, 1); | 109 arguments, 1); |
103 } | 110 } |
104 | 111 |
105 Operator* CallNew(int arguments) { | 112 Operator* CallNew(int arguments) { |
106 return new (zone_) | 113 return new (zone_) |
107 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties, | 114 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties, |
108 arguments, 1, "JSCallConstruct", arguments); | 115 arguments, 1, "JSCallConstruct", arguments); |
109 } | 116 } |
110 | 117 |
111 Operator* LoadProperty() { BINOP(JSLoadProperty); } | 118 Operator* LoadProperty() { BINOP(JSLoadProperty); } |
112 Operator* LoadNamed(PrintableUnique<Name> name) { | 119 Operator* LoadNamed(PrintableUnique<Name> name, |
113 OP1(JSLoadNamed, PrintableUnique<Name>, name, Operator::kNoProperties, 1, | 120 ContextualMode contextual_mode = NOT_CONTEXTUAL) { |
114 1); | 121 LoadNamedParameters parameters = {name, contextual_mode}; |
| 122 OP1(JSLoadNamed, LoadNamedParameters, parameters, Operator::kNoProperties, |
| 123 1, 1); |
115 } | 124 } |
116 | 125 |
117 Operator* StoreProperty() { NOPROPS(JSStoreProperty, 3, 0); } | 126 Operator* StoreProperty() { NOPROPS(JSStoreProperty, 3, 0); } |
118 Operator* StoreNamed(PrintableUnique<Name> name) { | 127 Operator* StoreNamed(PrintableUnique<Name> name) { |
119 OP1(JSStoreNamed, PrintableUnique<Name>, name, Operator::kNoProperties, 2, | 128 OP1(JSStoreNamed, PrintableUnique<Name>, name, Operator::kNoProperties, 2, |
120 0); | 129 0); |
121 } | 130 } |
122 | 131 |
123 Operator* DeleteProperty(StrictMode strict_mode) { | 132 Operator* DeleteProperty(StrictMode strict_mode) { |
124 OP1(JSDeleteProperty, StrictMode, strict_mode, Operator::kNoProperties, 2, | 133 OP1(JSDeleteProperty, StrictMode, strict_mode, Operator::kNoProperties, 2, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 static int HashCode(Runtime::FunctionId val) { return static_cast<int>(val); } | 204 static int HashCode(Runtime::FunctionId val) { return static_cast<int>(val); } |
196 static bool Equals(Runtime::FunctionId a, Runtime::FunctionId b) { | 205 static bool Equals(Runtime::FunctionId a, Runtime::FunctionId b) { |
197 return a == b; | 206 return a == b; |
198 } | 207 } |
199 }; | 208 }; |
200 } | 209 } |
201 } | 210 } |
202 } // namespace v8::internal::compiler | 211 } // namespace v8::internal::compiler |
203 | 212 |
204 #endif // V8_COMPILER_JS_OPERATOR_H_ | 213 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |