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

Side by Side Diff: src/code-stubs.h

Issue 1693833002: Remove strong mode support from binary operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 4 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
OLDNEW
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_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 public: 1489 public:
1490 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 1490 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1491 1491
1492 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); 1492 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter);
1493 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); 1493 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub);
1494 }; 1494 };
1495 1495
1496 1496
1497 class BinaryOpICStub : public HydrogenCodeStub { 1497 class BinaryOpICStub : public HydrogenCodeStub {
1498 public: 1498 public:
1499 BinaryOpICStub(Isolate* isolate, Token::Value op, Strength strength) 1499 BinaryOpICStub(Isolate* isolate, Token::Value op)
1500 : HydrogenCodeStub(isolate, UNINITIALIZED) { 1500 : HydrogenCodeStub(isolate, UNINITIALIZED) {
1501 BinaryOpICState state(isolate, op, strength); 1501 BinaryOpICState state(isolate, op);
1502 set_sub_minor_key(state.GetExtraICState()); 1502 set_sub_minor_key(state.GetExtraICState());
1503 } 1503 }
1504 1504
1505 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) 1505 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state)
1506 : HydrogenCodeStub(isolate) { 1506 : HydrogenCodeStub(isolate) {
1507 set_sub_minor_key(state.GetExtraICState()); 1507 set_sub_minor_key(state.GetExtraICState());
1508 } 1508 }
1509 1509
1510 static void GenerateAheadOfTime(Isolate* isolate); 1510 static void GenerateAheadOfTime(Isolate* isolate);
1511 1511
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 static void GenerateAheadOfTime(Isolate* isolate, 1572 static void GenerateAheadOfTime(Isolate* isolate,
1573 const BinaryOpICState& state); 1573 const BinaryOpICState& state);
1574 1574
1575 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); 1575 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
1576 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); 1576 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub);
1577 }; 1577 };
1578 1578
1579 1579
1580 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { 1580 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub {
1581 public: 1581 public:
1582 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op, 1582 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op)
1583 Strength strength) 1583 : BinaryOpICStub(isolate, op) {}
1584 : BinaryOpICStub(isolate, op, strength) {}
1585 1584
1586 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) 1585 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state)
1587 : BinaryOpICStub(isolate, state) {} 1586 : BinaryOpICStub(isolate, state) {}
1588 1587
1589 Code::Kind GetCodeKind() const final { return Code::STUB; } 1588 Code::Kind GetCodeKind() const final { return Code::STUB; }
1590 1589
1591 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1590 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1592 static const int kAllocationSite = 0; 1591 static const int kAllocationSite = 0;
1593 static const int kLeft = 1; 1592 static const int kLeft = 1;
1594 static const int kRight = 2; 1593 static const int kRight = 2;
(...skipping 30 matching lines...) Expand all
1625 1624
1626 void PrintBaseName(std::ostream& os) const override; // NOLINT 1625 void PrintBaseName(std::ostream& os) const override; // NOLINT
1627 1626
1628 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); 1627 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd);
1629 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); 1628 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub);
1630 }; 1629 };
1631 1630
1632 1631
1633 class CompareICStub : public PlatformCodeStub { 1632 class CompareICStub : public PlatformCodeStub {
1634 public: 1633 public:
1635 CompareICStub(Isolate* isolate, Token::Value op, Strength strength, 1634 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left,
1636 CompareICState::State left, CompareICState::State right, 1635 CompareICState::State right, CompareICState::State state)
1637 CompareICState::State state)
1638 : PlatformCodeStub(isolate) { 1636 : PlatformCodeStub(isolate) {
1639 DCHECK(Token::IsCompareOp(op)); 1637 DCHECK(Token::IsCompareOp(op));
1640 minor_key_ = OpBits::encode(op - Token::EQ) | 1638 minor_key_ = OpBits::encode(op - Token::EQ) |
1641 StrengthBits::encode(is_strong(strength)) |
1642 LeftStateBits::encode(left) | RightStateBits::encode(right) | 1639 LeftStateBits::encode(left) | RightStateBits::encode(right) |
1643 StateBits::encode(state); 1640 StateBits::encode(state);
1644 } 1641 }
1645 1642
1646 void set_known_map(Handle<Map> map) { known_map_ = map; } 1643 void set_known_map(Handle<Map> map) { known_map_ = map; }
1647 1644
1648 InlineCacheState GetICState() const override; 1645 InlineCacheState GetICState() const override;
1649 1646
1650 Token::Value op() const { 1647 Token::Value op() const {
1651 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); 1648 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
1652 } 1649 }
1653 1650
1654 Strength strength() const {
1655 return StrengthBits::decode(minor_key_) ? Strength::STRONG : Strength::WEAK;
1656 }
1657
1658 CompareICState::State left() const { 1651 CompareICState::State left() const {
1659 return LeftStateBits::decode(minor_key_); 1652 return LeftStateBits::decode(minor_key_);
1660 } 1653 }
1661 CompareICState::State right() const { 1654 CompareICState::State right() const {
1662 return RightStateBits::decode(minor_key_); 1655 return RightStateBits::decode(minor_key_);
1663 } 1656 }
1664 CompareICState::State state() const { return StateBits::decode(minor_key_); } 1657 CompareICState::State state() const { return StateBits::decode(minor_key_); }
1665 1658
1666 private: 1659 private:
1667 Code::Kind GetCodeKind() const override { return Code::COMPARE_IC; } 1660 Code::Kind GetCodeKind() const override { return Code::COMPARE_IC; }
(...skipping 12 matching lines...) Expand all
1680 bool strict() const { return op() == Token::EQ_STRICT; } 1673 bool strict() const { return op() == Token::EQ_STRICT; }
1681 Condition GetCondition() const; 1674 Condition GetCondition() const;
1682 1675
1683 void AddToSpecialCache(Handle<Code> new_object) override; 1676 void AddToSpecialCache(Handle<Code> new_object) override;
1684 bool FindCodeInSpecialCache(Code** code_out) override; 1677 bool FindCodeInSpecialCache(Code** code_out) override;
1685 bool UseSpecialCache() override { 1678 bool UseSpecialCache() override {
1686 return state() == CompareICState::KNOWN_RECEIVER; 1679 return state() == CompareICState::KNOWN_RECEIVER;
1687 } 1680 }
1688 1681
1689 class OpBits : public BitField<int, 0, 3> {}; 1682 class OpBits : public BitField<int, 0, 3> {};
1690 class StrengthBits : public BitField<bool, 3, 1> {}; 1683 class LeftStateBits : public BitField<CompareICState::State, 3, 4> {};
1691 class LeftStateBits : public BitField<CompareICState::State, 4, 4> {}; 1684 class RightStateBits : public BitField<CompareICState::State, 7, 4> {};
1692 class RightStateBits : public BitField<CompareICState::State, 8, 4> {}; 1685 class StateBits : public BitField<CompareICState::State, 11, 4> {};
1693 class StateBits : public BitField<CompareICState::State, 12, 4> {};
1694 1686
1695 Handle<Map> known_map_; 1687 Handle<Map> known_map_;
1696 1688
1697 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); 1689 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp);
1698 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); 1690 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub);
1699 }; 1691 };
1700 1692
1701 1693
1702 class CompareNilICStub : public HydrogenCodeStub { 1694 class CompareNilICStub : public HydrogenCodeStub {
1703 public: 1695 public:
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 #undef DEFINE_HYDROGEN_CODE_STUB 2964 #undef DEFINE_HYDROGEN_CODE_STUB
2973 #undef DEFINE_CODE_STUB 2965 #undef DEFINE_CODE_STUB
2974 #undef DEFINE_CODE_STUB_BASE 2966 #undef DEFINE_CODE_STUB_BASE
2975 2967
2976 extern Representation RepresentationFromType(Type* type); 2968 extern Representation RepresentationFromType(Type* type);
2977 2969
2978 } // namespace internal 2970 } // namespace internal
2979 } // namespace v8 2971 } // namespace v8
2980 2972
2981 #endif // V8_CODE_STUBS_H_ 2973 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | src/code-stubs.cc » ('j') | src/crankshaft/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698