Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 // | 106 // |
| 107 // It captures the following properties: | 107 // It captures the following properties: |
| 108 // - whether value can potentially be null or it is definitely not null; | 108 // - whether value can potentially be null or it is definitely not null; |
| 109 // - concrete class id of the value or kDynamicCid if unknown statically; | 109 // - concrete class id of the value or kDynamicCid if unknown statically; |
| 110 // - abstract super type of the value, concrete type of the value in runtime | 110 // - abstract super type of the value, concrete type of the value in runtime |
| 111 // is guaranteed to be sub type of this type. | 111 // is guaranteed to be sub type of this type. |
| 112 // | 112 // |
| 113 // Values of CompileType form a lattice with a None type as a bottom and a | 113 // Values of CompileType form a lattice with a None type as a bottom and a |
| 114 // nullable Dynamic type as a top element. Method Union provides a join | 114 // nullable Dynamic type as a top element. Method Union provides a join |
| 115 // operation for the lattice. | 115 // operation for the lattice. |
| 116 class CompileType : public ZoneAllocated { | 116 class CompileType { |
|
srdjan
2013/02/22 21:01:41
This should be subclass of ValueObject?
Vyacheslav Egorov (Google)
2013/02/22 22:22:33
I can make it, but our ValueObject is a strange be
| |
| 117 public: | 117 public: |
| 118 static const bool kNullable = true; | 118 static const bool kNullable = true; |
| 119 static const bool kNonNullable = false; | 119 static const bool kNonNullable = false; |
| 120 | 120 |
| 121 // Return type such that concrete value's type in runtime is guaranteed to | 121 // Return type such that concrete value's type in runtime is guaranteed to |
| 122 // be subtype of it. | 122 // be subtype of it. |
| 123 const AbstractType* ToAbstractType(); | 123 const AbstractType* ToAbstractType(); |
| 124 | 124 |
| 125 // Return class id such that it is either kDynamicCid or in runtime | 125 // Return class id such that it is either kDynamicCid or in runtime |
| 126 // value is guaranteed to have an equal class id. | 126 // value is guaranteed to have an equal class id. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 143 // Returns true if value of this type is assignable to a location of the | 143 // Returns true if value of this type is assignable to a location of the |
| 144 // given type. | 144 // given type. |
| 145 bool IsAssignableTo(const AbstractType& type) { | 145 bool IsAssignableTo(const AbstractType& type) { |
| 146 bool is_instance; | 146 bool is_instance; |
| 147 return CanComputeIsInstanceOf(type, kNullable, &is_instance) && | 147 return CanComputeIsInstanceOf(type, kNullable, &is_instance) && |
| 148 is_instance; | 148 is_instance; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Create a new CompileType representing given combination of class id and | 151 // Create a new CompileType representing given combination of class id and |
| 152 // abstract type. The pair is assumed to be coherent. | 152 // abstract type. The pair is assumed to be coherent. |
| 153 static CompileType* New(intptr_t cid, const AbstractType& type); | 153 static CompileType Create(intptr_t cid, const AbstractType& type); |
| 154 | 154 |
| 155 // Create a new CompileType representing given abstract type. By default | 155 // Create a new CompileType representing given abstract type. By default |
| 156 // values as assumed to be nullable. | 156 // values as assumed to be nullable. |
| 157 static CompileType* FromAbstractType(const AbstractType& type, | 157 static CompileType FromAbstractType(const AbstractType& type, |
| 158 bool is_nullable = kNullable); | 158 bool is_nullable = kNullable); |
| 159 | 159 |
| 160 // Create a new CompileType representing an value with the given class id. | 160 // Create a new CompileType representing an value with the given class id. |
| 161 // Resulting CompileType is nullable only if cid is kDynamicCid or kNullCid. | 161 // Resulting CompileType is nullable only if cid is kDynamicCid or kNullCid. |
| 162 static CompileType* FromCid(intptr_t cid); | 162 static CompileType FromCid(intptr_t cid); |
| 163 | 163 |
| 164 // Create None CompileType. It is the bottom of the lattice and is used to | 164 // Create None CompileType. It is the bottom of the lattice and is used to |
| 165 // represent type of the phi that was not yet inferred. | 165 // represent type of the phi that was not yet inferred. |
| 166 static CompileType* None() { | 166 static CompileType None() { |
| 167 return new CompileType(true, kIllegalCid, NULL); | 167 return CompileType(true, kIllegalCid, NULL); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Create Dynamic CompileType. It is the top of the lattice and is used to | 170 // Create Dynamic CompileType. It is the top of the lattice and is used to |
| 171 // represent unknown type. | 171 // represent unknown type. |
| 172 static CompileType* Dynamic(); | 172 static CompileType Dynamic(); |
| 173 | 173 |
| 174 static CompileType* Null(); | 174 static CompileType Null(); |
| 175 | 175 |
| 176 // Create non-nullable Bool type. | 176 // Create non-nullable Bool type. |
| 177 static CompileType* Bool(); | 177 static CompileType Bool(); |
| 178 | 178 |
| 179 // Create non-nullable Int type. | 179 // Create non-nullable Int type. |
| 180 static CompileType* Int(); | 180 static CompileType Int(); |
| 181 | 181 |
| 182 // Perform a join operation over the type lattice. | 182 // Perform a join operation over the type lattice. |
| 183 void Union(CompileType* other); | 183 void Union(CompileType* other); |
| 184 | 184 |
| 185 // Returns true if this and other types are the same. | 185 // Returns true if this and other types are the same. |
| 186 bool IsEqualTo(CompileType* other) { | 186 bool IsEqualTo(CompileType* other) { |
|
srdjan
2013/02/22 21:01:41
make const CompileType& other, since other may not
Vyacheslav Egorov (Google)
2013/02/22 22:22:33
It'd like to do this, but I can't because ToNullab
| |
| 187 return (is_nullable_ == other->is_nullable_) && | 187 return (is_nullable_ == other->is_nullable_) && |
| 188 (ToNullableCid() == other->ToNullableCid()) && | 188 (ToNullableCid() == other->ToNullableCid()) && |
| 189 (ToAbstractType()->Equals(*other->ToAbstractType())); | 189 (ToAbstractType()->Equals(*other->ToAbstractType())); |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Replaces this type with other. | |
| 193 void ReplaceWith(CompileType* other) { | |
| 194 is_nullable_ = other->is_nullable_; | |
| 195 cid_ = other->cid_; | |
| 196 type_ = other->type_; | |
| 197 } | |
| 198 | |
| 199 bool IsNone() const { | 192 bool IsNone() const { |
| 200 return (cid_ == kIllegalCid) && (type_ == NULL); | 193 return (cid_ == kIllegalCid) && (type_ == NULL); |
| 201 } | 194 } |
| 202 | 195 |
| 203 void PrintTo(BufferFormatter* f) const; | 196 void PrintTo(BufferFormatter* f) const; |
| 204 const char* ToCString() const; | 197 const char* ToCString() const; |
| 205 | 198 |
| 206 private: | 199 private: |
| 207 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) | 200 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) |
| 208 : is_nullable_(is_nullable), cid_(cid), type_(type) { } | 201 : is_nullable_(is_nullable), cid_(cid), type_(type) { } |
| 209 | 202 |
| 210 bool CanComputeIsInstanceOf(const AbstractType& type, | 203 bool CanComputeIsInstanceOf(const AbstractType& type, |
| 211 bool is_nullable, | 204 bool is_nullable, |
| 212 bool* is_instance); | 205 bool* is_instance); |
| 213 | 206 |
| 214 bool is_nullable_; | 207 bool is_nullable_; |
| 215 intptr_t cid_; | 208 intptr_t cid_; |
| 216 const AbstractType* type_; | 209 const AbstractType* type_; |
| 217 }; | 210 }; |
| 218 | 211 |
| 219 | 212 |
| 213 // Zone allocated wrapper for the CompileType value. | |
| 214 class ZoneCompileType : public ZoneAllocated { | |
| 215 public: | |
| 216 static CompileType* Wrap(const CompileType& type) { | |
| 217 ZoneCompileType* zone_type = new ZoneCompileType(type); | |
| 218 return &zone_type->type_; | |
| 219 } | |
| 220 | |
| 221 private: | |
| 222 explicit ZoneCompileType(const CompileType& type) : type_(type) { } | |
| 223 | |
| 224 CompileType type_; | |
| 225 }; | |
| 226 | |
| 227 | |
| 220 class Value : public ZoneAllocated { | 228 class Value : public ZoneAllocated { |
| 221 public: | 229 public: |
| 222 // A forward iterator that allows removing the current value from the | 230 // A forward iterator that allows removing the current value from the |
| 223 // underlying use list during iteration. | 231 // underlying use list during iteration. |
| 224 class Iterator { | 232 class Iterator { |
| 225 public: | 233 public: |
| 226 explicit Iterator(Value* head) : next_(head) { Advance(); } | 234 explicit Iterator(Value* head) : next_(head) { Advance(); } |
| 227 Value* Current() const { return current_; } | 235 Value* Current() const { return current_; } |
| 228 bool Done() const { return current_ == NULL; } | 236 bool Done() const { return current_ == NULL; } |
| 229 void Advance() { | 237 void Advance() { |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 | 1246 |
| 1239 // Compile time type of the definition, which may be requested before type | 1247 // Compile time type of the definition, which may be requested before type |
| 1240 // propagation during graph building. | 1248 // propagation during graph building. |
| 1241 CompileType* Type() { | 1249 CompileType* Type() { |
| 1242 if (type_ == NULL) { | 1250 if (type_ == NULL) { |
| 1243 type_ = ComputeInitialType(); | 1251 type_ = ComputeInitialType(); |
| 1244 } | 1252 } |
| 1245 return type_; | 1253 return type_; |
| 1246 } | 1254 } |
| 1247 | 1255 |
| 1248 // Compute initial compile type for this definition. It is safe to use this | 1256 virtual CompileType* ComputeInitialType() const { |
| 1257 return ZoneCompileType::Wrap(ComputeType()); | |
| 1258 } | |
| 1259 | |
| 1260 // Compute compile type for this definition. It is safe to use this | |
| 1249 // approximation even before type propagator was run (e.g. during graph | 1261 // approximation even before type propagator was run (e.g. during graph |
| 1250 // building). | 1262 // building). |
| 1251 virtual CompileType* ComputeInitialType() const { | 1263 virtual CompileType ComputeType() const { |
| 1252 return CompileType::Dynamic(); | 1264 return CompileType::Dynamic(); |
| 1253 } | 1265 } |
| 1254 | 1266 |
| 1255 // Update CompileType of the definition. Returns true if the type has changed. | 1267 // Update CompileType of the definition. Returns true if the type has changed. |
| 1256 virtual bool RecomputeType() { | 1268 virtual bool RecomputeType() { |
| 1257 return false; | 1269 return false; |
| 1258 } | 1270 } |
| 1259 | 1271 |
| 1272 bool UpdateType(CompileType new_type) { | |
| 1273 if (type_ == NULL) { | |
| 1274 type_ = ZoneCompileType::Wrap(new_type); | |
| 1275 return true; | |
| 1276 } | |
| 1277 | |
| 1278 if (type_->IsNone() || !type_->IsEqualTo(&new_type)) { | |
| 1279 *type_ = new_type; | |
| 1280 return true; | |
| 1281 } | |
| 1282 | |
| 1283 return false; | |
| 1284 } | |
| 1285 | |
| 1260 bool HasUses() const { | 1286 bool HasUses() const { |
| 1261 return (input_use_list_ != NULL) || (env_use_list_ != NULL); | 1287 return (input_use_list_ != NULL) || (env_use_list_ != NULL); |
| 1262 } | 1288 } |
| 1263 | 1289 |
| 1264 Value* input_use_list() const { return input_use_list_; } | 1290 Value* input_use_list() const { return input_use_list_; } |
| 1265 void set_input_use_list(Value* head) { input_use_list_ = head; } | 1291 void set_input_use_list(Value* head) { input_use_list_ = head; } |
| 1266 | 1292 |
| 1267 Value* env_use_list() const { return env_use_list_; } | 1293 Value* env_use_list() const { return env_use_list_; } |
| 1268 void set_env_use_list(Value* head) { env_use_list_ = head; } | 1294 void set_env_use_list(Value* head) { env_use_list_ = head; } |
| 1269 | 1295 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1349 reaching_defs_(NULL) { | 1375 reaching_defs_(NULL) { |
| 1350 for (intptr_t i = 0; i < num_inputs; ++i) { | 1376 for (intptr_t i = 0; i < num_inputs; ++i) { |
| 1351 inputs_.Add(NULL); | 1377 inputs_.Add(NULL); |
| 1352 } | 1378 } |
| 1353 } | 1379 } |
| 1354 | 1380 |
| 1355 // Get the block entry for that instruction. | 1381 // Get the block entry for that instruction. |
| 1356 virtual BlockEntryInstr* GetBlock() const { return block(); } | 1382 virtual BlockEntryInstr* GetBlock() const { return block(); } |
| 1357 JoinEntryInstr* block() const { return block_; } | 1383 JoinEntryInstr* block() const { return block_; } |
| 1358 | 1384 |
| 1359 virtual CompileType* ComputeInitialType() const; | 1385 virtual CompileType ComputeType() const; |
| 1360 virtual bool RecomputeType(); | 1386 virtual bool RecomputeType(); |
| 1361 | 1387 |
| 1362 virtual intptr_t ArgumentCount() const { return 0; } | 1388 virtual intptr_t ArgumentCount() const { return 0; } |
| 1363 | 1389 |
| 1364 intptr_t InputCount() const { return inputs_.length(); } | 1390 intptr_t InputCount() const { return inputs_.length(); } |
| 1365 | 1391 |
| 1366 Value* InputAt(intptr_t i) const { return inputs_[i]; } | 1392 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 1367 | 1393 |
| 1368 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 1394 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| 1369 | 1395 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1446 | 1472 |
| 1447 virtual bool HasSideEffect() const { return false; } | 1473 virtual bool HasSideEffect() const { return false; } |
| 1448 | 1474 |
| 1449 virtual intptr_t Hashcode() const { | 1475 virtual intptr_t Hashcode() const { |
| 1450 UNREACHABLE(); | 1476 UNREACHABLE(); |
| 1451 return 0; | 1477 return 0; |
| 1452 } | 1478 } |
| 1453 | 1479 |
| 1454 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1480 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1455 | 1481 |
| 1456 virtual CompileType* ComputeInitialType() const; | 1482 virtual CompileType ComputeType() const; |
| 1457 | 1483 |
| 1458 private: | 1484 private: |
| 1459 const intptr_t index_; | 1485 const intptr_t index_; |
| 1460 GraphEntryInstr* block_; | 1486 GraphEntryInstr* block_; |
| 1461 | 1487 |
| 1462 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 1488 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 1463 }; | 1489 }; |
| 1464 | 1490 |
| 1465 | 1491 |
| 1466 class PushArgumentInstr : public Definition { | 1492 class PushArgumentInstr : public Definition { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1477 ASSERT(i == 0); | 1503 ASSERT(i == 0); |
| 1478 return value_; | 1504 return value_; |
| 1479 } | 1505 } |
| 1480 void SetInputAt(intptr_t i, Value* value) { | 1506 void SetInputAt(intptr_t i, Value* value) { |
| 1481 ASSERT(i == 0); | 1507 ASSERT(i == 0); |
| 1482 value_ = value; | 1508 value_ = value; |
| 1483 } | 1509 } |
| 1484 | 1510 |
| 1485 virtual intptr_t ArgumentCount() const { return 0; } | 1511 virtual intptr_t ArgumentCount() const { return 0; } |
| 1486 | 1512 |
| 1487 virtual CompileType* ComputeInitialType() const; | 1513 virtual CompileType ComputeType() const; |
| 1488 | 1514 |
| 1489 Value* value() const { return value_; } | 1515 Value* value() const { return value_; } |
| 1490 | 1516 |
| 1491 virtual LocationSummary* locs() { | 1517 virtual LocationSummary* locs() { |
| 1492 if (locs_ == NULL) { | 1518 if (locs_ == NULL) { |
| 1493 locs_ = MakeLocationSummary(); | 1519 locs_ = MakeLocationSummary(); |
| 1494 } | 1520 } |
| 1495 return locs_; | 1521 return locs_; |
| 1496 } | 1522 } |
| 1497 | 1523 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1921 inputs_[0] = value; | 1947 inputs_[0] = value; |
| 1922 inputs_[1] = NULL; // Dependency. | 1948 inputs_[1] = NULL; // Dependency. |
| 1923 } | 1949 } |
| 1924 | 1950 |
| 1925 DECLARE_INSTRUCTION(Constraint) | 1951 DECLARE_INSTRUCTION(Constraint) |
| 1926 | 1952 |
| 1927 virtual intptr_t InputCount() const { | 1953 virtual intptr_t InputCount() const { |
| 1928 return (inputs_[1] == NULL) ? 1 : 2; | 1954 return (inputs_[1] == NULL) ? 1 : 2; |
| 1929 } | 1955 } |
| 1930 | 1956 |
| 1931 virtual CompileType* ComputeInitialType() const; | 1957 virtual CompileType ComputeType() const; |
| 1932 | 1958 |
| 1933 virtual bool CanDeoptimize() const { return false; } | 1959 virtual bool CanDeoptimize() const { return false; } |
| 1934 | 1960 |
| 1935 virtual bool HasSideEffect() const { return false; } | 1961 virtual bool HasSideEffect() const { return false; } |
| 1936 | 1962 |
| 1937 virtual bool AttributesEqual(Instruction* other) const { | 1963 virtual bool AttributesEqual(Instruction* other) const { |
| 1938 UNREACHABLE(); | 1964 UNREACHABLE(); |
| 1939 return false; | 1965 return false; |
| 1940 } | 1966 } |
| 1941 | 1967 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1968 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); | 1994 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); |
| 1969 }; | 1995 }; |
| 1970 | 1996 |
| 1971 | 1997 |
| 1972 class ConstantInstr : public TemplateDefinition<0> { | 1998 class ConstantInstr : public TemplateDefinition<0> { |
| 1973 public: | 1999 public: |
| 1974 explicit ConstantInstr(const Object& value) | 2000 explicit ConstantInstr(const Object& value) |
| 1975 : value_(value) { } | 2001 : value_(value) { } |
| 1976 | 2002 |
| 1977 DECLARE_INSTRUCTION(Constant) | 2003 DECLARE_INSTRUCTION(Constant) |
| 1978 virtual CompileType* ComputeInitialType() const; | 2004 virtual CompileType ComputeType() const; |
| 1979 | 2005 |
| 1980 const Object& value() const { return value_; } | 2006 const Object& value() const { return value_; } |
| 1981 | 2007 |
| 1982 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2008 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1983 | 2009 |
| 1984 virtual bool CanDeoptimize() const { return false; } | 2010 virtual bool CanDeoptimize() const { return false; } |
| 1985 | 2011 |
| 1986 virtual bool HasSideEffect() const { return false; } | 2012 virtual bool HasSideEffect() const { return false; } |
| 1987 | 2013 |
| 1988 virtual bool AttributesEqual(Instruction* other) const; | 2014 virtual bool AttributesEqual(Instruction* other) const; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2055 | 2081 |
| 2056 class AssertBooleanInstr : public TemplateDefinition<1> { | 2082 class AssertBooleanInstr : public TemplateDefinition<1> { |
| 2057 public: | 2083 public: |
| 2058 AssertBooleanInstr(intptr_t token_pos, Value* value) | 2084 AssertBooleanInstr(intptr_t token_pos, Value* value) |
| 2059 : token_pos_(token_pos) { | 2085 : token_pos_(token_pos) { |
| 2060 ASSERT(value != NULL); | 2086 ASSERT(value != NULL); |
| 2061 inputs_[0] = value; | 2087 inputs_[0] = value; |
| 2062 } | 2088 } |
| 2063 | 2089 |
| 2064 DECLARE_INSTRUCTION(AssertBoolean) | 2090 DECLARE_INSTRUCTION(AssertBoolean) |
| 2065 virtual CompileType* ComputeInitialType() const; | 2091 virtual CompileType ComputeType() const; |
| 2066 | 2092 |
| 2067 intptr_t token_pos() const { return token_pos_; } | 2093 intptr_t token_pos() const { return token_pos_; } |
| 2068 Value* value() const { return inputs_[0]; } | 2094 Value* value() const { return inputs_[0]; } |
| 2069 | 2095 |
| 2070 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2096 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2071 | 2097 |
| 2072 virtual bool CanDeoptimize() const { return true; } | 2098 virtual bool CanDeoptimize() const { return true; } |
| 2073 | 2099 |
| 2074 virtual bool HasSideEffect() const { return false; } | 2100 virtual bool HasSideEffect() const { return false; } |
| 2075 | 2101 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2088 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { | 2114 class ArgumentDefinitionTestInstr : public TemplateDefinition<1> { |
| 2089 public: | 2115 public: |
| 2090 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node, | 2116 ArgumentDefinitionTestInstr(ArgumentDefinitionTestNode* node, |
| 2091 Value* saved_arguments_descriptor) | 2117 Value* saved_arguments_descriptor) |
| 2092 : ast_node_(*node) { | 2118 : ast_node_(*node) { |
| 2093 ASSERT(saved_arguments_descriptor != NULL); | 2119 ASSERT(saved_arguments_descriptor != NULL); |
| 2094 inputs_[0] = saved_arguments_descriptor; | 2120 inputs_[0] = saved_arguments_descriptor; |
| 2095 } | 2121 } |
| 2096 | 2122 |
| 2097 DECLARE_INSTRUCTION(ArgumentDefinitionTest) | 2123 DECLARE_INSTRUCTION(ArgumentDefinitionTest) |
| 2098 virtual CompileType* ComputeInitialType() const; | 2124 virtual CompileType ComputeType() const; |
| 2099 | 2125 |
| 2100 intptr_t token_pos() const { return ast_node_.token_pos(); } | 2126 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 2101 intptr_t formal_parameter_index() const { | 2127 intptr_t formal_parameter_index() const { |
| 2102 return ast_node_.formal_parameter_index(); | 2128 return ast_node_.formal_parameter_index(); |
| 2103 } | 2129 } |
| 2104 const String& formal_parameter_name() const { | 2130 const String& formal_parameter_name() const { |
| 2105 return ast_node_.formal_parameter_name(); | 2131 return ast_node_.formal_parameter_name(); |
| 2106 } | 2132 } |
| 2107 | 2133 |
| 2108 Value* saved_arguments_descriptor() const { return inputs_[0]; } | 2134 Value* saved_arguments_descriptor() const { return inputs_[0]; } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2120 }; | 2146 }; |
| 2121 | 2147 |
| 2122 | 2148 |
| 2123 // Denotes the current context, normally held in a register. This is | 2149 // Denotes the current context, normally held in a register. This is |
| 2124 // a computation, not a value, because it's mutable. | 2150 // a computation, not a value, because it's mutable. |
| 2125 class CurrentContextInstr : public TemplateDefinition<0> { | 2151 class CurrentContextInstr : public TemplateDefinition<0> { |
| 2126 public: | 2152 public: |
| 2127 CurrentContextInstr() { } | 2153 CurrentContextInstr() { } |
| 2128 | 2154 |
| 2129 DECLARE_INSTRUCTION(CurrentContext) | 2155 DECLARE_INSTRUCTION(CurrentContext) |
| 2130 virtual CompileType* ComputeInitialType() const; | 2156 virtual CompileType ComputeType() const; |
| 2131 | 2157 |
| 2132 virtual bool CanDeoptimize() const { return false; } | 2158 virtual bool CanDeoptimize() const { return false; } |
| 2133 | 2159 |
| 2134 virtual bool HasSideEffect() const { return false; } | 2160 virtual bool HasSideEffect() const { return false; } |
| 2135 | 2161 |
| 2136 private: | 2162 private: |
| 2137 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 2163 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
| 2138 }; | 2164 }; |
| 2139 | 2165 |
| 2140 | 2166 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2357 intptr_t i) const { | 2383 intptr_t i) const { |
| 2358 return comparison()->RequiredInputRepresentation(i); | 2384 return comparison()->RequiredInputRepresentation(i); |
| 2359 } | 2385 } |
| 2360 | 2386 |
| 2361 | 2387 |
| 2362 class StrictCompareInstr : public ComparisonInstr { | 2388 class StrictCompareInstr : public ComparisonInstr { |
| 2363 public: | 2389 public: |
| 2364 StrictCompareInstr(Token::Kind kind, Value* left, Value* right); | 2390 StrictCompareInstr(Token::Kind kind, Value* left, Value* right); |
| 2365 | 2391 |
| 2366 DECLARE_INSTRUCTION(StrictCompare) | 2392 DECLARE_INSTRUCTION(StrictCompare) |
| 2367 virtual CompileType* ComputeInitialType() const; | 2393 virtual CompileType ComputeType() const; |
| 2368 | 2394 |
| 2369 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2395 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2370 | 2396 |
| 2371 virtual bool CanDeoptimize() const { return false; } | 2397 virtual bool CanDeoptimize() const { return false; } |
| 2372 | 2398 |
| 2373 virtual bool HasSideEffect() const { return false; } | 2399 virtual bool HasSideEffect() const { return false; } |
| 2374 | 2400 |
| 2375 virtual bool AttributesEqual(Instruction* other) const; | 2401 virtual bool AttributesEqual(Instruction* other) const; |
| 2376 virtual bool AffectedBySideEffect() const { return false; } | 2402 virtual bool AffectedBySideEffect() const { return false; } |
| 2377 | 2403 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2400 Value* right) | 2426 Value* right) |
| 2401 : ComparisonInstr(kind, left, right), | 2427 : ComparisonInstr(kind, left, right), |
| 2402 token_pos_(token_pos), | 2428 token_pos_(token_pos), |
| 2403 receiver_class_id_(kIllegalCid) { | 2429 receiver_class_id_(kIllegalCid) { |
| 2404 // deopt_id() checks receiver_class_id_ value. | 2430 // deopt_id() checks receiver_class_id_ value. |
| 2405 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); | 2431 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); |
| 2406 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); | 2432 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
| 2407 } | 2433 } |
| 2408 | 2434 |
| 2409 DECLARE_INSTRUCTION(EqualityCompare) | 2435 DECLARE_INSTRUCTION(EqualityCompare) |
| 2410 virtual CompileType* ComputeInitialType() const; | 2436 virtual CompileType ComputeType() const; |
| 2437 virtual bool RecomputeType(); | |
| 2411 | 2438 |
| 2412 const ICData* ic_data() const { return ic_data_; } | 2439 const ICData* ic_data() const { return ic_data_; } |
| 2413 bool HasICData() const { | 2440 bool HasICData() const { |
| 2414 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2441 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 2415 } | 2442 } |
| 2416 | 2443 |
| 2417 intptr_t token_pos() const { return token_pos_; } | 2444 intptr_t token_pos() const { return token_pos_; } |
| 2418 | 2445 |
| 2419 // Receiver class id is computed from collected ICData. | 2446 // Receiver class id is computed from collected ICData. |
| 2420 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } | 2447 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2469 Value* right) | 2496 Value* right) |
| 2470 : ComparisonInstr(kind, left, right), | 2497 : ComparisonInstr(kind, left, right), |
| 2471 token_pos_(token_pos), | 2498 token_pos_(token_pos), |
| 2472 operands_class_id_(kIllegalCid) { | 2499 operands_class_id_(kIllegalCid) { |
| 2473 // deopt_id() checks operands_class_id_ value. | 2500 // deopt_id() checks operands_class_id_ value. |
| 2474 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); | 2501 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); |
| 2475 ASSERT(Token::IsRelationalOperator(kind)); | 2502 ASSERT(Token::IsRelationalOperator(kind)); |
| 2476 } | 2503 } |
| 2477 | 2504 |
| 2478 DECLARE_INSTRUCTION(RelationalOp) | 2505 DECLARE_INSTRUCTION(RelationalOp) |
| 2479 virtual CompileType* ComputeInitialType() const; | 2506 virtual CompileType ComputeType() const; |
| 2507 virtual bool RecomputeType(); | |
| 2480 | 2508 |
| 2481 const ICData* ic_data() const { return ic_data_; } | 2509 const ICData* ic_data() const { return ic_data_; } |
| 2482 bool HasICData() const { | 2510 bool HasICData() const { |
| 2483 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2511 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 2484 } | 2512 } |
| 2485 | 2513 |
| 2486 intptr_t token_pos() const { return token_pos_; } | 2514 intptr_t token_pos() const { return token_pos_; } |
| 2487 | 2515 |
| 2488 // TODO(srdjan): instead of class-id pass an enum that can differentiate | 2516 // TODO(srdjan): instead of class-id pass an enum that can differentiate |
| 2489 // between boxed and unboxed doubles and integers. | 2517 // between boxed and unboxed doubles and integers. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2542 function_(function), | 2570 function_(function), |
| 2543 argument_names_(argument_names), | 2571 argument_names_(argument_names), |
| 2544 arguments_(arguments), | 2572 arguments_(arguments), |
| 2545 result_cid_(kDynamicCid), | 2573 result_cid_(kDynamicCid), |
| 2546 is_known_constructor_(false) { | 2574 is_known_constructor_(false) { |
| 2547 ASSERT(function.IsZoneHandle()); | 2575 ASSERT(function.IsZoneHandle()); |
| 2548 ASSERT(argument_names.IsZoneHandle()); | 2576 ASSERT(argument_names.IsZoneHandle()); |
| 2549 } | 2577 } |
| 2550 | 2578 |
| 2551 DECLARE_INSTRUCTION(StaticCall) | 2579 DECLARE_INSTRUCTION(StaticCall) |
| 2552 virtual CompileType* ComputeInitialType() const; | 2580 virtual CompileType ComputeType() const; |
| 2553 | 2581 |
| 2554 // Accessors forwarded to the AST node. | 2582 // Accessors forwarded to the AST node. |
| 2555 const Function& function() const { return function_; } | 2583 const Function& function() const { return function_; } |
| 2556 const Array& argument_names() const { return argument_names_; } | 2584 const Array& argument_names() const { return argument_names_; } |
| 2557 intptr_t token_pos() const { return token_pos_; } | 2585 intptr_t token_pos() const { return token_pos_; } |
| 2558 | 2586 |
| 2559 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2587 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2560 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2588 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2561 return (*arguments_)[index]; | 2589 return (*arguments_)[index]; |
| 2562 } | 2590 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2588 }; | 2616 }; |
| 2589 | 2617 |
| 2590 | 2618 |
| 2591 class LoadLocalInstr : public TemplateDefinition<0> { | 2619 class LoadLocalInstr : public TemplateDefinition<0> { |
| 2592 public: | 2620 public: |
| 2593 LoadLocalInstr(const LocalVariable& local, intptr_t context_level) | 2621 LoadLocalInstr(const LocalVariable& local, intptr_t context_level) |
| 2594 : local_(local), | 2622 : local_(local), |
| 2595 context_level_(context_level) { } | 2623 context_level_(context_level) { } |
| 2596 | 2624 |
| 2597 DECLARE_INSTRUCTION(LoadLocal) | 2625 DECLARE_INSTRUCTION(LoadLocal) |
| 2598 virtual CompileType* ComputeInitialType() const; | 2626 virtual CompileType ComputeType() const; |
| 2599 | 2627 |
| 2600 const LocalVariable& local() const { return local_; } | 2628 const LocalVariable& local() const { return local_; } |
| 2601 intptr_t context_level() const { return context_level_; } | 2629 intptr_t context_level() const { return context_level_; } |
| 2602 | 2630 |
| 2603 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2631 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2604 | 2632 |
| 2605 virtual bool CanDeoptimize() const { return false; } | 2633 virtual bool CanDeoptimize() const { return false; } |
| 2606 | 2634 |
| 2607 virtual bool HasSideEffect() const { | 2635 virtual bool HasSideEffect() const { |
| 2608 UNREACHABLE(); | 2636 UNREACHABLE(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2723 | 2751 |
| 2724 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 2752 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
| 2725 }; | 2753 }; |
| 2726 | 2754 |
| 2727 | 2755 |
| 2728 class LoadStaticFieldInstr : public TemplateDefinition<0> { | 2756 class LoadStaticFieldInstr : public TemplateDefinition<0> { |
| 2729 public: | 2757 public: |
| 2730 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} | 2758 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} |
| 2731 | 2759 |
| 2732 DECLARE_INSTRUCTION(LoadStaticField); | 2760 DECLARE_INSTRUCTION(LoadStaticField); |
| 2733 virtual CompileType* ComputeInitialType() const; | 2761 virtual CompileType ComputeType() const; |
| 2734 | 2762 |
| 2735 const Field& field() const { return field_; } | 2763 const Field& field() const { return field_; } |
| 2736 | 2764 |
| 2737 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2765 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2738 | 2766 |
| 2739 virtual bool CanDeoptimize() const { return false; } | 2767 virtual bool CanDeoptimize() const { return false; } |
| 2740 | 2768 |
| 2741 virtual bool HasSideEffect() const { return false; } | 2769 virtual bool HasSideEffect() const { return false; } |
| 2742 | 2770 |
| 2743 virtual bool AffectedBySideEffect() const { return !field().is_final(); } | 2771 virtual bool AffectedBySideEffect() const { return !field().is_final(); } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2787 intptr_t deopt_id) | 2815 intptr_t deopt_id) |
| 2788 : index_scale_(index_scale), class_id_(class_id) { | 2816 : index_scale_(index_scale), class_id_(class_id) { |
| 2789 ASSERT(array != NULL); | 2817 ASSERT(array != NULL); |
| 2790 ASSERT(index != NULL); | 2818 ASSERT(index != NULL); |
| 2791 inputs_[0] = array; | 2819 inputs_[0] = array; |
| 2792 inputs_[1] = index; | 2820 inputs_[1] = index; |
| 2793 deopt_id_ = deopt_id; | 2821 deopt_id_ = deopt_id; |
| 2794 } | 2822 } |
| 2795 | 2823 |
| 2796 DECLARE_INSTRUCTION(LoadIndexed) | 2824 DECLARE_INSTRUCTION(LoadIndexed) |
| 2797 virtual CompileType* ComputeInitialType() const; | 2825 virtual CompileType ComputeType() const; |
| 2798 | 2826 |
| 2799 Value* array() const { return inputs_[0]; } | 2827 Value* array() const { return inputs_[0]; } |
| 2800 Value* index() const { return inputs_[1]; } | 2828 Value* index() const { return inputs_[1]; } |
| 2801 intptr_t index_scale() const { return index_scale_; } | 2829 intptr_t index_scale() const { return index_scale_; } |
| 2802 intptr_t class_id() const { return class_id_; } | 2830 intptr_t class_id() const { return class_id_; } |
| 2803 | 2831 |
| 2804 virtual bool CanDeoptimize() const { | 2832 virtual bool CanDeoptimize() const { |
| 2805 return deopt_id_ != Isolate::kNoDeoptId; | 2833 return deopt_id_ != Isolate::kNoDeoptId; |
| 2806 } | 2834 } |
| 2807 | 2835 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2828 explicit StringFromCharCodeInstr(Value* char_code, | 2856 explicit StringFromCharCodeInstr(Value* char_code, |
| 2829 intptr_t cid) : cid_(cid) { | 2857 intptr_t cid) : cid_(cid) { |
| 2830 ASSERT(char_code != NULL); | 2858 ASSERT(char_code != NULL); |
| 2831 ASSERT(char_code->definition()->IsLoadIndexed() && | 2859 ASSERT(char_code->definition()->IsLoadIndexed() && |
| 2832 (char_code->definition()->AsLoadIndexed()->class_id() == | 2860 (char_code->definition()->AsLoadIndexed()->class_id() == |
| 2833 kOneByteStringCid)); | 2861 kOneByteStringCid)); |
| 2834 inputs_[0] = char_code; | 2862 inputs_[0] = char_code; |
| 2835 } | 2863 } |
| 2836 | 2864 |
| 2837 DECLARE_INSTRUCTION(StringFromCharCode) | 2865 DECLARE_INSTRUCTION(StringFromCharCode) |
| 2838 virtual CompileType* ComputeInitialType() const; | 2866 virtual CompileType ComputeType() const; |
| 2839 | 2867 |
| 2840 Value* char_code() const { return inputs_[0]; } | 2868 Value* char_code() const { return inputs_[0]; } |
| 2841 | 2869 |
| 2842 virtual bool CanDeoptimize() const { return false; } | 2870 virtual bool CanDeoptimize() const { return false; } |
| 2843 | 2871 |
| 2844 virtual bool HasSideEffect() const { return false; } | 2872 virtual bool HasSideEffect() const { return false; } |
| 2845 | 2873 |
| 2846 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2874 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 2847 | 2875 |
| 2848 virtual bool AffectedBySideEffect() const { return false; } | 2876 virtual bool AffectedBySideEffect() const { return false; } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2907 | 2935 |
| 2908 // Note overrideable, built-in: value? false : true. | 2936 // Note overrideable, built-in: value? false : true. |
| 2909 class BooleanNegateInstr : public TemplateDefinition<1> { | 2937 class BooleanNegateInstr : public TemplateDefinition<1> { |
| 2910 public: | 2938 public: |
| 2911 explicit BooleanNegateInstr(Value* value) { | 2939 explicit BooleanNegateInstr(Value* value) { |
| 2912 ASSERT(value != NULL); | 2940 ASSERT(value != NULL); |
| 2913 inputs_[0] = value; | 2941 inputs_[0] = value; |
| 2914 } | 2942 } |
| 2915 | 2943 |
| 2916 DECLARE_INSTRUCTION(BooleanNegate) | 2944 DECLARE_INSTRUCTION(BooleanNegate) |
| 2917 virtual CompileType* ComputeInitialType() const; | 2945 virtual CompileType ComputeType() const; |
| 2918 | 2946 |
| 2919 Value* value() const { return inputs_[0]; } | 2947 Value* value() const { return inputs_[0]; } |
| 2920 | 2948 |
| 2921 virtual bool CanDeoptimize() const { return false; } | 2949 virtual bool CanDeoptimize() const { return false; } |
| 2922 | 2950 |
| 2923 virtual bool HasSideEffect() const { return false; } | 2951 virtual bool HasSideEffect() const { return false; } |
| 2924 | 2952 |
| 2925 private: | 2953 private: |
| 2926 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); | 2954 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
| 2927 }; | 2955 }; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 2941 ASSERT(value != NULL); | 2969 ASSERT(value != NULL); |
| 2942 ASSERT(instantiator != NULL); | 2970 ASSERT(instantiator != NULL); |
| 2943 ASSERT(instantiator_type_arguments != NULL); | 2971 ASSERT(instantiator_type_arguments != NULL); |
| 2944 ASSERT(!type.IsNull()); | 2972 ASSERT(!type.IsNull()); |
| 2945 inputs_[0] = value; | 2973 inputs_[0] = value; |
| 2946 inputs_[1] = instantiator; | 2974 inputs_[1] = instantiator; |
| 2947 inputs_[2] = instantiator_type_arguments; | 2975 inputs_[2] = instantiator_type_arguments; |
| 2948 } | 2976 } |
| 2949 | 2977 |
| 2950 DECLARE_INSTRUCTION(InstanceOf) | 2978 DECLARE_INSTRUCTION(InstanceOf) |
| 2951 virtual CompileType* ComputeInitialType() const; | 2979 virtual CompileType ComputeType() const; |
| 2952 | 2980 |
| 2953 Value* value() const { return inputs_[0]; } | 2981 Value* value() const { return inputs_[0]; } |
| 2954 Value* instantiator() const { return inputs_[1]; } | 2982 Value* instantiator() const { return inputs_[1]; } |
| 2955 Value* instantiator_type_arguments() const { return inputs_[2]; } | 2983 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 2956 | 2984 |
| 2957 bool negate_result() const { return negate_result_; } | 2985 bool negate_result() const { return negate_result_; } |
| 2958 const AbstractType& type() const { return type_; } | 2986 const AbstractType& type() const { return type_; } |
| 2959 intptr_t token_pos() const { return token_pos_; } | 2987 intptr_t token_pos() const { return token_pos_; } |
| 2960 | 2988 |
| 2961 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2989 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2981 AllocateObjectInstr(ConstructorCallNode* node, | 3009 AllocateObjectInstr(ConstructorCallNode* node, |
| 2982 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 3010 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 2983 : ast_node_(*node), | 3011 : ast_node_(*node), |
| 2984 arguments_(arguments), | 3012 arguments_(arguments), |
| 2985 cid_(Class::Handle(node->constructor().Owner()).id()) { | 3013 cid_(Class::Handle(node->constructor().Owner()).id()) { |
| 2986 // Either no arguments or one type-argument and one instantiator. | 3014 // Either no arguments or one type-argument and one instantiator. |
| 2987 ASSERT(arguments->is_empty() || (arguments->length() == 2)); | 3015 ASSERT(arguments->is_empty() || (arguments->length() == 2)); |
| 2988 } | 3016 } |
| 2989 | 3017 |
| 2990 DECLARE_INSTRUCTION(AllocateObject) | 3018 DECLARE_INSTRUCTION(AllocateObject) |
| 2991 virtual CompileType* ComputeInitialType() const; | 3019 virtual CompileType ComputeType() const; |
| 2992 | 3020 |
| 2993 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3021 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2994 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 3022 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2995 return (*arguments_)[index]; | 3023 return (*arguments_)[index]; |
| 2996 } | 3024 } |
| 2997 | 3025 |
| 2998 const Function& constructor() const { return ast_node_.constructor(); } | 3026 const Function& constructor() const { return ast_node_.constructor(); } |
| 2999 intptr_t token_pos() const { return ast_node_.token_pos(); } | 3027 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 3000 | 3028 |
| 3001 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3029 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3055 #if defined(DEBUG) | 3083 #if defined(DEBUG) |
| 3056 ASSERT(element_type != NULL); | 3084 ASSERT(element_type != NULL); |
| 3057 ASSERT(type_.IsZoneHandle()); | 3085 ASSERT(type_.IsZoneHandle()); |
| 3058 ASSERT(!type_.IsNull()); | 3086 ASSERT(!type_.IsNull()); |
| 3059 ASSERT(type_.IsFinalized()); | 3087 ASSERT(type_.IsFinalized()); |
| 3060 #endif | 3088 #endif |
| 3061 inputs_[0] = element_type; | 3089 inputs_[0] = element_type; |
| 3062 } | 3090 } |
| 3063 | 3091 |
| 3064 DECLARE_INSTRUCTION(CreateArray) | 3092 DECLARE_INSTRUCTION(CreateArray) |
| 3065 virtual CompileType* ComputeInitialType() const; | 3093 virtual CompileType ComputeType() const; |
| 3066 | 3094 |
| 3067 intptr_t num_elements() const { return num_elements_; } | 3095 intptr_t num_elements() const { return num_elements_; } |
| 3068 | 3096 |
| 3069 intptr_t token_pos() const { return token_pos_; } | 3097 intptr_t token_pos() const { return token_pos_; } |
| 3070 const AbstractType& type() const { return type_; } | 3098 const AbstractType& type() const { return type_; } |
| 3071 Value* element_type() const { return inputs_[0]; } | 3099 Value* element_type() const { return inputs_[0]; } |
| 3072 | 3100 |
| 3073 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3101 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3074 | 3102 |
| 3075 virtual bool CanDeoptimize() const { return false; } | 3103 virtual bool CanDeoptimize() const { return false; } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3088 class CreateClosureInstr : public TemplateDefinition<0> { | 3116 class CreateClosureInstr : public TemplateDefinition<0> { |
| 3089 public: | 3117 public: |
| 3090 CreateClosureInstr(const Function& function, | 3118 CreateClosureInstr(const Function& function, |
| 3091 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3119 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 3092 intptr_t token_pos) | 3120 intptr_t token_pos) |
| 3093 : function_(function), | 3121 : function_(function), |
| 3094 arguments_(arguments), | 3122 arguments_(arguments), |
| 3095 token_pos_(token_pos) { } | 3123 token_pos_(token_pos) { } |
| 3096 | 3124 |
| 3097 DECLARE_INSTRUCTION(CreateClosure) | 3125 DECLARE_INSTRUCTION(CreateClosure) |
| 3098 virtual CompileType* ComputeInitialType() const; | 3126 virtual CompileType ComputeType() const; |
| 3099 | 3127 |
| 3100 intptr_t token_pos() const { return token_pos_; } | 3128 intptr_t token_pos() const { return token_pos_; } |
| 3101 const Function& function() const { return function_; } | 3129 const Function& function() const { return function_; } |
| 3102 | 3130 |
| 3103 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3131 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 3104 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 3132 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 3105 return (*arguments_)[index]; | 3133 return (*arguments_)[index]; |
| 3106 } | 3134 } |
| 3107 | 3135 |
| 3108 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3136 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 3130 type_(type), | 3158 type_(type), |
| 3131 result_cid_(kDynamicCid), | 3159 result_cid_(kDynamicCid), |
| 3132 immutable_(immutable), | 3160 immutable_(immutable), |
| 3133 recognized_kind_(MethodRecognizer::kUnknown) { | 3161 recognized_kind_(MethodRecognizer::kUnknown) { |
| 3134 ASSERT(value != NULL); | 3162 ASSERT(value != NULL); |
| 3135 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. | 3163 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. |
| 3136 inputs_[0] = value; | 3164 inputs_[0] = value; |
| 3137 } | 3165 } |
| 3138 | 3166 |
| 3139 DECLARE_INSTRUCTION(LoadField) | 3167 DECLARE_INSTRUCTION(LoadField) |
| 3140 virtual CompileType* ComputeInitialType() const; | 3168 virtual CompileType ComputeType() const; |
| 3141 | 3169 |
| 3142 Value* value() const { return inputs_[0]; } | 3170 Value* value() const { return inputs_[0]; } |
| 3143 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 3171 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| 3144 const AbstractType& type() const { return type_; } | 3172 const AbstractType& type() const { return type_; } |
| 3145 void set_result_cid(intptr_t value) { result_cid_ = value; } | 3173 void set_result_cid(intptr_t value) { result_cid_ = value; } |
| 3146 | 3174 |
| 3147 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3175 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3148 | 3176 |
| 3149 virtual bool CanDeoptimize() const { return false; } | 3177 virtual bool CanDeoptimize() const { return false; } |
| 3150 | 3178 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3316 | 3344 |
| 3317 | 3345 |
| 3318 class AllocateContextInstr : public TemplateDefinition<0> { | 3346 class AllocateContextInstr : public TemplateDefinition<0> { |
| 3319 public: | 3347 public: |
| 3320 AllocateContextInstr(intptr_t token_pos, | 3348 AllocateContextInstr(intptr_t token_pos, |
| 3321 intptr_t num_context_variables) | 3349 intptr_t num_context_variables) |
| 3322 : token_pos_(token_pos), | 3350 : token_pos_(token_pos), |
| 3323 num_context_variables_(num_context_variables) {} | 3351 num_context_variables_(num_context_variables) {} |
| 3324 | 3352 |
| 3325 DECLARE_INSTRUCTION(AllocateContext); | 3353 DECLARE_INSTRUCTION(AllocateContext); |
| 3326 virtual CompileType* ComputeInitialType() const; | 3354 virtual CompileType ComputeType() const; |
| 3327 | 3355 |
| 3328 intptr_t token_pos() const { return token_pos_; } | 3356 intptr_t token_pos() const { return token_pos_; } |
| 3329 intptr_t num_context_variables() const { return num_context_variables_; } | 3357 intptr_t num_context_variables() const { return num_context_variables_; } |
| 3330 | 3358 |
| 3331 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3359 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3332 | 3360 |
| 3333 virtual bool CanDeoptimize() const { return false; } | 3361 virtual bool CanDeoptimize() const { return false; } |
| 3334 | 3362 |
| 3335 virtual bool HasSideEffect() const { return false; } | 3363 virtual bool HasSideEffect() const { return false; } |
| 3336 | 3364 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3369 CloneContextInstr(intptr_t token_pos, Value* context_value) | 3397 CloneContextInstr(intptr_t token_pos, Value* context_value) |
| 3370 : token_pos_(token_pos) { | 3398 : token_pos_(token_pos) { |
| 3371 ASSERT(context_value != NULL); | 3399 ASSERT(context_value != NULL); |
| 3372 inputs_[0] = context_value; | 3400 inputs_[0] = context_value; |
| 3373 } | 3401 } |
| 3374 | 3402 |
| 3375 intptr_t token_pos() const { return token_pos_; } | 3403 intptr_t token_pos() const { return token_pos_; } |
| 3376 Value* context_value() const { return inputs_[0]; } | 3404 Value* context_value() const { return inputs_[0]; } |
| 3377 | 3405 |
| 3378 DECLARE_INSTRUCTION(CloneContext) | 3406 DECLARE_INSTRUCTION(CloneContext) |
| 3379 virtual CompileType* ComputeInitialType() const; | 3407 virtual CompileType ComputeType() const; |
| 3380 | 3408 |
| 3381 virtual bool CanDeoptimize() const { return true; } | 3409 virtual bool CanDeoptimize() const { return true; } |
| 3382 | 3410 |
| 3383 virtual bool HasSideEffect() const { return false; } | 3411 virtual bool HasSideEffect() const { return false; } |
| 3384 | 3412 |
| 3385 private: | 3413 private: |
| 3386 const intptr_t token_pos_; | 3414 const intptr_t token_pos_; |
| 3387 | 3415 |
| 3388 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); | 3416 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); |
| 3389 }; | 3417 }; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3469 | 3497 |
| 3470 virtual bool AffectedBySideEffect() const { return false; } | 3498 virtual bool AffectedBySideEffect() const { return false; } |
| 3471 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3499 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3472 | 3500 |
| 3473 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3501 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3474 ASSERT(idx == 0); | 3502 ASSERT(idx == 0); |
| 3475 return kUnboxedDouble; | 3503 return kUnboxedDouble; |
| 3476 } | 3504 } |
| 3477 | 3505 |
| 3478 DECLARE_INSTRUCTION(BoxDouble) | 3506 DECLARE_INSTRUCTION(BoxDouble) |
| 3479 virtual CompileType* ComputeInitialType() const; | 3507 virtual CompileType ComputeType() const; |
| 3480 | 3508 |
| 3481 private: | 3509 private: |
| 3482 const intptr_t token_pos_; | 3510 const intptr_t token_pos_; |
| 3483 | 3511 |
| 3484 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); | 3512 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); |
| 3485 }; | 3513 }; |
| 3486 | 3514 |
| 3487 | 3515 |
| 3488 class BoxIntegerInstr : public TemplateDefinition<1> { | 3516 class BoxIntegerInstr : public TemplateDefinition<1> { |
| 3489 public: | 3517 public: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3500 | 3528 |
| 3501 virtual bool AffectedBySideEffect() const { return false; } | 3529 virtual bool AffectedBySideEffect() const { return false; } |
| 3502 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3530 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3503 | 3531 |
| 3504 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3532 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3505 ASSERT(idx == 0); | 3533 ASSERT(idx == 0); |
| 3506 return kUnboxedMint; | 3534 return kUnboxedMint; |
| 3507 } | 3535 } |
| 3508 | 3536 |
| 3509 DECLARE_INSTRUCTION(BoxInteger) | 3537 DECLARE_INSTRUCTION(BoxInteger) |
| 3510 virtual CompileType* ComputeInitialType() const; | 3538 virtual CompileType ComputeType() const; |
| 3511 | 3539 |
| 3512 private: | 3540 private: |
| 3513 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); | 3541 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); |
| 3514 }; | 3542 }; |
| 3515 | 3543 |
| 3516 | 3544 |
| 3517 class UnboxDoubleInstr : public TemplateDefinition<1> { | 3545 class UnboxDoubleInstr : public TemplateDefinition<1> { |
| 3518 public: | 3546 public: |
| 3519 UnboxDoubleInstr(Value* value, intptr_t deopt_id) { | 3547 UnboxDoubleInstr(Value* value, intptr_t deopt_id) { |
| 3520 ASSERT(value != NULL); | 3548 ASSERT(value != NULL); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3532 virtual bool HasSideEffect() const { return false; } | 3560 virtual bool HasSideEffect() const { return false; } |
| 3533 | 3561 |
| 3534 virtual Representation representation() const { | 3562 virtual Representation representation() const { |
| 3535 return kUnboxedDouble; | 3563 return kUnboxedDouble; |
| 3536 } | 3564 } |
| 3537 | 3565 |
| 3538 virtual bool AffectedBySideEffect() const { return false; } | 3566 virtual bool AffectedBySideEffect() const { return false; } |
| 3539 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3567 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3540 | 3568 |
| 3541 DECLARE_INSTRUCTION(UnboxDouble) | 3569 DECLARE_INSTRUCTION(UnboxDouble) |
| 3542 virtual CompileType* ComputeInitialType() const; | 3570 virtual CompileType ComputeType() const; |
| 3543 | 3571 |
| 3544 private: | 3572 private: |
| 3545 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); | 3573 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| 3546 }; | 3574 }; |
| 3547 | 3575 |
| 3548 | 3576 |
| 3549 class UnboxIntegerInstr : public TemplateDefinition<1> { | 3577 class UnboxIntegerInstr : public TemplateDefinition<1> { |
| 3550 public: | 3578 public: |
| 3551 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { | 3579 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { |
| 3552 ASSERT(value != NULL); | 3580 ASSERT(value != NULL); |
| 3553 inputs_[0] = value; | 3581 inputs_[0] = value; |
| 3554 deopt_id_ = deopt_id; | 3582 deopt_id_ = deopt_id; |
| 3555 } | 3583 } |
| 3556 | 3584 |
| 3557 Value* value() const { return inputs_[0]; } | 3585 Value* value() const { return inputs_[0]; } |
| 3558 | 3586 |
| 3559 virtual bool CanDeoptimize() const { | 3587 virtual bool CanDeoptimize() const { |
| 3560 return (value()->Type()->ToCid() != kSmiCid) | 3588 return (value()->Type()->ToCid() != kSmiCid) |
| 3561 && (value()->Type()->ToCid() != kMintCid); | 3589 && (value()->Type()->ToCid() != kMintCid); |
| 3562 } | 3590 } |
| 3563 | 3591 |
| 3564 virtual bool HasSideEffect() const { return false; } | 3592 virtual bool HasSideEffect() const { return false; } |
| 3565 | 3593 |
| 3566 virtual CompileType* ComputeInitialType() const; | 3594 virtual CompileType ComputeType() const; |
| 3567 | 3595 |
| 3568 virtual Representation representation() const { | 3596 virtual Representation representation() const { |
| 3569 return kUnboxedMint; | 3597 return kUnboxedMint; |
| 3570 } | 3598 } |
| 3571 | 3599 |
| 3572 | 3600 |
| 3573 virtual bool AffectedBySideEffect() const { return false; } | 3601 virtual bool AffectedBySideEffect() const { return false; } |
| 3574 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3602 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3575 | 3603 |
| 3576 DECLARE_INSTRUCTION(UnboxInteger) | 3604 DECLARE_INSTRUCTION(UnboxInteger) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3607 return kUnboxedDouble; | 3635 return kUnboxedDouble; |
| 3608 } | 3636 } |
| 3609 | 3637 |
| 3610 virtual intptr_t DeoptimizationTarget() const { | 3638 virtual intptr_t DeoptimizationTarget() const { |
| 3611 // Direct access since this instruction cannot deoptimize, and the deopt-id | 3639 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3612 // was inherited from another instruction that could deoptimize. | 3640 // was inherited from another instruction that could deoptimize. |
| 3613 return deopt_id_; | 3641 return deopt_id_; |
| 3614 } | 3642 } |
| 3615 | 3643 |
| 3616 DECLARE_INSTRUCTION(MathSqrt) | 3644 DECLARE_INSTRUCTION(MathSqrt) |
| 3617 virtual CompileType* ComputeInitialType() const; | 3645 virtual CompileType ComputeType() const; |
| 3618 | 3646 |
| 3619 private: | 3647 private: |
| 3620 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); | 3648 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); |
| 3621 }; | 3649 }; |
| 3622 | 3650 |
| 3623 | 3651 |
| 3624 class BinaryDoubleOpInstr : public TemplateDefinition<2> { | 3652 class BinaryDoubleOpInstr : public TemplateDefinition<2> { |
| 3625 public: | 3653 public: |
| 3626 BinaryDoubleOpInstr(Token::Kind op_kind, | 3654 BinaryDoubleOpInstr(Token::Kind op_kind, |
| 3627 Value* left, | 3655 Value* left, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3661 return kUnboxedDouble; | 3689 return kUnboxedDouble; |
| 3662 } | 3690 } |
| 3663 | 3691 |
| 3664 virtual intptr_t DeoptimizationTarget() const { | 3692 virtual intptr_t DeoptimizationTarget() const { |
| 3665 // Direct access since this instruction cannot deoptimize, and the deopt-id | 3693 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3666 // was inherited from another instruction that could deoptimize. | 3694 // was inherited from another instruction that could deoptimize. |
| 3667 return deopt_id_; | 3695 return deopt_id_; |
| 3668 } | 3696 } |
| 3669 | 3697 |
| 3670 DECLARE_INSTRUCTION(BinaryDoubleOp) | 3698 DECLARE_INSTRUCTION(BinaryDoubleOp) |
| 3671 virtual CompileType* ComputeInitialType() const; | 3699 virtual CompileType ComputeType() const; |
| 3672 | 3700 |
| 3673 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); | 3701 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 3674 | 3702 |
| 3675 private: | 3703 private: |
| 3676 const Token::Kind op_kind_; | 3704 const Token::Kind op_kind_; |
| 3677 | 3705 |
| 3678 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 3706 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
| 3679 }; | 3707 }; |
| 3680 | 3708 |
| 3681 | 3709 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3705 } | 3733 } |
| 3706 | 3734 |
| 3707 virtual bool HasSideEffect() const { return false; } | 3735 virtual bool HasSideEffect() const { return false; } |
| 3708 | 3736 |
| 3709 virtual bool AffectedBySideEffect() const { return false; } | 3737 virtual bool AffectedBySideEffect() const { return false; } |
| 3710 | 3738 |
| 3711 virtual bool AttributesEqual(Instruction* other) const { | 3739 virtual bool AttributesEqual(Instruction* other) const { |
| 3712 return op_kind() == other->AsBinaryMintOp()->op_kind(); | 3740 return op_kind() == other->AsBinaryMintOp()->op_kind(); |
| 3713 } | 3741 } |
| 3714 | 3742 |
| 3715 virtual CompileType* ComputeInitialType() const; | 3743 virtual CompileType ComputeType() const; |
| 3716 | 3744 |
| 3717 virtual Representation representation() const { | 3745 virtual Representation representation() const { |
| 3718 return kUnboxedMint; | 3746 return kUnboxedMint; |
| 3719 } | 3747 } |
| 3720 | 3748 |
| 3721 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3749 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3722 ASSERT((idx == 0) || (idx == 1)); | 3750 ASSERT((idx == 0) || (idx == 1)); |
| 3723 return kUnboxedMint; | 3751 return kUnboxedMint; |
| 3724 } | 3752 } |
| 3725 | 3753 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3765 virtual bool CanDeoptimize() const { return true; } | 3793 virtual bool CanDeoptimize() const { return true; } |
| 3766 | 3794 |
| 3767 virtual bool HasSideEffect() const { return false; } | 3795 virtual bool HasSideEffect() const { return false; } |
| 3768 | 3796 |
| 3769 virtual bool AffectedBySideEffect() const { return false; } | 3797 virtual bool AffectedBySideEffect() const { return false; } |
| 3770 | 3798 |
| 3771 virtual bool AttributesEqual(Instruction* other) const { | 3799 virtual bool AttributesEqual(Instruction* other) const { |
| 3772 return op_kind() == other->AsShiftMintOp()->op_kind(); | 3800 return op_kind() == other->AsShiftMintOp()->op_kind(); |
| 3773 } | 3801 } |
| 3774 | 3802 |
| 3775 virtual CompileType* ComputeInitialType() const; | 3803 virtual CompileType ComputeType() const; |
| 3776 | 3804 |
| 3777 virtual Representation representation() const { | 3805 virtual Representation representation() const { |
| 3778 return kUnboxedMint; | 3806 return kUnboxedMint; |
| 3779 } | 3807 } |
| 3780 | 3808 |
| 3781 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3809 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3782 ASSERT((idx == 0) || (idx == 1)); | 3810 ASSERT((idx == 0) || (idx == 1)); |
| 3783 return (idx == 0) ? kUnboxedMint : kTagged; | 3811 return (idx == 0) ? kUnboxedMint : kTagged; |
| 3784 } | 3812 } |
| 3785 | 3813 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3819 virtual bool CanDeoptimize() const { return false; } | 3847 virtual bool CanDeoptimize() const { return false; } |
| 3820 | 3848 |
| 3821 virtual bool HasSideEffect() const { return false; } | 3849 virtual bool HasSideEffect() const { return false; } |
| 3822 | 3850 |
| 3823 virtual bool AffectedBySideEffect() const { return false; } | 3851 virtual bool AffectedBySideEffect() const { return false; } |
| 3824 | 3852 |
| 3825 virtual bool AttributesEqual(Instruction* other) const { | 3853 virtual bool AttributesEqual(Instruction* other) const { |
| 3826 return op_kind() == other->AsUnaryMintOp()->op_kind(); | 3854 return op_kind() == other->AsUnaryMintOp()->op_kind(); |
| 3827 } | 3855 } |
| 3828 | 3856 |
| 3829 virtual CompileType* ComputeInitialType() const; | 3857 virtual CompileType ComputeType() const; |
| 3830 | 3858 |
| 3831 virtual Representation representation() const { | 3859 virtual Representation representation() const { |
| 3832 return kUnboxedMint; | 3860 return kUnboxedMint; |
| 3833 } | 3861 } |
| 3834 | 3862 |
| 3835 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3863 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3836 ASSERT(idx == 0); | 3864 ASSERT(idx == 0); |
| 3837 return kUnboxedMint; | 3865 return kUnboxedMint; |
| 3838 } | 3866 } |
| 3839 | 3867 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3874 Token::Kind op_kind() const { return op_kind_; } | 3902 Token::Kind op_kind() const { return op_kind_; } |
| 3875 | 3903 |
| 3876 InstanceCallInstr* instance_call() const { return instance_call_; } | 3904 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 3877 | 3905 |
| 3878 const ICData* ic_data() const { return instance_call()->ic_data(); } | 3906 const ICData* ic_data() const { return instance_call()->ic_data(); } |
| 3879 | 3907 |
| 3880 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3908 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3881 | 3909 |
| 3882 DECLARE_INSTRUCTION(BinarySmiOp) | 3910 DECLARE_INSTRUCTION(BinarySmiOp) |
| 3883 | 3911 |
| 3884 virtual CompileType* ComputeInitialType() const; | 3912 virtual CompileType ComputeType() const; |
| 3885 | 3913 |
| 3886 virtual bool CanDeoptimize() const; | 3914 virtual bool CanDeoptimize() const; |
| 3887 | 3915 |
| 3888 virtual bool HasSideEffect() const { return false; } | 3916 virtual bool HasSideEffect() const { return false; } |
| 3889 | 3917 |
| 3890 virtual bool AffectedBySideEffect() const { return false; } | 3918 virtual bool AffectedBySideEffect() const { return false; } |
| 3891 virtual bool AttributesEqual(Instruction* other) const; | 3919 virtual bool AttributesEqual(Instruction* other) const; |
| 3892 | 3920 |
| 3893 void set_overflow(bool overflow) { | 3921 void set_overflow(bool overflow) { |
| 3894 overflow_ = overflow; | 3922 overflow_ = overflow; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3925 inputs_[0] = value; | 3953 inputs_[0] = value; |
| 3926 deopt_id_ = instance_call->deopt_id(); | 3954 deopt_id_ = instance_call->deopt_id(); |
| 3927 } | 3955 } |
| 3928 | 3956 |
| 3929 Value* value() const { return inputs_[0]; } | 3957 Value* value() const { return inputs_[0]; } |
| 3930 Token::Kind op_kind() const { return op_kind_; } | 3958 Token::Kind op_kind() const { return op_kind_; } |
| 3931 | 3959 |
| 3932 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3960 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3933 | 3961 |
| 3934 DECLARE_INSTRUCTION(UnarySmiOp) | 3962 DECLARE_INSTRUCTION(UnarySmiOp) |
| 3935 virtual CompileType* ComputeInitialType() const; | 3963 virtual CompileType ComputeType() const; |
| 3936 | 3964 |
| 3937 virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; } | 3965 virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; } |
| 3938 | 3966 |
| 3939 virtual bool HasSideEffect() const { return false; } | 3967 virtual bool HasSideEffect() const { return false; } |
| 3940 | 3968 |
| 3941 private: | 3969 private: |
| 3942 const Token::Kind op_kind_; | 3970 const Token::Kind op_kind_; |
| 3943 | 3971 |
| 3944 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); | 3972 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); |
| 3945 }; | 3973 }; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 3968 | 3996 |
| 3969 | 3997 |
| 3970 class SmiToDoubleInstr : public TemplateDefinition<0> { | 3998 class SmiToDoubleInstr : public TemplateDefinition<0> { |
| 3971 public: | 3999 public: |
| 3972 explicit SmiToDoubleInstr(InstanceCallInstr* instance_call) | 4000 explicit SmiToDoubleInstr(InstanceCallInstr* instance_call) |
| 3973 : instance_call_(instance_call) { } | 4001 : instance_call_(instance_call) { } |
| 3974 | 4002 |
| 3975 InstanceCallInstr* instance_call() const { return instance_call_; } | 4003 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 3976 | 4004 |
| 3977 DECLARE_INSTRUCTION(SmiToDouble) | 4005 DECLARE_INSTRUCTION(SmiToDouble) |
| 3978 virtual CompileType* ComputeInitialType() const; | 4006 virtual CompileType ComputeType() const; |
| 3979 | 4007 |
| 3980 virtual intptr_t ArgumentCount() const { return 1; } | 4008 virtual intptr_t ArgumentCount() const { return 1; } |
| 3981 | 4009 |
| 3982 virtual bool CanDeoptimize() const { return true; } | 4010 virtual bool CanDeoptimize() const { return true; } |
| 3983 | 4011 |
| 3984 virtual bool HasSideEffect() const { return false; } | 4012 virtual bool HasSideEffect() const { return false; } |
| 3985 | 4013 |
| 3986 private: | 4014 private: |
| 3987 InstanceCallInstr* instance_call_; | 4015 InstanceCallInstr* instance_call_; |
| 3988 | 4016 |
| 3989 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 4017 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
| 3990 }; | 4018 }; |
| 3991 | 4019 |
| 3992 | 4020 |
| 3993 class DoubleToIntegerInstr : public TemplateDefinition<1> { | 4021 class DoubleToIntegerInstr : public TemplateDefinition<1> { |
| 3994 public: | 4022 public: |
| 3995 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) | 4023 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) |
| 3996 : instance_call_(instance_call) { | 4024 : instance_call_(instance_call) { |
| 3997 ASSERT(value != NULL); | 4025 ASSERT(value != NULL); |
| 3998 inputs_[0] = value; | 4026 inputs_[0] = value; |
| 3999 } | 4027 } |
| 4000 | 4028 |
| 4001 Value* value() const { return inputs_[0]; } | 4029 Value* value() const { return inputs_[0]; } |
| 4002 InstanceCallInstr* instance_call() const { return instance_call_; } | 4030 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 4003 | 4031 |
| 4004 DECLARE_INSTRUCTION(DoubleToInteger) | 4032 DECLARE_INSTRUCTION(DoubleToInteger) |
| 4005 virtual CompileType* ComputeInitialType() const; | 4033 virtual CompileType ComputeType() const; |
| 4006 | 4034 |
| 4007 virtual intptr_t ArgumentCount() const { return 1; } | 4035 virtual intptr_t ArgumentCount() const { return 1; } |
| 4008 | 4036 |
| 4009 virtual bool CanDeoptimize() const { return true; } | 4037 virtual bool CanDeoptimize() const { return true; } |
| 4010 | 4038 |
| 4011 virtual bool HasSideEffect() const { return false; } | 4039 virtual bool HasSideEffect() const { return false; } |
| 4012 | 4040 |
| 4013 private: | 4041 private: |
| 4014 InstanceCallInstr* instance_call_; | 4042 InstanceCallInstr* instance_call_; |
| 4015 | 4043 |
| 4016 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); | 4044 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); |
| 4017 }; | 4045 }; |
| 4018 | 4046 |
| 4019 | 4047 |
| 4020 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input | 4048 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input |
| 4021 // and creates a Smi. | 4049 // and creates a Smi. |
| 4022 class DoubleToSmiInstr : public TemplateDefinition<1> { | 4050 class DoubleToSmiInstr : public TemplateDefinition<1> { |
| 4023 public: | 4051 public: |
| 4024 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { | 4052 DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) { |
| 4025 ASSERT(value != NULL); | 4053 ASSERT(value != NULL); |
| 4026 inputs_[0] = value; | 4054 inputs_[0] = value; |
| 4027 deopt_id_ = instance_call->deopt_id(); | 4055 deopt_id_ = instance_call->deopt_id(); |
| 4028 } | 4056 } |
| 4029 | 4057 |
| 4030 Value* value() const { return inputs_[0]; } | 4058 Value* value() const { return inputs_[0]; } |
| 4031 | 4059 |
| 4032 DECLARE_INSTRUCTION(DoubleToSmi) | 4060 DECLARE_INSTRUCTION(DoubleToSmi) |
| 4033 virtual CompileType* ComputeInitialType() const; | 4061 virtual CompileType ComputeType() const; |
| 4034 | 4062 |
| 4035 virtual bool CanDeoptimize() const { return true; } | 4063 virtual bool CanDeoptimize() const { return true; } |
| 4036 | 4064 |
| 4037 virtual bool HasSideEffect() const { return false; } | 4065 virtual bool HasSideEffect() const { return false; } |
| 4038 | 4066 |
| 4039 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 4067 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4040 ASSERT(idx == 0); | 4068 ASSERT(idx == 0); |
| 4041 return kUnboxedDouble; | 4069 return kUnboxedDouble; |
| 4042 } | 4070 } |
| 4043 | 4071 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 4057 ASSERT(value != NULL); | 4085 ASSERT(value != NULL); |
| 4058 inputs_[0] = value; | 4086 inputs_[0] = value; |
| 4059 deopt_id_ = instance_call->deopt_id(); | 4087 deopt_id_ = instance_call->deopt_id(); |
| 4060 } | 4088 } |
| 4061 | 4089 |
| 4062 Value* value() const { return inputs_[0]; } | 4090 Value* value() const { return inputs_[0]; } |
| 4063 | 4091 |
| 4064 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } | 4092 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
| 4065 | 4093 |
| 4066 DECLARE_INSTRUCTION(DoubleToDouble) | 4094 DECLARE_INSTRUCTION(DoubleToDouble) |
| 4067 virtual CompileType* ComputeInitialType() const; | 4095 virtual CompileType ComputeType() const; |
| 4068 | 4096 |
| 4069 virtual bool CanDeoptimize() const { return false; } | 4097 virtual bool CanDeoptimize() const { return false; } |
| 4070 | 4098 |
| 4071 virtual bool HasSideEffect() const { return false; } | 4099 virtual bool HasSideEffect() const { return false; } |
| 4072 | 4100 |
| 4073 virtual Representation representation() const { | 4101 virtual Representation representation() const { |
| 4074 return kUnboxedDouble; | 4102 return kUnboxedDouble; |
| 4075 } | 4103 } |
| 4076 | 4104 |
| 4077 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 4105 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 4098 deopt_id_ = instance_call->deopt_id(); | 4126 deopt_id_ = instance_call->deopt_id(); |
| 4099 } | 4127 } |
| 4100 | 4128 |
| 4101 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); | 4129 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); |
| 4102 | 4130 |
| 4103 const RuntimeEntry& TargetFunction() const; | 4131 const RuntimeEntry& TargetFunction() const; |
| 4104 | 4132 |
| 4105 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } | 4133 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } |
| 4106 | 4134 |
| 4107 DECLARE_INSTRUCTION(InvokeMathCFunction) | 4135 DECLARE_INSTRUCTION(InvokeMathCFunction) |
| 4108 virtual CompileType* ComputeInitialType() const; | 4136 virtual CompileType ComputeType() const; |
| 4109 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4137 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4110 | 4138 |
| 4111 virtual bool CanDeoptimize() const { return false; } | 4139 virtual bool CanDeoptimize() const { return false; } |
| 4112 | 4140 |
| 4113 virtual bool HasSideEffect() const { return false; } | 4141 virtual bool HasSideEffect() const { return false; } |
| 4114 | 4142 |
| 4115 virtual Representation representation() const { | 4143 virtual Representation representation() const { |
| 4116 return kUnboxedDouble; | 4144 return kUnboxedDouble; |
| 4117 } | 4145 } |
| 4118 | 4146 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4486 ForwardInstructionIterator* current_iterator_; | 4514 ForwardInstructionIterator* current_iterator_; |
| 4487 | 4515 |
| 4488 private: | 4516 private: |
| 4489 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4517 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4490 }; | 4518 }; |
| 4491 | 4519 |
| 4492 | 4520 |
| 4493 } // namespace dart | 4521 } // namespace dart |
| 4494 | 4522 |
| 4495 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4523 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |