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

Side by Side Diff: src/hydrogen-instructions.h

Issue 24544002: Macrofication of HInstruction constructors with context argument. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 static I* New(Zone* zone, \ 1044 static I* New(Zone* zone, \
1045 HValue* context, \ 1045 HValue* context, \
1046 P1 p1, \ 1046 P1 p1, \
1047 P2 p2, \ 1047 P2 p2, \
1048 P3 p3, \ 1048 P3 p3, \
1049 P4 p4, \ 1049 P4 p4, \
1050 P5 p5) { \ 1050 P5 p5) { \
1051 return new(zone) I(p1, p2, p3, p4, p5); \ 1051 return new(zone) I(p1, p2, p3, p4, p5); \
1052 } 1052 }
1053 1053
1054 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \
1055 static I* New(Zone* zone, HValue* context) { \
1056 return new(zone) I(context); \
1057 }
1058
1059 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \
1060 static I* New(Zone* zone, HValue* context, P1 p1) { \
1061 return new(zone) I(context, p1); \
1062 }
1063
1064 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(I, P1, P2) \
1065 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \
1066 return new(zone) I(context, p1, p2); \
1067 }
1068
1069 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(I, P1, P2, P3) \
1070 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \
1071 return new(zone) I(context, p1, p2, p3); \
1072 }
1073
1074 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(I, P1, P2, P3, P4) \
1075 static I* New(Zone* zone, \
1076 HValue* context, \
1077 P1 p1, \
1078 P2 p2, \
1079 P3 p3, \
1080 P4 p4) { \
1081 return new(zone) I(context, p1, p2, p3, p4); \
1082 }
1083
1084 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \
1085 static I* New(Zone* zone, \
1086 HValue* context, \
1087 P1 p1, \
1088 P2 p2, \
1089 P3 p3, \
1090 P4 p4, \
1091 P5 p5) { \
1092 return new(zone) I(context, p1, p2, p3, p4, p5); \
1093 }
1094
1054 1095
1055 class HInstruction : public HValue { 1096 class HInstruction : public HValue {
1056 public: 1097 public:
1057 HInstruction* next() const { return next_; } 1098 HInstruction* next() const { return next_; }
1058 HInstruction* previous() const { return previous_; } 1099 HInstruction* previous() const { return previous_; }
1059 1100
1060 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 1101 virtual void PrintTo(StringStream* stream) V8_OVERRIDE;
1061 virtual void PrintDataTo(StringStream* stream); 1102 virtual void PrintDataTo(StringStream* stream);
1062 1103
1063 bool IsLinked() const { return block() != NULL; } 1104 bool IsLinked() const { return block() != NULL; }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 set_representation(Representation::Tagged()); 1426 set_representation(Representation::Tagged());
1386 SetFlag(kUseGVN); 1427 SetFlag(kUseGVN);
1387 } 1428 }
1388 1429
1389 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1430 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1390 }; 1431 };
1391 1432
1392 1433
1393 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { 1434 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
1394 public: 1435 public:
1395 static HInstruction* New(Zone* zone, 1436 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*);
1396 HValue* context, 1437 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*);
1397 HValue* value,
1398 HValue* parameter_count) {
1399 return new(zone) HReturn(value, context, parameter_count);
1400 }
1401
1402 static HInstruction* New(Zone* zone,
1403 HValue* context,
1404 HValue* value) {
1405 return new(zone) HReturn(value, context, 0);
1406 }
1407 1438
1408 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1439 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1409 return Representation::Tagged(); 1440 return Representation::Tagged();
1410 } 1441 }
1411 1442
1412 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1443 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1413 1444
1414 HValue* value() { return OperandAt(0); } 1445 HValue* value() { return OperandAt(0); }
1415 HValue* context() { return OperandAt(1); } 1446 HValue* context() { return OperandAt(1); }
1416 HValue* parameter_count() { return OperandAt(2); } 1447 HValue* parameter_count() { return OperandAt(2); }
1417 1448
1418 DECLARE_CONCRETE_INSTRUCTION(Return) 1449 DECLARE_CONCRETE_INSTRUCTION(Return)
1419 1450
1420 private: 1451 private:
1421 HReturn(HValue* value, HValue* context, HValue* parameter_count) { 1452 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1422 SetOperandAt(0, value); 1453 SetOperandAt(0, value);
1423 SetOperandAt(1, context); 1454 SetOperandAt(1, context);
1424 SetOperandAt(2, parameter_count); 1455 SetOperandAt(2, parameter_count);
1425 } 1456 }
1426 }; 1457 };
1427 1458
1428 1459
1429 class HUnaryOperation : public HTemplateInstruction<1> { 1460 class HUnaryOperation : public HTemplateInstruction<1> {
1430 public: 1461 public:
1431 HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1462 HUnaryOperation(HValue* value, HType type = HType::Tagged())
1432 : HTemplateInstruction<1>(type) { 1463 : HTemplateInstruction<1>(type) {
1433 SetOperandAt(0, value); 1464 SetOperandAt(0, value);
1434 } 1465 }
1435 1466
1436 static HUnaryOperation* cast(HValue* value) { 1467 static HUnaryOperation* cast(HValue* value) {
1437 return reinterpret_cast<HUnaryOperation*>(value); 1468 return reinterpret_cast<HUnaryOperation*>(value);
1438 } 1469 }
1439 1470
1440 HValue* value() const { return OperandAt(0); } 1471 HValue* value() const { return OperandAt(0); }
1441 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1472 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1442 }; 1473 };
1443 1474
1444 1475
1445 class HThrow V8_FINAL : public HTemplateInstruction<2> { 1476 class HThrow V8_FINAL : public HTemplateInstruction<2> {
1446 public: 1477 public:
1447 static HThrow* New(Zone* zone, 1478 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HThrow, HValue*);
1448 HValue* context,
1449 HValue* value) {
1450 return new(zone) HThrow(context, value);
1451 }
1452 1479
1453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1480 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1454 return Representation::Tagged(); 1481 return Representation::Tagged();
1455 } 1482 }
1456 1483
1457 HValue* context() { return OperandAt(0); } 1484 HValue* context() { return OperandAt(0); }
1458 HValue* value() { return OperandAt(1); } 1485 HValue* value() { return OperandAt(1); }
1459 1486
1460 DECLARE_CONCRETE_INSTRUCTION(Throw) 1487 DECLARE_CONCRETE_INSTRUCTION(Throw)
1461 1488
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 }; 1769 };
1743 1770
1744 1771
1745 class HStackCheck V8_FINAL : public HTemplateInstruction<1> { 1772 class HStackCheck V8_FINAL : public HTemplateInstruction<1> {
1746 public: 1773 public:
1747 enum Type { 1774 enum Type {
1748 kFunctionEntry, 1775 kFunctionEntry,
1749 kBackwardsBranch 1776 kBackwardsBranch
1750 }; 1777 };
1751 1778
1752 DECLARE_INSTRUCTION_FACTORY_P2(HStackCheck, HValue*, Type); 1779 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type);
1753 1780
1754 HValue* context() { return OperandAt(0); } 1781 HValue* context() { return OperandAt(0); }
1755 1782
1756 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1783 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1757 return Representation::Tagged(); 1784 return Representation::Tagged();
1758 } 1785 }
1759 1786
1760 void Eliminate() { 1787 void Eliminate() {
1761 // The stack check eliminator might try to eliminate the same stack 1788 // The stack check eliminator might try to eliminate the same stack
1762 // check instruction multiple times. 1789 // check instruction multiple times.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 set_representation(Representation::Tagged()); 1959 set_representation(Representation::Tagged());
1933 SetFlag(kUseGVN); 1960 SetFlag(kUseGVN);
1934 } 1961 }
1935 1962
1936 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1963 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1937 }; 1964 };
1938 1965
1939 1966
1940 class HDeclareGlobals V8_FINAL : public HUnaryOperation { 1967 class HDeclareGlobals V8_FINAL : public HUnaryOperation {
1941 public: 1968 public:
1942 HDeclareGlobals(HValue* context, 1969 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals,
1943 Handle<FixedArray> pairs, 1970 Handle<FixedArray>,
1944 int flags) 1971 int);
1945 : HUnaryOperation(context),
1946 pairs_(pairs),
1947 flags_(flags) {
1948 set_representation(Representation::Tagged());
1949 SetAllSideEffects();
1950 }
1951
1952 static HDeclareGlobals* New(Zone* zone,
1953 HValue* context,
1954 Handle<FixedArray> pairs,
1955 int flags) {
1956 return new(zone) HDeclareGlobals(context, pairs, flags);
1957 }
1958 1972
1959 HValue* context() { return OperandAt(0); } 1973 HValue* context() { return OperandAt(0); }
1960 Handle<FixedArray> pairs() const { return pairs_; } 1974 Handle<FixedArray> pairs() const { return pairs_; }
1961 int flags() const { return flags_; } 1975 int flags() const { return flags_; }
1962 1976
1963 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) 1977 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals)
1964 1978
1965 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1979 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1966 return Representation::Tagged(); 1980 return Representation::Tagged();
1967 } 1981 }
1968 1982
1969 private: 1983 private:
1984 HDeclareGlobals(HValue* context,
1985 Handle<FixedArray> pairs,
1986 int flags)
1987 : HUnaryOperation(context),
1988 pairs_(pairs),
1989 flags_(flags) {
1990 set_representation(Representation::Tagged());
1991 SetAllSideEffects();
1992 }
1993
1970 Handle<FixedArray> pairs_; 1994 Handle<FixedArray> pairs_;
1971 int flags_; 1995 int flags_;
1972 }; 1996 };
1973 1997
1974 1998
1975 class HGlobalObject V8_FINAL : public HUnaryOperation { 1999 class HGlobalObject V8_FINAL : public HUnaryOperation {
1976 public: 2000 public:
1977 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 2001 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
1978 set_representation(Representation::Tagged()); 2002 set_representation(Representation::Tagged());
1979 SetFlag(kUseGVN); 2003 SetFlag(kUseGVN);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 return Representation::Tagged(); 2100 return Representation::Tagged();
2077 } 2101 }
2078 2102
2079 HValue* first() { return OperandAt(0); } 2103 HValue* first() { return OperandAt(0); }
2080 HValue* second() { return OperandAt(1); } 2104 HValue* second() { return OperandAt(1); }
2081 }; 2105 };
2082 2106
2083 2107
2084 class HInvokeFunction V8_FINAL : public HBinaryCall { 2108 class HInvokeFunction V8_FINAL : public HBinaryCall {
2085 public: 2109 public:
2086 HInvokeFunction(HValue* context, HValue* function, int argument_count) 2110 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int);
2087 : HBinaryCall(context, function, argument_count) {
2088 }
2089
2090 static HInvokeFunction* New(Zone* zone,
2091 HValue* context,
2092 HValue* function,
2093 int argument_count) {
2094 return new(zone) HInvokeFunction(context, function, argument_count);
2095 }
2096 2111
2097 HInvokeFunction(HValue* context, 2112 HInvokeFunction(HValue* context,
2098 HValue* function, 2113 HValue* function,
2099 Handle<JSFunction> known_function, 2114 Handle<JSFunction> known_function,
2100 int argument_count) 2115 int argument_count)
2101 : HBinaryCall(context, function, argument_count), 2116 : HBinaryCall(context, function, argument_count),
2102 known_function_(known_function) { 2117 known_function_(known_function) {
2103 formal_parameter_count_ = known_function.is_null() 2118 formal_parameter_count_ = known_function.is_null()
2104 ? 0 : known_function->shared()->formal_parameter_count(); 2119 ? 0 : known_function->shared()->formal_parameter_count();
2105 } 2120 }
2106 2121
2107 static HInvokeFunction* New(Zone* zone, 2122 static HInvokeFunction* New(Zone* zone,
2108 HValue* context, 2123 HValue* context,
2109 HValue* function, 2124 HValue* function,
2110 Handle<JSFunction> known_function, 2125 Handle<JSFunction> known_function,
2111 int argument_count) { 2126 int argument_count) {
2112 return new(zone) HInvokeFunction(context, function, 2127 return new(zone) HInvokeFunction(context, function,
2113 known_function, argument_count); 2128 known_function, argument_count);
2114 } 2129 }
2115 2130
2116 HValue* context() { return first(); } 2131 HValue* context() { return first(); }
2117 HValue* function() { return second(); } 2132 HValue* function() { return second(); }
2118 Handle<JSFunction> known_function() { return known_function_; } 2133 Handle<JSFunction> known_function() { return known_function_; }
2119 int formal_parameter_count() const { return formal_parameter_count_; } 2134 int formal_parameter_count() const { return formal_parameter_count_; }
2120 2135
2121 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) 2136 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction)
2122 2137
2123 private: 2138 private:
2139 HInvokeFunction(HValue* context, HValue* function, int argument_count)
2140 : HBinaryCall(context, function, argument_count) {
2141 }
2142
2124 Handle<JSFunction> known_function_; 2143 Handle<JSFunction> known_function_;
2125 int formal_parameter_count_; 2144 int formal_parameter_count_;
2126 }; 2145 };
2127 2146
2128 2147
2129 class HCallConstantFunction V8_FINAL : public HCall<0> { 2148 class HCallConstantFunction V8_FINAL : public HCall<0> {
2130 public: 2149 public:
2131 HCallConstantFunction(Handle<JSFunction> function, int argument_count) 2150 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction,
2132 : HCall<0>(argument_count), 2151 Handle<JSFunction>,
2133 function_(function), 2152 int);
2134 formal_parameter_count_(function->shared()->formal_parameter_count()) {}
2135 2153
2136 Handle<JSFunction> function() const { return function_; } 2154 Handle<JSFunction> function() const { return function_; }
2137 int formal_parameter_count() const { return formal_parameter_count_; } 2155 int formal_parameter_count() const { return formal_parameter_count_; }
2138 2156
2139 bool IsApplyFunction() const { 2157 bool IsApplyFunction() const {
2140 return function_->code() == 2158 return function_->code() ==
2141 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); 2159 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply);
2142 } 2160 }
2143 2161
2144 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2162 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2145 2163
2146 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2164 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2147 return Representation::None(); 2165 return Representation::None();
2148 } 2166 }
2149 2167
2150 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) 2168 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction)
2151 2169
2152 private: 2170 private:
2171 HCallConstantFunction(Handle<JSFunction> function, int argument_count)
2172 : HCall<0>(argument_count),
2173 function_(function),
2174 formal_parameter_count_(function->shared()->formal_parameter_count()) {}
2175
2153 Handle<JSFunction> function_; 2176 Handle<JSFunction> function_;
2154 int formal_parameter_count_; 2177 int formal_parameter_count_;
2155 }; 2178 };
2156 2179
2157 2180
2158 class HCallKeyed V8_FINAL : public HBinaryCall { 2181 class HCallKeyed V8_FINAL : public HBinaryCall {
2159 public: 2182 public:
2160 HCallKeyed(HValue* context, HValue* key, int argument_count) 2183 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int);
2161 : HBinaryCall(context, key, argument_count) {
2162 }
2163 2184
2164 HValue* context() { return first(); } 2185 HValue* context() { return first(); }
2165 HValue* key() { return second(); } 2186 HValue* key() { return second(); }
2166 2187
2167 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) 2188 DECLARE_CONCRETE_INSTRUCTION(CallKeyed)
2189
2190 private:
2191 HCallKeyed(HValue* context, HValue* key, int argument_count)
2192 : HBinaryCall(context, key, argument_count) {
2193 }
2168 }; 2194 };
2169 2195
2170 2196
2171 class HCallNamed V8_FINAL : public HUnaryCall { 2197 class HCallNamed V8_FINAL : public HUnaryCall {
2172 public: 2198 public:
2173 HCallNamed(HValue* context, Handle<String> name, int argument_count) 2199 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int);
2174 : HUnaryCall(context, argument_count), name_(name) {
2175 }
2176 2200
2177 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2201 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2178 2202
2179 HValue* context() { return value(); } 2203 HValue* context() { return value(); }
2180 Handle<String> name() const { return name_; } 2204 Handle<String> name() const { return name_; }
2181 2205
2182 DECLARE_CONCRETE_INSTRUCTION(CallNamed) 2206 DECLARE_CONCRETE_INSTRUCTION(CallNamed)
2183 2207
2184 private: 2208 private:
2209 HCallNamed(HValue* context, Handle<String> name, int argument_count)
2210 : HUnaryCall(context, argument_count), name_(name) {
2211 }
2212
2185 Handle<String> name_; 2213 Handle<String> name_;
2186 }; 2214 };
2187 2215
2188 2216
2189 class HCallFunction V8_FINAL : public HBinaryCall { 2217 class HCallFunction V8_FINAL : public HBinaryCall {
2190 public: 2218 public:
2191 HCallFunction(HValue* context, HValue* function, int argument_count) 2219 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int);
2192 : HBinaryCall(context, function, argument_count) {
2193 }
2194
2195 static HCallFunction* New(Zone* zone,
2196 HValue* context,
2197 HValue* function,
2198 int argument_count) {
2199 return new(zone) HCallFunction(context, function, argument_count);
2200 }
2201 2220
2202 HValue* context() { return first(); } 2221 HValue* context() { return first(); }
2203 HValue* function() { return second(); } 2222 HValue* function() { return second(); }
2204 2223
2205 DECLARE_CONCRETE_INSTRUCTION(CallFunction) 2224 DECLARE_CONCRETE_INSTRUCTION(CallFunction)
2225
2226 private:
2227 HCallFunction(HValue* context, HValue* function, int argument_count)
2228 : HBinaryCall(context, function, argument_count) {
2229 }
2206 }; 2230 };
2207 2231
2208 2232
2209 class HCallGlobal V8_FINAL : public HUnaryCall { 2233 class HCallGlobal V8_FINAL : public HUnaryCall {
2210 public: 2234 public:
2211 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 2235 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallGlobal, Handle<String>, int);
2212 : HUnaryCall(context, argument_count), name_(name) {
2213 }
2214
2215 static HCallGlobal* New(Zone* zone,
2216 HValue* context,
2217 Handle<String> name,
2218 int argument_count) {
2219 return new(zone) HCallGlobal(context, name, argument_count);
2220 }
2221 2236
2222 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2237 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2223 2238
2224 HValue* context() { return value(); } 2239 HValue* context() { return value(); }
2225 Handle<String> name() const { return name_; } 2240 Handle<String> name() const { return name_; }
2226 2241
2227 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) 2242 DECLARE_CONCRETE_INSTRUCTION(CallGlobal)
2228 2243
2229 private: 2244 private:
2245 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
2246 : HUnaryCall(context, argument_count), name_(name) {
2247 }
2248
2230 Handle<String> name_; 2249 Handle<String> name_;
2231 }; 2250 };
2232 2251
2233 2252
2234 class HCallKnownGlobal V8_FINAL : public HCall<0> { 2253 class HCallKnownGlobal V8_FINAL : public HCall<0> {
2235 public: 2254 public:
2236 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 2255 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
2237 : HCall<0>(argument_count), 2256 : HCall<0>(argument_count),
2238 target_(target), 2257 target_(target),
2239 formal_parameter_count_(target->shared()->formal_parameter_count()) { } 2258 formal_parameter_count_(target->shared()->formal_parameter_count()) { }
(...skipping 10 matching lines...) Expand all
2250 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) 2269 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
2251 2270
2252 private: 2271 private:
2253 Handle<JSFunction> target_; 2272 Handle<JSFunction> target_;
2254 int formal_parameter_count_; 2273 int formal_parameter_count_;
2255 }; 2274 };
2256 2275
2257 2276
2258 class HCallNew V8_FINAL : public HBinaryCall { 2277 class HCallNew V8_FINAL : public HBinaryCall {
2259 public: 2278 public:
2260 HCallNew(HValue* context, HValue* constructor, int argument_count) 2279 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2261 : HBinaryCall(context, constructor, argument_count) {}
2262 2280
2263 HValue* context() { return first(); } 2281 HValue* context() { return first(); }
2264 HValue* constructor() { return second(); } 2282 HValue* constructor() { return second(); }
2265 2283
2266 DECLARE_CONCRETE_INSTRUCTION(CallNew) 2284 DECLARE_CONCRETE_INSTRUCTION(CallNew)
2285
2286 private:
2287 HCallNew(HValue* context, HValue* constructor, int argument_count)
2288 : HBinaryCall(context, constructor, argument_count) {}
2267 }; 2289 };
2268 2290
2269 2291
2270 class HCallNewArray V8_FINAL : public HBinaryCall { 2292 class HCallNewArray V8_FINAL : public HBinaryCall {
2271 public: 2293 public:
2272 HCallNewArray(HValue* context, HValue* constructor, int argument_count, 2294 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray,
2273 Handle<Cell> type_cell, ElementsKind elements_kind) 2295 HValue*,
2274 : HBinaryCall(context, constructor, argument_count), 2296 int,
2275 elements_kind_(elements_kind), 2297 Handle<Cell>,
2276 type_cell_(type_cell) {} 2298 ElementsKind);
2277 2299
2278 HValue* context() { return first(); } 2300 HValue* context() { return first(); }
2279 HValue* constructor() { return second(); } 2301 HValue* constructor() { return second(); }
2280 2302
2281 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2303 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2282 2304
2283 Handle<Cell> property_cell() const { 2305 Handle<Cell> property_cell() const {
2284 return type_cell_; 2306 return type_cell_;
2285 } 2307 }
2286 2308
2287 ElementsKind elements_kind() const { return elements_kind_; } 2309 ElementsKind elements_kind() const { return elements_kind_; }
2288 2310
2289 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) 2311 DECLARE_CONCRETE_INSTRUCTION(CallNewArray)
2290 2312
2291 private: 2313 private:
2314 HCallNewArray(HValue* context, HValue* constructor, int argument_count,
2315 Handle<Cell> type_cell, ElementsKind elements_kind)
2316 : HBinaryCall(context, constructor, argument_count),
2317 elements_kind_(elements_kind),
2318 type_cell_(type_cell) {}
2319
2292 ElementsKind elements_kind_; 2320 ElementsKind elements_kind_;
2293 Handle<Cell> type_cell_; 2321 Handle<Cell> type_cell_;
2294 }; 2322 };
2295 2323
2296 2324
2297 class HCallRuntime V8_FINAL : public HCall<1> { 2325 class HCallRuntime V8_FINAL : public HCall<1> {
2298 public: 2326 public:
2299 static HCallRuntime* New(Zone* zone, 2327 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime,
2300 HValue* context, 2328 Handle<String>,
2301 Handle<String> name, 2329 const Runtime::Function*,
2302 const Runtime::Function* c_function, 2330 int);
2303 int argument_count) {
2304 return new(zone) HCallRuntime(context, name, c_function, argument_count);
2305 }
2306 2331
2307 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2332 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2308 2333
2309 HValue* context() { return OperandAt(0); } 2334 HValue* context() { return OperandAt(0); }
2310 const Runtime::Function* function() const { return c_function_; } 2335 const Runtime::Function* function() const { return c_function_; }
2311 Handle<String> name() const { return name_; } 2336 Handle<String> name() const { return name_; }
2312 2337
2313 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2338 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2314 return Representation::Tagged(); 2339 return Representation::Tagged();
2315 } 2340 }
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 3895
3871 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 3896 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
3872 3897
3873 private: 3898 private:
3874 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3899 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3875 }; 3900 };
3876 3901
3877 3902
3878 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { 3903 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation {
3879 public: 3904 public:
3880 static HMathFloorOfDiv* New(Zone* zone, 3905 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv,
3881 HValue* context, 3906 HValue*,
3882 HValue* left, 3907 HValue*);
3883 HValue* right) {
3884 return new(zone) HMathFloorOfDiv(context, left, right);
3885 }
3886 3908
3887 virtual HValue* EnsureAndPropagateNotMinusZero( 3909 virtual HValue* EnsureAndPropagateNotMinusZero(
3888 BitVector* visited) V8_OVERRIDE; 3910 BitVector* visited) V8_OVERRIDE;
3889 3911
3890 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) 3912 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
3891 3913
3892 protected: 3914 protected:
3893 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3915 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3894 3916
3895 private: 3917 private:
(...skipping 25 matching lines...) Expand all
3921 if (to.IsTagged()) { 3943 if (to.IsTagged()) {
3922 SetAllSideEffects(); 3944 SetAllSideEffects();
3923 ClearFlag(kUseGVN); 3945 ClearFlag(kUseGVN);
3924 } else { 3946 } else {
3925 ClearAllSideEffects(); 3947 ClearAllSideEffects();
3926 SetFlag(kUseGVN); 3948 SetFlag(kUseGVN);
3927 } 3949 }
3928 } 3950 }
3929 3951
3930 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 3952 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
3931
3932 private: 3953 private:
3933 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3954 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3934 }; 3955 };
3935 3956
3936 3957
3937 class HCompareGeneric V8_FINAL : public HBinaryOperation { 3958 class HCompareGeneric V8_FINAL : public HBinaryOperation {
3938 public: 3959 public:
3939 HCompareGeneric(HValue* context, 3960 HCompareGeneric(HValue* context,
3940 HValue* left, 3961 HValue* left,
3941 HValue* right, 3962 HValue* right,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 private: 4173 private:
4153 HIsUndetectableAndBranch(HValue* value, 4174 HIsUndetectableAndBranch(HValue* value,
4154 HBasicBlock* true_target = NULL, 4175 HBasicBlock* true_target = NULL,
4155 HBasicBlock* false_target = NULL) 4176 HBasicBlock* false_target = NULL)
4156 : HUnaryControlInstruction(value, true_target, false_target) {} 4177 : HUnaryControlInstruction(value, true_target, false_target) {}
4157 }; 4178 };
4158 4179
4159 4180
4160 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { 4181 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> {
4161 public: 4182 public:
4162 HStringCompareAndBranch(HValue* context, 4183 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch,
4163 HValue* left, 4184 HValue*,
4164 HValue* right, 4185 HValue*,
4165 Token::Value token) 4186 Token::Value);
4166 : token_(token) {
4167 ASSERT(Token::IsCompareOp(token));
4168 SetOperandAt(0, context);
4169 SetOperandAt(1, left);
4170 SetOperandAt(2, right);
4171 set_representation(Representation::Tagged());
4172 SetGVNFlag(kChangesNewSpacePromotion);
4173 }
4174 4187
4175 HValue* context() { return OperandAt(0); } 4188 HValue* context() { return OperandAt(0); }
4176 HValue* left() { return OperandAt(1); } 4189 HValue* left() { return OperandAt(1); }
4177 HValue* right() { return OperandAt(2); } 4190 HValue* right() { return OperandAt(2); }
4178 Token::Value token() const { return token_; } 4191 Token::Value token() const { return token_; }
4179 4192
4180 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4193 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4181 4194
4182 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4195 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4183 return Representation::Tagged(); 4196 return Representation::Tagged();
4184 } 4197 }
4185 4198
4186 Representation GetInputRepresentation() const { 4199 Representation GetInputRepresentation() const {
4187 return Representation::Tagged(); 4200 return Representation::Tagged();
4188 } 4201 }
4189 4202
4190 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) 4203 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch)
4191 4204
4192 private: 4205 private:
4206 HStringCompareAndBranch(HValue* context,
4207 HValue* left,
4208 HValue* right,
4209 Token::Value token)
4210 : token_(token) {
4211 ASSERT(Token::IsCompareOp(token));
4212 SetOperandAt(0, context);
4213 SetOperandAt(1, left);
4214 SetOperandAt(2, right);
4215 set_representation(Representation::Tagged());
4216 SetGVNFlag(kChangesNewSpacePromotion);
4217 }
4218
4193 Token::Value token_; 4219 Token::Value token_;
4194 }; 4220 };
4195 4221
4196 4222
4197 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4223 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4198 public: 4224 public:
4199 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4225 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4200 return Representation::None(); 4226 return Representation::None();
4201 } 4227 }
4202 4228
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4318 } 4344 }
4319 4345
4320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4346 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4321 4347
4322 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 4348 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
4323 }; 4349 };
4324 4350
4325 4351
4326 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { 4352 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> {
4327 public: 4353 public:
4328 HInstanceOfKnownGlobal(HValue* context, 4354 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal,
4329 HValue* left, 4355 HValue*,
4330 Handle<JSFunction> right) 4356 Handle<JSFunction>);
4331 : HTemplateInstruction<2>(HType::Boolean()), function_(right) {
4332 SetOperandAt(0, context);
4333 SetOperandAt(1, left);
4334 set_representation(Representation::Tagged());
4335 SetAllSideEffects();
4336 }
4337 4357
4338 HValue* context() { return OperandAt(0); } 4358 HValue* context() { return OperandAt(0); }
4339 HValue* left() { return OperandAt(1); } 4359 HValue* left() { return OperandAt(1); }
4340 Handle<JSFunction> function() { return function_; } 4360 Handle<JSFunction> function() { return function_; }
4341 4361
4342 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4362 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4343 return Representation::Tagged(); 4363 return Representation::Tagged();
4344 } 4364 }
4345 4365
4346 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 4366 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
4347 4367
4348 private: 4368 private:
4369 HInstanceOfKnownGlobal(HValue* context,
4370 HValue* left,
4371 Handle<JSFunction> right)
4372 : HTemplateInstruction<2>(HType::Boolean()), function_(right) {
4373 SetOperandAt(0, context);
4374 SetOperandAt(1, left);
4375 set_representation(Representation::Tagged());
4376 SetAllSideEffects();
4377 }
4378
4349 Handle<JSFunction> function_; 4379 Handle<JSFunction> function_;
4350 }; 4380 };
4351 4381
4352 4382
4353 // TODO(mstarzinger): This instruction should be modeled as a load of the map 4383 // TODO(mstarzinger): This instruction should be modeled as a load of the map
4354 // field followed by a load of the instance size field once HLoadNamedField is 4384 // field followed by a load of the instance size field once HLoadNamedField is
4355 // flexible enough to accommodate byte-field loads. 4385 // flexible enough to accommodate byte-field loads.
4356 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> { 4386 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> {
4357 public: 4387 public:
4358 explicit HInstanceSize(HValue* object) { 4388 explicit HInstanceSize(HValue* object) {
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
4975 set_representation(r); 5005 set_representation(r);
4976 } 5006 }
4977 5007
4978 unsigned index_; 5008 unsigned index_;
4979 ParameterKind kind_; 5009 ParameterKind kind_;
4980 }; 5010 };
4981 5011
4982 5012
4983 class HCallStub V8_FINAL : public HUnaryCall { 5013 class HCallStub V8_FINAL : public HUnaryCall {
4984 public: 5014 public:
4985 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 5015 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int);
4986 : HUnaryCall(context, argument_count),
4987 major_key_(major_key),
4988 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
4989 }
4990
4991 CodeStub::Major major_key() { return major_key_; } 5016 CodeStub::Major major_key() { return major_key_; }
4992 5017
4993 HValue* context() { return value(); } 5018 HValue* context() { return value(); }
4994 5019
4995 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 5020 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
4996 transcendental_type_ = transcendental_type; 5021 transcendental_type_ = transcendental_type;
4997 } 5022 }
4998 TranscendentalCache::Type transcendental_type() { 5023 TranscendentalCache::Type transcendental_type() {
4999 return transcendental_type_; 5024 return transcendental_type_;
5000 } 5025 }
5001 5026
5002 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5027 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5003 5028
5004 DECLARE_CONCRETE_INSTRUCTION(CallStub) 5029 DECLARE_CONCRETE_INSTRUCTION(CallStub)
5005 5030
5006 private: 5031 private:
5032 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
5033 : HUnaryCall(context, argument_count),
5034 major_key_(major_key),
5035 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
5036 }
5037
5007 CodeStub::Major major_key_; 5038 CodeStub::Major major_key_;
5008 TranscendentalCache::Type transcendental_type_; 5039 TranscendentalCache::Type transcendental_type_;
5009 }; 5040 };
5010 5041
5011 5042
5012 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { 5043 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> {
5013 public: 5044 public:
5014 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); 5045 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int);
5015 5046
5016 virtual void PrintDataTo(StringStream* stream); 5047 virtual void PrintDataTo(StringStream* stream);
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
6531 virtual bool IsDeletable() const V8_OVERRIDE { 6562 virtual bool IsDeletable() const V8_OVERRIDE {
6532 return flags_ == STRING_ADD_CHECK_NONE; 6563 return flags_ == STRING_ADD_CHECK_NONE;
6533 } 6564 }
6534 6565
6535 const StringAddFlags flags_; 6566 const StringAddFlags flags_;
6536 }; 6567 };
6537 6568
6538 6569
6539 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 6570 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
6540 public: 6571 public:
6541 static HStringCharCodeAt* New(Zone* zone, 6572 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
6542 HValue* context, 6573 HValue*,
6543 HValue* string, 6574 HValue*);
6544 HValue* index) {
6545 return new(zone) HStringCharCodeAt(context, string, index);
6546 }
6547 6575
6548 virtual Representation RequiredInputRepresentation(int index) { 6576 virtual Representation RequiredInputRepresentation(int index) {
6549 // The index is supposed to be Integer32. 6577 // The index is supposed to be Integer32.
6550 return index == 2 6578 return index == 2
6551 ? Representation::Integer32() 6579 ? Representation::Integer32()
6552 : Representation::Tagged(); 6580 : Representation::Tagged();
6553 } 6581 }
6554 6582
6555 HValue* context() const { return OperandAt(0); } 6583 HValue* context() const { return OperandAt(0); }
6556 HValue* string() const { return OperandAt(1); } 6584 HValue* string() const { return OperandAt(1); }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6640 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } 6668 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
6641 6669
6642 int literal_index_; 6670 int literal_index_;
6643 int depth_; 6671 int depth_;
6644 AllocationSiteMode allocation_site_mode_; 6672 AllocationSiteMode allocation_site_mode_;
6645 }; 6673 };
6646 6674
6647 6675
6648 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> { 6676 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> {
6649 public: 6677 public:
6678 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral,
6679 Handle<FixedArray>,
6680 Handle<String>,
6681 Handle<String>,
6682 int);
6683
6684 HValue* context() { return OperandAt(0); }
6685 Handle<FixedArray> literals() { return literals_; }
6686 Handle<String> pattern() { return pattern_; }
6687 Handle<String> flags() { return flags_; }
6688
6689 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6690 return Representation::Tagged();
6691 }
6692
6693 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
6694
6695 private:
6650 HRegExpLiteral(HValue* context, 6696 HRegExpLiteral(HValue* context,
6651 Handle<FixedArray> literals, 6697 Handle<FixedArray> literals,
6652 Handle<String> pattern, 6698 Handle<String> pattern,
6653 Handle<String> flags, 6699 Handle<String> flags,
6654 int literal_index) 6700 int literal_index)
6655 : HMaterializedLiteral<1>(literal_index, 0), 6701 : HMaterializedLiteral<1>(literal_index, 0),
6656 literals_(literals), 6702 literals_(literals),
6657 pattern_(pattern), 6703 pattern_(pattern),
6658 flags_(flags) { 6704 flags_(flags) {
6659 SetOperandAt(0, context); 6705 SetOperandAt(0, context);
6660 SetAllSideEffects(); 6706 SetAllSideEffects();
6661 set_type(HType::JSObject()); 6707 set_type(HType::JSObject());
6662 } 6708 }
6663 6709
6664 HValue* context() { return OperandAt(0); }
6665 Handle<FixedArray> literals() { return literals_; }
6666 Handle<String> pattern() { return pattern_; }
6667 Handle<String> flags() { return flags_; }
6668
6669 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6670 return Representation::Tagged();
6671 }
6672
6673 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
6674
6675 private:
6676 Handle<FixedArray> literals_; 6710 Handle<FixedArray> literals_;
6677 Handle<String> pattern_; 6711 Handle<String> pattern_;
6678 Handle<String> flags_; 6712 Handle<String> flags_;
6679 }; 6713 };
6680 6714
6681 6715
6682 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> { 6716 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> {
6683 public: 6717 public:
6684 HFunctionLiteral(HValue* context, 6718 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral,
6685 Handle<SharedFunctionInfo> shared, 6719 Handle<SharedFunctionInfo>,
6686 bool pretenure) 6720 bool);
6687 : HTemplateInstruction<1>(HType::JSObject()),
6688 shared_info_(shared),
6689 pretenure_(pretenure),
6690 has_no_literals_(shared->num_literals() == 0),
6691 is_generator_(shared->is_generator()),
6692 language_mode_(shared->language_mode()) {
6693 SetOperandAt(0, context);
6694 set_representation(Representation::Tagged());
6695 SetGVNFlag(kChangesNewSpacePromotion);
6696 }
6697
6698 HValue* context() { return OperandAt(0); } 6721 HValue* context() { return OperandAt(0); }
6699 6722
6700 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6723 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6701 return Representation::Tagged(); 6724 return Representation::Tagged();
6702 } 6725 }
6703 6726
6704 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 6727 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
6705 6728
6706 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 6729 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
6707 bool pretenure() const { return pretenure_; } 6730 bool pretenure() const { return pretenure_; }
6708 bool has_no_literals() const { return has_no_literals_; } 6731 bool has_no_literals() const { return has_no_literals_; }
6709 bool is_generator() const { return is_generator_; } 6732 bool is_generator() const { return is_generator_; }
6710 LanguageMode language_mode() const { return language_mode_; } 6733 LanguageMode language_mode() const { return language_mode_; }
6711 6734
6712 private: 6735 private:
6736 HFunctionLiteral(HValue* context,
6737 Handle<SharedFunctionInfo> shared,
6738 bool pretenure)
6739 : HTemplateInstruction<1>(HType::JSObject()),
6740 shared_info_(shared),
6741 pretenure_(pretenure),
6742 has_no_literals_(shared->num_literals() == 0),
6743 is_generator_(shared->is_generator()),
6744 language_mode_(shared->language_mode()) {
6745 SetOperandAt(0, context);
6746 set_representation(Representation::Tagged());
6747 SetGVNFlag(kChangesNewSpacePromotion);
6748 }
6749
6713 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6750 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6714 6751
6715 Handle<SharedFunctionInfo> shared_info_; 6752 Handle<SharedFunctionInfo> shared_info_;
6716 bool pretenure_ : 1; 6753 bool pretenure_ : 1;
6717 bool has_no_literals_ : 1; 6754 bool has_no_literals_ : 1;
6718 bool is_generator_ : 1; 6755 bool is_generator_ : 1;
6719 LanguageMode language_mode_; 6756 LanguageMode language_mode_;
6720 }; 6757 };
6721 6758
6722 6759
6723 class HTypeof V8_FINAL : public HTemplateInstruction<2> { 6760 class HTypeof V8_FINAL : public HTemplateInstruction<2> {
6724 public: 6761 public:
6725 explicit HTypeof(HValue* context, HValue* value) { 6762 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
6726 SetOperandAt(0, context);
6727 SetOperandAt(1, value);
6728 set_representation(Representation::Tagged());
6729 }
6730 6763
6731 HValue* context() { return OperandAt(0); } 6764 HValue* context() { return OperandAt(0); }
6732 HValue* value() { return OperandAt(1); } 6765 HValue* value() { return OperandAt(1); }
6733 6766
6734 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6767 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6735 6768
6736 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6769 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6737 return Representation::Tagged(); 6770 return Representation::Tagged();
6738 } 6771 }
6739 6772
6740 DECLARE_CONCRETE_INSTRUCTION(Typeof) 6773 DECLARE_CONCRETE_INSTRUCTION(Typeof)
6741 6774
6742 private: 6775 private:
6776 explicit HTypeof(HValue* context, HValue* value) {
6777 SetOperandAt(0, context);
6778 SetOperandAt(1, value);
6779 set_representation(Representation::Tagged());
6780 }
6781
6743 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6782 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6744 }; 6783 };
6745 6784
6746 6785
6747 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> { 6786 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> {
6748 public: 6787 public:
6749 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); 6788 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*);
6750 6789
6751 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6790 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6752 return Representation::Tagged(); 6791 return Representation::Tagged();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
6890 set_representation(Representation::Tagged()); 6929 set_representation(Representation::Tagged());
6891 SetFlag(kUseGVN); 6930 SetFlag(kUseGVN);
6892 SetGVNFlag(kDependsOnMaps); 6931 SetGVNFlag(kDependsOnMaps);
6893 SetGVNFlag(kDependsOnElementsKind); 6932 SetGVNFlag(kDependsOnElementsKind);
6894 } 6933 }
6895 }; 6934 };
6896 6935
6897 6936
6898 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { 6937 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> {
6899 public: 6938 public:
6900 static HForInPrepareMap* New(Zone* zone, 6939 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*);
6901 HValue* context,
6902 HValue* object) {
6903 return new(zone) HForInPrepareMap(context, object);
6904 }
6905 6940
6906 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6941 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6907 return Representation::Tagged(); 6942 return Representation::Tagged();
6908 } 6943 }
6909 6944
6910 HValue* context() { return OperandAt(0); } 6945 HValue* context() { return OperandAt(0); }
6911 HValue* enumerable() { return OperandAt(1); } 6946 HValue* enumerable() { return OperandAt(1); }
6912 6947
6913 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6948 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6914 6949
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6999 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7034 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7000 }; 7035 };
7001 7036
7002 7037
7003 #undef DECLARE_INSTRUCTION 7038 #undef DECLARE_INSTRUCTION
7004 #undef DECLARE_CONCRETE_INSTRUCTION 7039 #undef DECLARE_CONCRETE_INSTRUCTION
7005 7040
7006 } } // namespace v8::internal 7041 } } // namespace v8::internal
7007 7042
7008 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7043 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698