| 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 7330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7341 Unique<Map> original_map_; | 7341 Unique<Map> original_map_; |
| 7342 Unique<Map> transitioned_map_; | 7342 Unique<Map> transitioned_map_; |
| 7343 uint32_t bit_field_; | 7343 uint32_t bit_field_; |
| 7344 }; | 7344 }; |
| 7345 | 7345 |
| 7346 | 7346 |
| 7347 class HStringAdd final : public HBinaryOperation { | 7347 class HStringAdd final : public HBinaryOperation { |
| 7348 public: | 7348 public: |
| 7349 static HInstruction* New( | 7349 static HInstruction* New( |
| 7350 Isolate* isolate, Zone* zone, HValue* context, HValue* left, | 7350 Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
| 7351 HValue* right, Strength strength = Strength::WEAK, | 7351 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, |
| 7352 PretenureFlag pretenure_flag = NOT_TENURED, | |
| 7353 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7352 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
| 7354 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 7353 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
| 7355 | 7354 |
| 7356 StringAddFlags flags() const { return flags_; } | 7355 StringAddFlags flags() const { return flags_; } |
| 7357 PretenureFlag pretenure_flag() const { return pretenure_flag_; } | 7356 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
| 7358 | 7357 |
| 7359 Representation RequiredInputRepresentation(int index) override { | 7358 Representation RequiredInputRepresentation(int index) override { |
| 7360 return Representation::Tagged(); | 7359 return Representation::Tagged(); |
| 7361 } | 7360 } |
| 7362 | 7361 |
| 7363 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 7362 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7364 | 7363 |
| 7365 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 7364 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
| 7366 | 7365 |
| 7367 protected: | 7366 protected: |
| 7368 bool DataEquals(HValue* other) override { | 7367 bool DataEquals(HValue* other) override { |
| 7369 return flags_ == HStringAdd::cast(other)->flags_ && | 7368 return flags_ == HStringAdd::cast(other)->flags_ && |
| 7370 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; | 7369 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
| 7371 } | 7370 } |
| 7372 | 7371 |
| 7373 private: | 7372 private: |
| 7374 HStringAdd(HValue* context, HValue* left, HValue* right, Strength strength, | 7373 HStringAdd(HValue* context, HValue* left, HValue* right, |
| 7375 PretenureFlag pretenure_flag, StringAddFlags flags, | 7374 PretenureFlag pretenure_flag, StringAddFlags flags, |
| 7376 Handle<AllocationSite> allocation_site) | 7375 Handle<AllocationSite> allocation_site) |
| 7377 : HBinaryOperation(context, left, right, strength, HType::String()), | 7376 : HBinaryOperation(context, left, right, Strength::WEAK, HType::String()), |
| 7378 flags_(flags), | 7377 flags_(flags), |
| 7379 pretenure_flag_(pretenure_flag) { | 7378 pretenure_flag_(pretenure_flag) { |
| 7380 set_representation(Representation::Tagged()); | 7379 set_representation(Representation::Tagged()); |
| 7381 SetFlag(kUseGVN); | 7380 if ((flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT) { |
| 7381 SetAllSideEffects(); |
| 7382 ClearFlag(kUseGVN); |
| 7383 } else { |
| 7384 SetChangesFlag(kNewSpacePromotion); |
| 7385 SetFlag(kUseGVN); |
| 7386 } |
| 7382 SetDependsOnFlag(kMaps); | 7387 SetDependsOnFlag(kMaps); |
| 7383 SetChangesFlag(kNewSpacePromotion); | |
| 7384 if (FLAG_trace_pretenuring) { | 7388 if (FLAG_trace_pretenuring) { |
| 7385 PrintF("HStringAdd with AllocationSite %p %s\n", | 7389 PrintF("HStringAdd with AllocationSite %p %s\n", |
| 7386 allocation_site.is_null() | 7390 allocation_site.is_null() |
| 7387 ? static_cast<void*>(NULL) | 7391 ? static_cast<void*>(NULL) |
| 7388 : static_cast<void*>(*allocation_site), | 7392 : static_cast<void*>(*allocation_site), |
| 7389 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 7393 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 7390 } | 7394 } |
| 7391 } | 7395 } |
| 7392 | 7396 |
| 7393 // No side-effects except possible allocation: | 7397 bool IsDeletable() const final { |
| 7394 bool IsDeletable() const override { return true; } | 7398 return (flags_ & STRING_ADD_CONVERT) != STRING_ADD_CONVERT; |
| 7399 } |
| 7395 | 7400 |
| 7396 const StringAddFlags flags_; | 7401 const StringAddFlags flags_; |
| 7397 const PretenureFlag pretenure_flag_; | 7402 const PretenureFlag pretenure_flag_; |
| 7398 }; | 7403 }; |
| 7399 | 7404 |
| 7400 | 7405 |
| 7401 class HStringCharCodeAt final : public HTemplateInstruction<3> { | 7406 class HStringCharCodeAt final : public HTemplateInstruction<3> { |
| 7402 public: | 7407 public: |
| 7403 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, | 7408 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, |
| 7404 HValue*, | 7409 HValue*, |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7969 }; | 7974 }; |
| 7970 | 7975 |
| 7971 | 7976 |
| 7972 | 7977 |
| 7973 #undef DECLARE_INSTRUCTION | 7978 #undef DECLARE_INSTRUCTION |
| 7974 #undef DECLARE_CONCRETE_INSTRUCTION | 7979 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7975 | 7980 |
| 7976 } } // namespace v8::internal | 7981 } } // namespace v8::internal |
| 7977 | 7982 |
| 7978 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7983 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |