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