OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 7252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7263 } | 7263 } |
7264 | 7264 |
7265 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7265 Representation RequiredInputRepresentation(int index) OVERRIDE { |
7266 return Representation::Tagged(); | 7266 return Representation::Tagged(); |
7267 } | 7267 } |
7268 | 7268 |
7269 HValue* object() const { return OperandAt(0); } | 7269 HValue* object() const { return OperandAt(0); } |
7270 HValue* context() const { return OperandAt(1); } | 7270 HValue* context() const { return OperandAt(1); } |
7271 Unique<Map> original_map() const { return original_map_; } | 7271 Unique<Map> original_map() const { return original_map_; } |
7272 Unique<Map> transitioned_map() const { return transitioned_map_; } | 7272 Unique<Map> transitioned_map() const { return transitioned_map_; } |
7273 ElementsKind from_kind() const { return from_kind_; } | 7273 ElementsKind from_kind() const { |
7274 ElementsKind to_kind() const { return to_kind_; } | 7274 return FromElementsKindField::decode(bit_field_); |
| 7275 } |
| 7276 ElementsKind to_kind() const { |
| 7277 return ToElementsKindField::decode(bit_field_); |
| 7278 } |
| 7279 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } |
7275 | 7280 |
7276 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7281 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
7277 | 7282 |
7278 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 7283 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
7279 | 7284 |
7280 protected: | 7285 protected: |
7281 bool DataEquals(HValue* other) OVERRIDE { | 7286 bool DataEquals(HValue* other) OVERRIDE { |
7282 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 7287 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
7283 return original_map_ == instr->original_map_ && | 7288 return original_map_ == instr->original_map_ && |
7284 transitioned_map_ == instr->transitioned_map_; | 7289 transitioned_map_ == instr->transitioned_map_; |
7285 } | 7290 } |
7286 | 7291 |
7287 int RedefinedOperandIndex() OVERRIDE { return 0; } | 7292 int RedefinedOperandIndex() OVERRIDE { return 0; } |
7288 | 7293 |
7289 private: | 7294 private: |
7290 HTransitionElementsKind(HValue* context, | 7295 HTransitionElementsKind(HValue* context, HValue* object, |
7291 HValue* object, | |
7292 Handle<Map> original_map, | 7296 Handle<Map> original_map, |
7293 Handle<Map> transitioned_map) | 7297 Handle<Map> transitioned_map) |
7294 : original_map_(Unique<Map>(original_map)), | 7298 : original_map_(Unique<Map>(original_map)), |
7295 transitioned_map_(Unique<Map>(transitioned_map)), | 7299 transitioned_map_(Unique<Map>(transitioned_map)), |
7296 from_kind_(original_map->elements_kind()), | 7300 bit_field_( |
7297 to_kind_(transitioned_map->elements_kind()) { | 7301 FromElementsKindField::encode(original_map->elements_kind()) | |
| 7302 ToElementsKindField::encode(transitioned_map->elements_kind()) | |
| 7303 MapIsStableField::encode(transitioned_map->is_stable())) { |
7298 SetOperandAt(0, object); | 7304 SetOperandAt(0, object); |
7299 SetOperandAt(1, context); | 7305 SetOperandAt(1, context); |
7300 SetFlag(kUseGVN); | 7306 SetFlag(kUseGVN); |
7301 SetChangesFlag(kElementsKind); | 7307 SetChangesFlag(kElementsKind); |
7302 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { | 7308 if (!IsSimpleMapChangeTransition(from_kind(), to_kind())) { |
7303 SetChangesFlag(kElementsPointer); | 7309 SetChangesFlag(kElementsPointer); |
7304 SetChangesFlag(kNewSpacePromotion); | 7310 SetChangesFlag(kNewSpacePromotion); |
7305 } | 7311 } |
7306 set_representation(Representation::Tagged()); | 7312 set_representation(Representation::Tagged()); |
7307 } | 7313 } |
7308 | 7314 |
| 7315 class FromElementsKindField : public BitField<ElementsKind, 0, 5> {}; |
| 7316 class ToElementsKindField : public BitField<ElementsKind, 5, 5> {}; |
| 7317 class MapIsStableField : public BitField<bool, 10, 1> {}; |
| 7318 |
7309 Unique<Map> original_map_; | 7319 Unique<Map> original_map_; |
7310 Unique<Map> transitioned_map_; | 7320 Unique<Map> transitioned_map_; |
7311 ElementsKind from_kind_; | 7321 uint32_t bit_field_; |
7312 ElementsKind to_kind_; | |
7313 }; | 7322 }; |
7314 | 7323 |
7315 | 7324 |
7316 class HStringAdd FINAL : public HBinaryOperation { | 7325 class HStringAdd FINAL : public HBinaryOperation { |
7317 public: | 7326 public: |
7318 static HInstruction* New( | 7327 static HInstruction* New( |
7319 Isolate* isolate, Zone* zone, HValue* context, HValue* left, | 7328 Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
7320 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, | 7329 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, |
7321 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7330 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
7322 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 7331 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7937 }; | 7946 }; |
7938 | 7947 |
7939 | 7948 |
7940 | 7949 |
7941 #undef DECLARE_INSTRUCTION | 7950 #undef DECLARE_INSTRUCTION |
7942 #undef DECLARE_CONCRETE_INSTRUCTION | 7951 #undef DECLARE_CONCRETE_INSTRUCTION |
7943 | 7952 |
7944 } } // namespace v8::internal | 7953 } } // namespace v8::internal |
7945 | 7954 |
7946 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7955 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |