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

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

Issue 153953005: A64: Synchronize with r16993. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('j') | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ 58 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \
59 V(ArithmeticBinaryOperation) \ 59 V(ArithmeticBinaryOperation) \
60 V(BinaryOperation) \ 60 V(BinaryOperation) \
61 V(BitwiseBinaryOperation) \ 61 V(BitwiseBinaryOperation) \
62 V(ControlInstruction) \ 62 V(ControlInstruction) \
63 V(Instruction) \ 63 V(Instruction) \
64 64
65 65
66 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ 66 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
67 V(AbnormalExit) \
67 V(AccessArgumentsAt) \ 68 V(AccessArgumentsAt) \
68 V(Add) \ 69 V(Add) \
69 V(Allocate) \ 70 V(Allocate) \
70 V(ApplyArguments) \ 71 V(ApplyArguments) \
71 V(ArgumentsElements) \ 72 V(ArgumentsElements) \
72 V(ArgumentsLength) \ 73 V(ArgumentsLength) \
73 V(ArgumentsObject) \ 74 V(ArgumentsObject) \
74 V(Bitwise) \ 75 V(Bitwise) \
75 V(BlockEntry) \ 76 V(BlockEntry) \
76 V(BoundsCheck) \ 77 V(BoundsCheck) \
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 static I* New(Zone* zone, \ 1045 static I* New(Zone* zone, \
1045 HValue* context, \ 1046 HValue* context, \
1046 P1 p1, \ 1047 P1 p1, \
1047 P2 p2, \ 1048 P2 p2, \
1048 P3 p3, \ 1049 P3 p3, \
1049 P4 p4, \ 1050 P4 p4, \
1050 P5 p5) { \ 1051 P5 p5) { \
1051 return new(zone) I(p1, p2, p3, p4, p5); \ 1052 return new(zone) I(p1, p2, p3, p4, p5); \
1052 } 1053 }
1053 1054
1055 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \
1056 static I* New(Zone* zone, HValue* context) { \
1057 return new(zone) I(context); \
1058 }
1059
1060 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \
1061 static I* New(Zone* zone, HValue* context, P1 p1) { \
1062 return new(zone) I(context, p1); \
1063 }
1064
1065 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(I, P1, P2) \
1066 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \
1067 return new(zone) I(context, p1, p2); \
1068 }
1069
1070 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(I, P1, P2, P3) \
1071 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \
1072 return new(zone) I(context, p1, p2, p3); \
1073 }
1074
1075 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(I, P1, P2, P3, P4) \
1076 static I* New(Zone* zone, \
1077 HValue* context, \
1078 P1 p1, \
1079 P2 p2, \
1080 P3 p3, \
1081 P4 p4) { \
1082 return new(zone) I(context, p1, p2, p3, p4); \
1083 }
1084
1085 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \
1086 static I* New(Zone* zone, \
1087 HValue* context, \
1088 P1 p1, \
1089 P2 p2, \
1090 P3 p3, \
1091 P4 p4, \
1092 P5 p5) { \
1093 return new(zone) I(context, p1, p2, p3, p4, p5); \
1094 }
1095
1054 1096
1055 class HInstruction : public HValue { 1097 class HInstruction : public HValue {
1056 public: 1098 public:
1057 HInstruction* next() const { return next_; } 1099 HInstruction* next() const { return next_; }
1058 HInstruction* previous() const { return previous_; } 1100 HInstruction* previous() const { return previous_; }
1059 1101
1060 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 1102 virtual void PrintTo(StringStream* stream) V8_OVERRIDE;
1061 virtual void PrintDataTo(StringStream* stream); 1103 virtual void PrintDataTo(StringStream* stream);
1062 1104
1063 bool IsLinked() const { return block() != NULL; } 1105 bool IsLinked() const { return block() != NULL; }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 set_representation(Representation::Tagged()); 1427 set_representation(Representation::Tagged());
1386 SetFlag(kUseGVN); 1428 SetFlag(kUseGVN);
1387 } 1429 }
1388 1430
1389 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1431 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1390 }; 1432 };
1391 1433
1392 1434
1393 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { 1435 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
1394 public: 1436 public:
1395 static HInstruction* New(Zone* zone, 1437 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*);
1396 HValue* context, 1438 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 1439
1408 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1440 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1409 return Representation::Tagged(); 1441 return Representation::Tagged();
1410 } 1442 }
1411 1443
1412 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1444 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1413 1445
1414 HValue* value() { return OperandAt(0); } 1446 HValue* value() { return OperandAt(0); }
1415 HValue* context() { return OperandAt(1); } 1447 HValue* context() { return OperandAt(1); }
1416 HValue* parameter_count() { return OperandAt(2); } 1448 HValue* parameter_count() { return OperandAt(2); }
1417 1449
1418 DECLARE_CONCRETE_INSTRUCTION(Return) 1450 DECLARE_CONCRETE_INSTRUCTION(Return)
1419 1451
1420 private: 1452 private:
1421 HReturn(HValue* value, HValue* context, HValue* parameter_count) { 1453 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1422 SetOperandAt(0, value); 1454 SetOperandAt(0, value);
1423 SetOperandAt(1, context); 1455 SetOperandAt(1, context);
1424 SetOperandAt(2, parameter_count); 1456 SetOperandAt(2, parameter_count);
1425 } 1457 }
1426 }; 1458 };
1427 1459
1428 1460
1461 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
1462 public:
1463 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1464 return Representation::None();
1465 }
1466
1467 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
1468 };
1469
1470
1429 class HUnaryOperation : public HTemplateInstruction<1> { 1471 class HUnaryOperation : public HTemplateInstruction<1> {
1430 public: 1472 public:
1431 HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1473 HUnaryOperation(HValue* value, HType type = HType::Tagged())
1432 : HTemplateInstruction<1>(type) { 1474 : HTemplateInstruction<1>(type) {
1433 SetOperandAt(0, value); 1475 SetOperandAt(0, value);
1434 } 1476 }
1435 1477
1436 static HUnaryOperation* cast(HValue* value) { 1478 static HUnaryOperation* cast(HValue* value) {
1437 return reinterpret_cast<HUnaryOperation*>(value); 1479 return reinterpret_cast<HUnaryOperation*>(value);
1438 } 1480 }
1439 1481
1440 HValue* value() const { return OperandAt(0); } 1482 HValue* value() const { return OperandAt(0); }
1441 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1483 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1442 }; 1484 };
1443 1485
1444 1486
1445 class HThrow V8_FINAL : public HTemplateInstruction<2> { 1487 class HThrow V8_FINAL : public HTemplateInstruction<2> {
1446 public: 1488 public:
1447 static HThrow* New(Zone* zone, 1489 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HThrow, HValue*);
1448 HValue* context,
1449 HValue* value) {
1450 return new(zone) HThrow(context, value);
1451 }
1452 1490
1453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1491 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1454 return Representation::Tagged(); 1492 return Representation::Tagged();
1455 } 1493 }
1456 1494
1457 HValue* context() { return OperandAt(0); } 1495 HValue* context() { return OperandAt(0); }
1458 HValue* value() { return OperandAt(1); } 1496 HValue* value() { return OperandAt(1); }
1459 1497
1460 DECLARE_CONCRETE_INSTRUCTION(Throw) 1498 DECLARE_CONCRETE_INSTRUCTION(Throw)
1461 1499
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 }; 1780 };
1743 1781
1744 1782
1745 class HStackCheck V8_FINAL : public HTemplateInstruction<1> { 1783 class HStackCheck V8_FINAL : public HTemplateInstruction<1> {
1746 public: 1784 public:
1747 enum Type { 1785 enum Type {
1748 kFunctionEntry, 1786 kFunctionEntry,
1749 kBackwardsBranch 1787 kBackwardsBranch
1750 }; 1788 };
1751 1789
1752 DECLARE_INSTRUCTION_FACTORY_P2(HStackCheck, HValue*, Type); 1790 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type);
1753 1791
1754 HValue* context() { return OperandAt(0); } 1792 HValue* context() { return OperandAt(0); }
1755 1793
1756 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1794 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1757 return Representation::Tagged(); 1795 return Representation::Tagged();
1758 } 1796 }
1759 1797
1760 void Eliminate() { 1798 void Eliminate() {
1761 // The stack check eliminator might try to eliminate the same stack 1799 // The stack check eliminator might try to eliminate the same stack
1762 // check instruction multiple times. 1800 // check instruction multiple times.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 set_representation(Representation::Tagged()); 1970 set_representation(Representation::Tagged());
1933 SetFlag(kUseGVN); 1971 SetFlag(kUseGVN);
1934 } 1972 }
1935 1973
1936 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1974 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1937 }; 1975 };
1938 1976
1939 1977
1940 class HDeclareGlobals V8_FINAL : public HUnaryOperation { 1978 class HDeclareGlobals V8_FINAL : public HUnaryOperation {
1941 public: 1979 public:
1942 HDeclareGlobals(HValue* context, 1980 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals,
1943 Handle<FixedArray> pairs, 1981 Handle<FixedArray>,
1944 int flags) 1982 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 1983
1959 HValue* context() { return OperandAt(0); } 1984 HValue* context() { return OperandAt(0); }
1960 Handle<FixedArray> pairs() const { return pairs_; } 1985 Handle<FixedArray> pairs() const { return pairs_; }
1961 int flags() const { return flags_; } 1986 int flags() const { return flags_; }
1962 1987
1963 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) 1988 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals)
1964 1989
1965 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1990 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1966 return Representation::Tagged(); 1991 return Representation::Tagged();
1967 } 1992 }
1968 1993
1969 private: 1994 private:
1995 HDeclareGlobals(HValue* context,
1996 Handle<FixedArray> pairs,
1997 int flags)
1998 : HUnaryOperation(context),
1999 pairs_(pairs),
2000 flags_(flags) {
2001 set_representation(Representation::Tagged());
2002 SetAllSideEffects();
2003 }
2004
1970 Handle<FixedArray> pairs_; 2005 Handle<FixedArray> pairs_;
1971 int flags_; 2006 int flags_;
1972 }; 2007 };
1973 2008
1974 2009
1975 class HGlobalObject V8_FINAL : public HUnaryOperation { 2010 class HGlobalObject V8_FINAL : public HUnaryOperation {
1976 public: 2011 public:
1977 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 2012 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
1978 set_representation(Representation::Tagged()); 2013 set_representation(Representation::Tagged());
1979 SetFlag(kUseGVN); 2014 SetFlag(kUseGVN);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 return Representation::Tagged(); 2111 return Representation::Tagged();
2077 } 2112 }
2078 2113
2079 HValue* first() { return OperandAt(0); } 2114 HValue* first() { return OperandAt(0); }
2080 HValue* second() { return OperandAt(1); } 2115 HValue* second() { return OperandAt(1); }
2081 }; 2116 };
2082 2117
2083 2118
2084 class HInvokeFunction V8_FINAL : public HBinaryCall { 2119 class HInvokeFunction V8_FINAL : public HBinaryCall {
2085 public: 2120 public:
2086 HInvokeFunction(HValue* context, HValue* function, int argument_count) 2121 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 2122
2097 HInvokeFunction(HValue* context, 2123 HInvokeFunction(HValue* context,
2098 HValue* function, 2124 HValue* function,
2099 Handle<JSFunction> known_function, 2125 Handle<JSFunction> known_function,
2100 int argument_count) 2126 int argument_count)
2101 : HBinaryCall(context, function, argument_count), 2127 : HBinaryCall(context, function, argument_count),
2102 known_function_(known_function) { 2128 known_function_(known_function) {
2103 formal_parameter_count_ = known_function.is_null() 2129 formal_parameter_count_ = known_function.is_null()
2104 ? 0 : known_function->shared()->formal_parameter_count(); 2130 ? 0 : known_function->shared()->formal_parameter_count();
2105 } 2131 }
2106 2132
2107 static HInvokeFunction* New(Zone* zone, 2133 static HInvokeFunction* New(Zone* zone,
2108 HValue* context, 2134 HValue* context,
2109 HValue* function, 2135 HValue* function,
2110 Handle<JSFunction> known_function, 2136 Handle<JSFunction> known_function,
2111 int argument_count) { 2137 int argument_count) {
2112 return new(zone) HInvokeFunction(context, function, 2138 return new(zone) HInvokeFunction(context, function,
2113 known_function, argument_count); 2139 known_function, argument_count);
2114 } 2140 }
2115 2141
2116 HValue* context() { return first(); } 2142 HValue* context() { return first(); }
2117 HValue* function() { return second(); } 2143 HValue* function() { return second(); }
2118 Handle<JSFunction> known_function() { return known_function_; } 2144 Handle<JSFunction> known_function() { return known_function_; }
2119 int formal_parameter_count() const { return formal_parameter_count_; } 2145 int formal_parameter_count() const { return formal_parameter_count_; }
2120 2146
2121 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) 2147 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction)
2122 2148
2123 private: 2149 private:
2150 HInvokeFunction(HValue* context, HValue* function, int argument_count)
2151 : HBinaryCall(context, function, argument_count) {
2152 }
2153
2124 Handle<JSFunction> known_function_; 2154 Handle<JSFunction> known_function_;
2125 int formal_parameter_count_; 2155 int formal_parameter_count_;
2126 }; 2156 };
2127 2157
2128 2158
2129 class HCallConstantFunction V8_FINAL : public HCall<0> { 2159 class HCallConstantFunction V8_FINAL : public HCall<0> {
2130 public: 2160 public:
2131 HCallConstantFunction(Handle<JSFunction> function, int argument_count) 2161 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction,
2132 : HCall<0>(argument_count), 2162 Handle<JSFunction>,
2133 function_(function), 2163 int);
2134 formal_parameter_count_(function->shared()->formal_parameter_count()) {}
2135 2164
2136 Handle<JSFunction> function() const { return function_; } 2165 Handle<JSFunction> function() const { return function_; }
2137 int formal_parameter_count() const { return formal_parameter_count_; } 2166 int formal_parameter_count() const { return formal_parameter_count_; }
2138 2167
2139 bool IsApplyFunction() const { 2168 bool IsApplyFunction() const {
2140 return function_->code() == 2169 return function_->code() ==
2141 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); 2170 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply);
2142 } 2171 }
2143 2172
2144 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2173 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2145 2174
2146 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2175 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2147 return Representation::None(); 2176 return Representation::None();
2148 } 2177 }
2149 2178
2150 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) 2179 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction)
2151 2180
2152 private: 2181 private:
2182 HCallConstantFunction(Handle<JSFunction> function, int argument_count)
2183 : HCall<0>(argument_count),
2184 function_(function),
2185 formal_parameter_count_(function->shared()->formal_parameter_count()) {}
2186
2153 Handle<JSFunction> function_; 2187 Handle<JSFunction> function_;
2154 int formal_parameter_count_; 2188 int formal_parameter_count_;
2155 }; 2189 };
2156 2190
2157 2191
2158 class HCallKeyed V8_FINAL : public HBinaryCall { 2192 class HCallKeyed V8_FINAL : public HBinaryCall {
2159 public: 2193 public:
2160 HCallKeyed(HValue* context, HValue* key, int argument_count) 2194 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int);
2161 : HBinaryCall(context, key, argument_count) {
2162 }
2163 2195
2164 HValue* context() { return first(); } 2196 HValue* context() { return first(); }
2165 HValue* key() { return second(); } 2197 HValue* key() { return second(); }
2166 2198
2167 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) 2199 DECLARE_CONCRETE_INSTRUCTION(CallKeyed)
2200
2201 private:
2202 HCallKeyed(HValue* context, HValue* key, int argument_count)
2203 : HBinaryCall(context, key, argument_count) {
2204 }
2168 }; 2205 };
2169 2206
2170 2207
2171 class HCallNamed V8_FINAL : public HUnaryCall { 2208 class HCallNamed V8_FINAL : public HUnaryCall {
2172 public: 2209 public:
2173 HCallNamed(HValue* context, Handle<String> name, int argument_count) 2210 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int);
2174 : HUnaryCall(context, argument_count), name_(name) {
2175 }
2176 2211
2177 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2212 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2178 2213
2179 HValue* context() { return value(); } 2214 HValue* context() { return value(); }
2180 Handle<String> name() const { return name_; } 2215 Handle<String> name() const { return name_; }
2181 2216
2182 DECLARE_CONCRETE_INSTRUCTION(CallNamed) 2217 DECLARE_CONCRETE_INSTRUCTION(CallNamed)
2183 2218
2184 private: 2219 private:
2220 HCallNamed(HValue* context, Handle<String> name, int argument_count)
2221 : HUnaryCall(context, argument_count), name_(name) {
2222 }
2223
2185 Handle<String> name_; 2224 Handle<String> name_;
2186 }; 2225 };
2187 2226
2188 2227
2189 class HCallFunction V8_FINAL : public HBinaryCall { 2228 class HCallFunction V8_FINAL : public HBinaryCall {
2190 public: 2229 public:
2191 HCallFunction(HValue* context, HValue* function, int argument_count) 2230 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 2231
2202 HValue* context() { return first(); } 2232 HValue* context() { return first(); }
2203 HValue* function() { return second(); } 2233 HValue* function() { return second(); }
2204 2234
2205 DECLARE_CONCRETE_INSTRUCTION(CallFunction) 2235 DECLARE_CONCRETE_INSTRUCTION(CallFunction)
2236
2237 private:
2238 HCallFunction(HValue* context, HValue* function, int argument_count)
2239 : HBinaryCall(context, function, argument_count) {
2240 }
2206 }; 2241 };
2207 2242
2208 2243
2209 class HCallGlobal V8_FINAL : public HUnaryCall { 2244 class HCallGlobal V8_FINAL : public HUnaryCall {
2210 public: 2245 public:
2211 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 2246 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 2247
2222 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2248 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2223 2249
2224 HValue* context() { return value(); } 2250 HValue* context() { return value(); }
2225 Handle<String> name() const { return name_; } 2251 Handle<String> name() const { return name_; }
2226 2252
2227 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) 2253 DECLARE_CONCRETE_INSTRUCTION(CallGlobal)
2228 2254
2229 private: 2255 private:
2256 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
2257 : HUnaryCall(context, argument_count), name_(name) {
2258 }
2259
2230 Handle<String> name_; 2260 Handle<String> name_;
2231 }; 2261 };
2232 2262
2233 2263
2234 class HCallKnownGlobal V8_FINAL : public HCall<0> { 2264 class HCallKnownGlobal V8_FINAL : public HCall<0> {
2235 public: 2265 public:
2236 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 2266 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
2237 : HCall<0>(argument_count), 2267 : HCall<0>(argument_count),
2238 target_(target), 2268 target_(target),
2239 formal_parameter_count_(target->shared()->formal_parameter_count()) { } 2269 formal_parameter_count_(target->shared()->formal_parameter_count()) { }
(...skipping 10 matching lines...) Expand all
2250 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) 2280 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
2251 2281
2252 private: 2282 private:
2253 Handle<JSFunction> target_; 2283 Handle<JSFunction> target_;
2254 int formal_parameter_count_; 2284 int formal_parameter_count_;
2255 }; 2285 };
2256 2286
2257 2287
2258 class HCallNew V8_FINAL : public HBinaryCall { 2288 class HCallNew V8_FINAL : public HBinaryCall {
2259 public: 2289 public:
2260 HCallNew(HValue* context, HValue* constructor, int argument_count) 2290 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2261 : HBinaryCall(context, constructor, argument_count) {}
2262 2291
2263 HValue* context() { return first(); } 2292 HValue* context() { return first(); }
2264 HValue* constructor() { return second(); } 2293 HValue* constructor() { return second(); }
2265 2294
2266 DECLARE_CONCRETE_INSTRUCTION(CallNew) 2295 DECLARE_CONCRETE_INSTRUCTION(CallNew)
2296
2297 private:
2298 HCallNew(HValue* context, HValue* constructor, int argument_count)
2299 : HBinaryCall(context, constructor, argument_count) {}
2267 }; 2300 };
2268 2301
2269 2302
2270 class HCallNewArray V8_FINAL : public HBinaryCall { 2303 class HCallNewArray V8_FINAL : public HBinaryCall {
2271 public: 2304 public:
2272 HCallNewArray(HValue* context, HValue* constructor, int argument_count, 2305 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray,
2273 Handle<Cell> type_cell, ElementsKind elements_kind) 2306 HValue*,
2274 : HBinaryCall(context, constructor, argument_count), 2307 int,
2275 elements_kind_(elements_kind), 2308 Handle<Cell>,
2276 type_cell_(type_cell) {} 2309 ElementsKind);
2277 2310
2278 HValue* context() { return first(); } 2311 HValue* context() { return first(); }
2279 HValue* constructor() { return second(); } 2312 HValue* constructor() { return second(); }
2280 2313
2281 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2314 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2282 2315
2283 Handle<Cell> property_cell() const { 2316 Handle<Cell> property_cell() const {
2284 return type_cell_; 2317 return type_cell_;
2285 } 2318 }
2286 2319
2287 ElementsKind elements_kind() const { return elements_kind_; } 2320 ElementsKind elements_kind() const { return elements_kind_; }
2288 2321
2289 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) 2322 DECLARE_CONCRETE_INSTRUCTION(CallNewArray)
2290 2323
2291 private: 2324 private:
2325 HCallNewArray(HValue* context, HValue* constructor, int argument_count,
2326 Handle<Cell> type_cell, ElementsKind elements_kind)
2327 : HBinaryCall(context, constructor, argument_count),
2328 elements_kind_(elements_kind),
2329 type_cell_(type_cell) {}
2330
2292 ElementsKind elements_kind_; 2331 ElementsKind elements_kind_;
2293 Handle<Cell> type_cell_; 2332 Handle<Cell> type_cell_;
2294 }; 2333 };
2295 2334
2296 2335
2297 class HCallRuntime V8_FINAL : public HCall<1> { 2336 class HCallRuntime V8_FINAL : public HCall<1> {
2298 public: 2337 public:
2299 static HCallRuntime* New(Zone* zone, 2338 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime,
2300 HValue* context, 2339 Handle<String>,
2301 Handle<String> name, 2340 const Runtime::Function*,
2302 const Runtime::Function* c_function, 2341 int);
2303 int argument_count) {
2304 return new(zone) HCallRuntime(context, name, c_function, argument_count);
2305 }
2306 2342
2307 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2343 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2308 2344
2309 HValue* context() { return OperandAt(0); } 2345 HValue* context() { return OperandAt(0); }
2310 const Runtime::Function* function() const { return c_function_; } 2346 const Runtime::Function* function() const { return c_function_; }
2311 Handle<String> name() const { return name_; } 2347 Handle<String> name() const { return name_; }
2312 2348
2313 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2349 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2314 return Representation::Tagged(); 2350 return Representation::Tagged();
2315 } 2351 }
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 HValue* context, 3291 HValue* context,
3256 int32_t value, 3292 int32_t value,
3257 Representation representation, 3293 Representation representation,
3258 HInstruction* instruction) { 3294 HInstruction* instruction) {
3259 HConstant* new_constant = 3295 HConstant* new_constant =
3260 HConstant::New(zone, context, value, representation); 3296 HConstant::New(zone, context, value, representation);
3261 new_constant->InsertBefore(instruction); 3297 new_constant->InsertBefore(instruction);
3262 return new_constant; 3298 return new_constant;
3263 } 3299 }
3264 3300
3301 static HConstant* CreateAndInsertBefore(Zone* zone,
3302 Unique<Object> unique,
3303 bool is_not_in_new_space,
3304 HInstruction* instruction) {
3305 HConstant* new_constant = new(zone) HConstant(unique,
3306 Representation::Tagged(), HType::Tagged(), false, is_not_in_new_space,
3307 false, false);
3308 new_constant->InsertBefore(instruction);
3309 return new_constant;
3310 }
3311
3265 Handle<Object> handle(Isolate* isolate) { 3312 Handle<Object> handle(Isolate* isolate) {
3266 if (object_.handle().is_null()) { 3313 if (object_.handle().is_null()) {
3267 // Default arguments to is_not_in_new_space depend on this heap number 3314 // Default arguments to is_not_in_new_space depend on this heap number
3268 // to be tenured so that it's guaranteed not to be located in new space. 3315 // to be tenured so that it's guaranteed not to be located in new space.
3269 object_ = Unique<Object>::CreateUninitialized( 3316 object_ = Unique<Object>::CreateUninitialized(
3270 isolate->factory()->NewNumber(double_value_, TENURED)); 3317 isolate->factory()->NewNumber(double_value_, TENURED));
3271 } 3318 }
3272 AllowDeferredHandleDereference smi_check; 3319 AllowDeferredHandleDereference smi_check;
3273 ASSERT(has_int32_value_ || !object_.handle()->IsSmi()); 3320 ASSERT(has_int32_value_ || !object_.handle()->IsSmi());
3274 return object_.handle(); 3321 return object_.handle();
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 3917
3871 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 3918 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
3872 3919
3873 private: 3920 private:
3874 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3921 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3875 }; 3922 };
3876 3923
3877 3924
3878 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { 3925 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation {
3879 public: 3926 public:
3880 static HMathFloorOfDiv* New(Zone* zone, 3927 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv,
3881 HValue* context, 3928 HValue*,
3882 HValue* left, 3929 HValue*);
3883 HValue* right) {
3884 return new(zone) HMathFloorOfDiv(context, left, right);
3885 }
3886 3930
3887 virtual HValue* EnsureAndPropagateNotMinusZero( 3931 virtual HValue* EnsureAndPropagateNotMinusZero(
3888 BitVector* visited) V8_OVERRIDE; 3932 BitVector* visited) V8_OVERRIDE;
3889 3933
3890 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) 3934 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
3891 3935
3892 protected: 3936 protected:
3893 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3937 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3894 3938
3895 private: 3939 private:
(...skipping 25 matching lines...) Expand all
3921 if (to.IsTagged()) { 3965 if (to.IsTagged()) {
3922 SetAllSideEffects(); 3966 SetAllSideEffects();
3923 ClearFlag(kUseGVN); 3967 ClearFlag(kUseGVN);
3924 } else { 3968 } else {
3925 ClearAllSideEffects(); 3969 ClearAllSideEffects();
3926 SetFlag(kUseGVN); 3970 SetFlag(kUseGVN);
3927 } 3971 }
3928 } 3972 }
3929 3973
3930 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 3974 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
3931
3932 private: 3975 private:
3933 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3976 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3934 }; 3977 };
3935 3978
3936 3979
3937 class HCompareGeneric V8_FINAL : public HBinaryOperation { 3980 class HCompareGeneric V8_FINAL : public HBinaryOperation {
3938 public: 3981 public:
3939 HCompareGeneric(HValue* context, 3982 HCompareGeneric(HValue* context,
3940 HValue* left, 3983 HValue* left,
3941 HValue* right, 3984 HValue* right,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 private: 4195 private:
4153 HIsUndetectableAndBranch(HValue* value, 4196 HIsUndetectableAndBranch(HValue* value,
4154 HBasicBlock* true_target = NULL, 4197 HBasicBlock* true_target = NULL,
4155 HBasicBlock* false_target = NULL) 4198 HBasicBlock* false_target = NULL)
4156 : HUnaryControlInstruction(value, true_target, false_target) {} 4199 : HUnaryControlInstruction(value, true_target, false_target) {}
4157 }; 4200 };
4158 4201
4159 4202
4160 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { 4203 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> {
4161 public: 4204 public:
4162 HStringCompareAndBranch(HValue* context, 4205 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch,
4163 HValue* left, 4206 HValue*,
4164 HValue* right, 4207 HValue*,
4165 Token::Value token) 4208 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 4209
4175 HValue* context() { return OperandAt(0); } 4210 HValue* context() { return OperandAt(0); }
4176 HValue* left() { return OperandAt(1); } 4211 HValue* left() { return OperandAt(1); }
4177 HValue* right() { return OperandAt(2); } 4212 HValue* right() { return OperandAt(2); }
4178 Token::Value token() const { return token_; } 4213 Token::Value token() const { return token_; }
4179 4214
4180 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4215 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4181 4216
4182 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4217 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4183 return Representation::Tagged(); 4218 return Representation::Tagged();
4184 } 4219 }
4185 4220
4186 Representation GetInputRepresentation() const { 4221 Representation GetInputRepresentation() const {
4187 return Representation::Tagged(); 4222 return Representation::Tagged();
4188 } 4223 }
4189 4224
4190 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) 4225 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch)
4191 4226
4192 private: 4227 private:
4228 HStringCompareAndBranch(HValue* context,
4229 HValue* left,
4230 HValue* right,
4231 Token::Value token)
4232 : token_(token) {
4233 ASSERT(Token::IsCompareOp(token));
4234 SetOperandAt(0, context);
4235 SetOperandAt(1, left);
4236 SetOperandAt(2, right);
4237 set_representation(Representation::Tagged());
4238 SetGVNFlag(kChangesNewSpacePromotion);
4239 }
4240
4193 Token::Value token_; 4241 Token::Value token_;
4194 }; 4242 };
4195 4243
4196 4244
4197 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4245 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4198 public: 4246 public:
4199 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4247 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4200 return Representation::None(); 4248 return Representation::None();
4201 } 4249 }
4202 4250
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4318 } 4366 }
4319 4367
4320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4368 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4321 4369
4322 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 4370 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
4323 }; 4371 };
4324 4372
4325 4373
4326 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { 4374 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> {
4327 public: 4375 public:
4328 HInstanceOfKnownGlobal(HValue* context, 4376 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal,
4329 HValue* left, 4377 HValue*,
4330 Handle<JSFunction> right) 4378 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 4379
4338 HValue* context() { return OperandAt(0); } 4380 HValue* context() { return OperandAt(0); }
4339 HValue* left() { return OperandAt(1); } 4381 HValue* left() { return OperandAt(1); }
4340 Handle<JSFunction> function() { return function_; } 4382 Handle<JSFunction> function() { return function_; }
4341 4383
4342 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4384 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4343 return Representation::Tagged(); 4385 return Representation::Tagged();
4344 } 4386 }
4345 4387
4346 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 4388 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
4347 4389
4348 private: 4390 private:
4391 HInstanceOfKnownGlobal(HValue* context,
4392 HValue* left,
4393 Handle<JSFunction> right)
4394 : HTemplateInstruction<2>(HType::Boolean()), function_(right) {
4395 SetOperandAt(0, context);
4396 SetOperandAt(1, left);
4397 set_representation(Representation::Tagged());
4398 SetAllSideEffects();
4399 }
4400
4349 Handle<JSFunction> function_; 4401 Handle<JSFunction> function_;
4350 }; 4402 };
4351 4403
4352 4404
4353 // TODO(mstarzinger): This instruction should be modeled as a load of the map 4405 // 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 4406 // field followed by a load of the instance size field once HLoadNamedField is
4355 // flexible enough to accommodate byte-field loads. 4407 // flexible enough to accommodate byte-field loads.
4356 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> { 4408 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> {
4357 public: 4409 public:
4358 explicit HInstanceSize(HValue* object) { 4410 explicit HInstanceSize(HValue* object) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 virtual bool IsCommutative() const V8_OVERRIDE { 4596 virtual bool IsCommutative() const V8_OVERRIDE {
4545 return !representation().IsTagged(); 4597 return !representation().IsTagged();
4546 } 4598 }
4547 4599
4548 virtual void UpdateRepresentation(Representation new_rep, 4600 virtual void UpdateRepresentation(Representation new_rep,
4549 HInferRepresentationPhase* h_infer, 4601 HInferRepresentationPhase* h_infer,
4550 const char* reason) V8_OVERRIDE { 4602 const char* reason) V8_OVERRIDE {
4551 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4603 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4552 } 4604 }
4553 4605
4606 bool MulMinusOne();
4607
4554 DECLARE_CONCRETE_INSTRUCTION(Mul) 4608 DECLARE_CONCRETE_INSTRUCTION(Mul)
4555 4609
4556 protected: 4610 protected:
4557 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4611 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4558 4612
4559 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4613 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4560 4614
4561 private: 4615 private:
4562 HMul(HValue* context, HValue* left, HValue* right) 4616 HMul(HValue* context, HValue* left, HValue* right)
4563 : HArithmeticBinaryOperation(context, left, right) { 4617 : HArithmeticBinaryOperation(context, left, right) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4975 set_representation(r); 5029 set_representation(r);
4976 } 5030 }
4977 5031
4978 unsigned index_; 5032 unsigned index_;
4979 ParameterKind kind_; 5033 ParameterKind kind_;
4980 }; 5034 };
4981 5035
4982 5036
4983 class HCallStub V8_FINAL : public HUnaryCall { 5037 class HCallStub V8_FINAL : public HUnaryCall {
4984 public: 5038 public:
4985 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 5039 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_; } 5040 CodeStub::Major major_key() { return major_key_; }
4992 5041
4993 HValue* context() { return value(); } 5042 HValue* context() { return value(); }
4994 5043
4995 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 5044 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
4996 transcendental_type_ = transcendental_type; 5045 transcendental_type_ = transcendental_type;
4997 } 5046 }
4998 TranscendentalCache::Type transcendental_type() { 5047 TranscendentalCache::Type transcendental_type() {
4999 return transcendental_type_; 5048 return transcendental_type_;
5000 } 5049 }
5001 5050
5002 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5051 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5003 5052
5004 DECLARE_CONCRETE_INSTRUCTION(CallStub) 5053 DECLARE_CONCRETE_INSTRUCTION(CallStub)
5005 5054
5006 private: 5055 private:
5056 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
5057 : HUnaryCall(context, argument_count),
5058 major_key_(major_key),
5059 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
5060 }
5061
5007 CodeStub::Major major_key_; 5062 CodeStub::Major major_key_;
5008 TranscendentalCache::Type transcendental_type_; 5063 TranscendentalCache::Type transcendental_type_;
5009 }; 5064 };
5010 5065
5011 5066
5012 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { 5067 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> {
5013 public: 5068 public:
5014 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); 5069 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int);
5015 5070
5016 virtual void PrintDataTo(StringStream* stream); 5071 virtual void PrintDataTo(StringStream* stream);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
5619 5674
5620 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { 5675 static HObjectAccess ForArrayLength(ElementsKind elements_kind) {
5621 return HObjectAccess( 5676 return HObjectAccess(
5622 kArrayLengths, 5677 kArrayLengths,
5623 JSArray::kLengthOffset, 5678 JSArray::kLengthOffset,
5624 IsFastElementsKind(elements_kind) && 5679 IsFastElementsKind(elements_kind) &&
5625 FLAG_track_fields 5680 FLAG_track_fields
5626 ? Representation::Smi() : Representation::Tagged()); 5681 ? Representation::Smi() : Representation::Tagged());
5627 } 5682 }
5628 5683
5629 static HObjectAccess ForTypedArrayLength() {
5630 return HObjectAccess(
5631 kInobject,
5632 JSTypedArray::kLengthOffset,
5633 Representation::Tagged());
5634 }
5635
5636 static HObjectAccess ForAllocationSiteTransitionInfo() { 5684 static HObjectAccess ForAllocationSiteTransitionInfo() {
5637 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); 5685 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
5638 } 5686 }
5639 5687
5640 static HObjectAccess ForAllocationSiteNestedSite() { 5688 static HObjectAccess ForAllocationSiteNestedSite() {
5641 return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset); 5689 return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
5642 } 5690 }
5643 5691
5644 static HObjectAccess ForAllocationSiteDependentCode() { 5692 static HObjectAccess ForAllocationSiteDependentCode() {
5645 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset); 5693 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
6538 virtual bool IsDeletable() const V8_OVERRIDE { 6586 virtual bool IsDeletable() const V8_OVERRIDE {
6539 return flags_ == STRING_ADD_CHECK_NONE; 6587 return flags_ == STRING_ADD_CHECK_NONE;
6540 } 6588 }
6541 6589
6542 const StringAddFlags flags_; 6590 const StringAddFlags flags_;
6543 }; 6591 };
6544 6592
6545 6593
6546 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 6594 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
6547 public: 6595 public:
6548 static HStringCharCodeAt* New(Zone* zone, 6596 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
6549 HValue* context, 6597 HValue*,
6550 HValue* string, 6598 HValue*);
6551 HValue* index) {
6552 return new(zone) HStringCharCodeAt(context, string, index);
6553 }
6554 6599
6555 virtual Representation RequiredInputRepresentation(int index) { 6600 virtual Representation RequiredInputRepresentation(int index) {
6556 // The index is supposed to be Integer32. 6601 // The index is supposed to be Integer32.
6557 return index == 2 6602 return index == 2
6558 ? Representation::Integer32() 6603 ? Representation::Integer32()
6559 : Representation::Tagged(); 6604 : Representation::Tagged();
6560 } 6605 }
6561 6606
6562 HValue* context() const { return OperandAt(0); } 6607 HValue* context() const { return OperandAt(0); }
6563 HValue* string() const { return OperandAt(1); } 6608 HValue* string() const { return OperandAt(1); }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } 6692 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; }
6648 6693
6649 int literal_index_; 6694 int literal_index_;
6650 int depth_; 6695 int depth_;
6651 AllocationSiteMode allocation_site_mode_; 6696 AllocationSiteMode allocation_site_mode_;
6652 }; 6697 };
6653 6698
6654 6699
6655 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> { 6700 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> {
6656 public: 6701 public:
6702 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral,
6703 Handle<FixedArray>,
6704 Handle<String>,
6705 Handle<String>,
6706 int);
6707
6708 HValue* context() { return OperandAt(0); }
6709 Handle<FixedArray> literals() { return literals_; }
6710 Handle<String> pattern() { return pattern_; }
6711 Handle<String> flags() { return flags_; }
6712
6713 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6714 return Representation::Tagged();
6715 }
6716
6717 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
6718
6719 private:
6657 HRegExpLiteral(HValue* context, 6720 HRegExpLiteral(HValue* context,
6658 Handle<FixedArray> literals, 6721 Handle<FixedArray> literals,
6659 Handle<String> pattern, 6722 Handle<String> pattern,
6660 Handle<String> flags, 6723 Handle<String> flags,
6661 int literal_index) 6724 int literal_index)
6662 : HMaterializedLiteral<1>(literal_index, 0), 6725 : HMaterializedLiteral<1>(literal_index, 0),
6663 literals_(literals), 6726 literals_(literals),
6664 pattern_(pattern), 6727 pattern_(pattern),
6665 flags_(flags) { 6728 flags_(flags) {
6666 SetOperandAt(0, context); 6729 SetOperandAt(0, context);
6667 SetAllSideEffects(); 6730 SetAllSideEffects();
6668 set_type(HType::JSObject()); 6731 set_type(HType::JSObject());
6669 } 6732 }
6670 6733
6671 HValue* context() { return OperandAt(0); }
6672 Handle<FixedArray> literals() { return literals_; }
6673 Handle<String> pattern() { return pattern_; }
6674 Handle<String> flags() { return flags_; }
6675
6676 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6677 return Representation::Tagged();
6678 }
6679
6680 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
6681
6682 private:
6683 Handle<FixedArray> literals_; 6734 Handle<FixedArray> literals_;
6684 Handle<String> pattern_; 6735 Handle<String> pattern_;
6685 Handle<String> flags_; 6736 Handle<String> flags_;
6686 }; 6737 };
6687 6738
6688 6739
6689 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> { 6740 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> {
6690 public: 6741 public:
6691 HFunctionLiteral(HValue* context, 6742 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral,
6692 Handle<SharedFunctionInfo> shared, 6743 Handle<SharedFunctionInfo>,
6693 bool pretenure) 6744 bool);
6694 : HTemplateInstruction<1>(HType::JSObject()),
6695 shared_info_(shared),
6696 pretenure_(pretenure),
6697 has_no_literals_(shared->num_literals() == 0),
6698 is_generator_(shared->is_generator()),
6699 language_mode_(shared->language_mode()) {
6700 SetOperandAt(0, context);
6701 set_representation(Representation::Tagged());
6702 SetGVNFlag(kChangesNewSpacePromotion);
6703 }
6704
6705 HValue* context() { return OperandAt(0); } 6745 HValue* context() { return OperandAt(0); }
6706 6746
6707 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6747 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6708 return Representation::Tagged(); 6748 return Representation::Tagged();
6709 } 6749 }
6710 6750
6711 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 6751 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
6712 6752
6713 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 6753 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
6714 bool pretenure() const { return pretenure_; } 6754 bool pretenure() const { return pretenure_; }
6715 bool has_no_literals() const { return has_no_literals_; } 6755 bool has_no_literals() const { return has_no_literals_; }
6716 bool is_generator() const { return is_generator_; } 6756 bool is_generator() const { return is_generator_; }
6717 LanguageMode language_mode() const { return language_mode_; } 6757 LanguageMode language_mode() const { return language_mode_; }
6718 6758
6719 private: 6759 private:
6760 HFunctionLiteral(HValue* context,
6761 Handle<SharedFunctionInfo> shared,
6762 bool pretenure)
6763 : HTemplateInstruction<1>(HType::JSObject()),
6764 shared_info_(shared),
6765 pretenure_(pretenure),
6766 has_no_literals_(shared->num_literals() == 0),
6767 is_generator_(shared->is_generator()),
6768 language_mode_(shared->language_mode()) {
6769 SetOperandAt(0, context);
6770 set_representation(Representation::Tagged());
6771 SetGVNFlag(kChangesNewSpacePromotion);
6772 }
6773
6720 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6774 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6721 6775
6722 Handle<SharedFunctionInfo> shared_info_; 6776 Handle<SharedFunctionInfo> shared_info_;
6723 bool pretenure_ : 1; 6777 bool pretenure_ : 1;
6724 bool has_no_literals_ : 1; 6778 bool has_no_literals_ : 1;
6725 bool is_generator_ : 1; 6779 bool is_generator_ : 1;
6726 LanguageMode language_mode_; 6780 LanguageMode language_mode_;
6727 }; 6781 };
6728 6782
6729 6783
6730 class HTypeof V8_FINAL : public HTemplateInstruction<2> { 6784 class HTypeof V8_FINAL : public HTemplateInstruction<2> {
6731 public: 6785 public:
6732 explicit HTypeof(HValue* context, HValue* value) { 6786 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
6733 SetOperandAt(0, context);
6734 SetOperandAt(1, value);
6735 set_representation(Representation::Tagged());
6736 }
6737 6787
6738 HValue* context() { return OperandAt(0); } 6788 HValue* context() { return OperandAt(0); }
6739 HValue* value() { return OperandAt(1); } 6789 HValue* value() { return OperandAt(1); }
6740 6790
6741 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6791 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6742 6792
6743 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6793 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6744 return Representation::Tagged(); 6794 return Representation::Tagged();
6745 } 6795 }
6746 6796
6747 DECLARE_CONCRETE_INSTRUCTION(Typeof) 6797 DECLARE_CONCRETE_INSTRUCTION(Typeof)
6748 6798
6749 private: 6799 private:
6800 explicit HTypeof(HValue* context, HValue* value) {
6801 SetOperandAt(0, context);
6802 SetOperandAt(1, value);
6803 set_representation(Representation::Tagged());
6804 }
6805
6750 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6806 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6751 }; 6807 };
6752 6808
6753 6809
6754 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> { 6810 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> {
6755 public: 6811 public:
6756 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); 6812 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*);
6757 6813
6758 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6814 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6759 return Representation::Tagged(); 6815 return Representation::Tagged();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
6897 set_representation(Representation::Tagged()); 6953 set_representation(Representation::Tagged());
6898 SetFlag(kUseGVN); 6954 SetFlag(kUseGVN);
6899 SetGVNFlag(kDependsOnMaps); 6955 SetGVNFlag(kDependsOnMaps);
6900 SetGVNFlag(kDependsOnElementsKind); 6956 SetGVNFlag(kDependsOnElementsKind);
6901 } 6957 }
6902 }; 6958 };
6903 6959
6904 6960
6905 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { 6961 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> {
6906 public: 6962 public:
6907 static HForInPrepareMap* New(Zone* zone, 6963 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*);
6908 HValue* context,
6909 HValue* object) {
6910 return new(zone) HForInPrepareMap(context, object);
6911 }
6912 6964
6913 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6965 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6914 return Representation::Tagged(); 6966 return Representation::Tagged();
6915 } 6967 }
6916 6968
6917 HValue* context() { return OperandAt(0); } 6969 HValue* context() { return OperandAt(0); }
6918 HValue* enumerable() { return OperandAt(1); } 6970 HValue* enumerable() { return OperandAt(1); }
6919 6971
6920 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6972 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6921 6973
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
7006 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7058 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7007 }; 7059 };
7008 7060
7009 7061
7010 #undef DECLARE_INSTRUCTION 7062 #undef DECLARE_INSTRUCTION
7011 #undef DECLARE_CONCRETE_INSTRUCTION 7063 #undef DECLARE_CONCRETE_INSTRUCTION
7012 7064
7013 } } // namespace v8::internal 7065 } } // namespace v8::internal
7014 7066
7015 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7067 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698