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/linkage.h" | |
9 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
10 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
11 #include "src/unique.h" | 10 #include "src/unique.h" |
12 #include "src/zone.h" | 11 #include "src/zone.h" |
13 | 12 |
14 namespace v8 { | 13 namespace v8 { |
15 namespace internal { | 14 namespace internal { |
16 namespace compiler { | 15 namespace compiler { |
17 | 16 |
18 // Defines the location of a context slot relative to a specific scope. This is | 17 // Defines the location of a context slot relative to a specific scope. This is |
(...skipping 23 matching lines...) Expand all Loading... |
42 struct LoadNamedParameters { | 41 struct LoadNamedParameters { |
43 PrintableUnique<Name> name; | 42 PrintableUnique<Name> name; |
44 ContextualMode contextual_mode; | 43 ContextualMode contextual_mode; |
45 }; | 44 }; |
46 | 45 |
47 // 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 |
48 // used as a parameter by JSCall operators. | 47 // used as a parameter by JSCall operators. |
49 struct CallParameters { | 48 struct CallParameters { |
50 int arity; | 49 int arity; |
51 CallFunctionFlags flags; | 50 CallFunctionFlags flags; |
52 // TODO(jarin) Remove the deopt flag once we can deoptimize all JavaScript | |
53 // calls (specifically the FILTER_KEY call in ForInStatement). | |
54 CallDescriptor::DeoptimizationSupport can_deoptimize; | |
55 }; | 51 }; |
56 | 52 |
57 // Interface for building JavaScript-level operators, e.g. directly from the | 53 // Interface for building JavaScript-level operators, e.g. directly from the |
58 // 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 |
59 // graphs. | 55 // graphs. |
60 class JSOperatorBuilder { | 56 class JSOperatorBuilder { |
61 public: | 57 public: |
62 explicit JSOperatorBuilder(Zone* zone) : zone_(zone) {} | 58 explicit JSOperatorBuilder(Zone* zone) : zone_(zone) {} |
63 | 59 |
64 #define SIMPLE(name, properties, inputs, outputs) \ | 60 #define SIMPLE(name, properties, inputs, outputs) \ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Operator* UnaryNot() { UNOP(JSUnaryNot); } | 96 Operator* UnaryNot() { UNOP(JSUnaryNot); } |
101 Operator* ToBoolean() { UNOP(JSToBoolean); } | 97 Operator* ToBoolean() { UNOP(JSToBoolean); } |
102 Operator* ToNumber() { UNOP(JSToNumber); } | 98 Operator* ToNumber() { UNOP(JSToNumber); } |
103 Operator* ToString() { UNOP(JSToString); } | 99 Operator* ToString() { UNOP(JSToString); } |
104 Operator* ToName() { UNOP(JSToName); } | 100 Operator* ToName() { UNOP(JSToName); } |
105 Operator* ToObject() { UNOP(JSToObject); } | 101 Operator* ToObject() { UNOP(JSToObject); } |
106 Operator* Yield() { UNOP(JSYield); } | 102 Operator* Yield() { UNOP(JSYield); } |
107 | 103 |
108 Operator* Create() { SIMPLE(JSCreate, Operator::kEliminatable, 0, 1); } | 104 Operator* Create() { SIMPLE(JSCreate, Operator::kEliminatable, 0, 1); } |
109 | 105 |
110 Operator* Call(int arguments, CallFunctionFlags flags, | 106 Operator* Call(int arguments, CallFunctionFlags flags) { |
111 CallDescriptor::DeoptimizationSupport can_deoptimize) { | 107 CallParameters parameters = {arguments, flags}; |
112 CallParameters parameters = {arguments, flags, can_deoptimize}; | |
113 OP1(JSCallFunction, CallParameters, parameters, Operator::kNoProperties, | 108 OP1(JSCallFunction, CallParameters, parameters, Operator::kNoProperties, |
114 arguments, 1); | 109 arguments, 1); |
115 } | 110 } |
116 | 111 |
117 Operator* CallNew(int arguments) { | 112 Operator* CallNew(int arguments) { |
118 return new (zone_) | 113 return new (zone_) |
119 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties, | 114 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties, |
120 arguments, 1, "JSCallConstruct", arguments); | 115 arguments, 1, "JSCallConstruct", arguments); |
121 } | 116 } |
122 | 117 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 static int HashCode(Runtime::FunctionId val) { return static_cast<int>(val); } | 204 static int HashCode(Runtime::FunctionId val) { return static_cast<int>(val); } |
210 static bool Equals(Runtime::FunctionId a, Runtime::FunctionId b) { | 205 static bool Equals(Runtime::FunctionId a, Runtime::FunctionId b) { |
211 return a == b; | 206 return a == b; |
212 } | 207 } |
213 }; | 208 }; |
214 } | 209 } |
215 } | 210 } |
216 } // namespace v8::internal::compiler | 211 } // namespace v8::internal::compiler |
217 | 212 |
218 #endif // V8_COMPILER_JS_OPERATOR_H_ | 213 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |