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_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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 public: | 1414 public: |
1415 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1415 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1416 | 1416 |
1417 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); | 1417 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
1418 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); | 1418 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1419 }; | 1419 }; |
1420 | 1420 |
1421 | 1421 |
1422 class BinaryOpICStub : public HydrogenCodeStub { | 1422 class BinaryOpICStub : public HydrogenCodeStub { |
1423 public: | 1423 public: |
1424 BinaryOpICStub(Isolate* isolate, Token::Value op, LanguageMode language_mode) | 1424 BinaryOpICStub(Isolate* isolate, Token::Value op, Strength strength) |
1425 : HydrogenCodeStub(isolate, UNINITIALIZED) { | 1425 : HydrogenCodeStub(isolate, UNINITIALIZED) { |
1426 BinaryOpICState state(isolate, op, language_mode); | 1426 BinaryOpICState state(isolate, op, strength); |
1427 set_sub_minor_key(state.GetExtraICState()); | 1427 set_sub_minor_key(state.GetExtraICState()); |
1428 } | 1428 } |
1429 | 1429 |
1430 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) | 1430 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) |
1431 : HydrogenCodeStub(isolate) { | 1431 : HydrogenCodeStub(isolate) { |
1432 set_sub_minor_key(state.GetExtraICState()); | 1432 set_sub_minor_key(state.GetExtraICState()); |
1433 } | 1433 } |
1434 | 1434 |
1435 static void GenerateAheadOfTime(Isolate* isolate); | 1435 static void GenerateAheadOfTime(Isolate* isolate); |
1436 | 1436 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 const BinaryOpICState& state); | 1498 const BinaryOpICState& state); |
1499 | 1499 |
1500 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1500 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
1501 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); | 1501 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
1502 }; | 1502 }; |
1503 | 1503 |
1504 | 1504 |
1505 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { | 1505 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { |
1506 public: | 1506 public: |
1507 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op, | 1507 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op, |
1508 LanguageMode language_mode) | 1508 Strength strength) |
1509 : BinaryOpICStub(isolate, op, language_mode) {} | 1509 : BinaryOpICStub(isolate, op, strength) {} |
1510 | 1510 |
1511 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) | 1511 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) |
1512 : BinaryOpICStub(isolate, state) {} | 1512 : BinaryOpICStub(isolate, state) {} |
1513 | 1513 |
1514 Code::Kind GetCodeKind() const final { return Code::STUB; } | 1514 Code::Kind GetCodeKind() const final { return Code::STUB; } |
1515 | 1515 |
1516 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1516 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1517 static const int kAllocationSite = 0; | 1517 static const int kAllocationSite = 0; |
1518 static const int kLeft = 1; | 1518 static const int kLeft = 1; |
1519 static const int kRight = 2; | 1519 static const int kRight = 2; |
(...skipping 30 matching lines...) Expand all Loading... |
1550 | 1550 |
1551 void PrintBaseName(std::ostream& os) const override; // NOLINT | 1551 void PrintBaseName(std::ostream& os) const override; // NOLINT |
1552 | 1552 |
1553 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1553 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1554 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1554 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1555 }; | 1555 }; |
1556 | 1556 |
1557 | 1557 |
1558 class CompareICStub : public PlatformCodeStub { | 1558 class CompareICStub : public PlatformCodeStub { |
1559 public: | 1559 public: |
1560 CompareICStub(Isolate* isolate, Token::Value op, bool strong, | 1560 CompareICStub(Isolate* isolate, Token::Value op, Strength strength, |
1561 CompareICState::State left, CompareICState::State right, | 1561 CompareICState::State left, CompareICState::State right, |
1562 CompareICState::State state) | 1562 CompareICState::State state) |
1563 : PlatformCodeStub(isolate) { | 1563 : PlatformCodeStub(isolate) { |
1564 DCHECK(Token::IsCompareOp(op)); | 1564 DCHECK(Token::IsCompareOp(op)); |
1565 minor_key_ = OpBits::encode(op - Token::EQ) | StrongBits::encode(strong) | | 1565 minor_key_ = OpBits::encode(op - Token::EQ) | |
| 1566 StrengthBits::encode(is_strong(strength)) | |
1566 LeftStateBits::encode(left) | RightStateBits::encode(right) | | 1567 LeftStateBits::encode(left) | RightStateBits::encode(right) | |
1567 StateBits::encode(state); | 1568 StateBits::encode(state); |
1568 } | 1569 } |
1569 | 1570 |
1570 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1571 void set_known_map(Handle<Map> map) { known_map_ = map; } |
1571 | 1572 |
1572 InlineCacheState GetICState() const override; | 1573 InlineCacheState GetICState() const override; |
1573 | 1574 |
1574 Token::Value op() const { | 1575 Token::Value op() const { |
1575 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1576 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
1576 } | 1577 } |
1577 | 1578 |
1578 bool strong() const { return StrongBits::decode(minor_key_); } | 1579 Strength strength() const { |
| 1580 return StrengthBits::decode(minor_key_) ? Strength::STRONG : Strength::WEAK; |
| 1581 } |
1579 | 1582 |
1580 CompareICState::State left() const { | 1583 CompareICState::State left() const { |
1581 return LeftStateBits::decode(minor_key_); | 1584 return LeftStateBits::decode(minor_key_); |
1582 } | 1585 } |
1583 CompareICState::State right() const { | 1586 CompareICState::State right() const { |
1584 return RightStateBits::decode(minor_key_); | 1587 return RightStateBits::decode(minor_key_); |
1585 } | 1588 } |
1586 CompareICState::State state() const { return StateBits::decode(minor_key_); } | 1589 CompareICState::State state() const { return StateBits::decode(minor_key_); } |
1587 | 1590 |
1588 private: | 1591 private: |
(...skipping 12 matching lines...) Expand all Loading... |
1601 bool strict() const { return op() == Token::EQ_STRICT; } | 1604 bool strict() const { return op() == Token::EQ_STRICT; } |
1602 Condition GetCondition() const; | 1605 Condition GetCondition() const; |
1603 | 1606 |
1604 void AddToSpecialCache(Handle<Code> new_object) override; | 1607 void AddToSpecialCache(Handle<Code> new_object) override; |
1605 bool FindCodeInSpecialCache(Code** code_out) override; | 1608 bool FindCodeInSpecialCache(Code** code_out) override; |
1606 bool UseSpecialCache() override { | 1609 bool UseSpecialCache() override { |
1607 return state() == CompareICState::KNOWN_OBJECT; | 1610 return state() == CompareICState::KNOWN_OBJECT; |
1608 } | 1611 } |
1609 | 1612 |
1610 class OpBits : public BitField<int, 0, 3> {}; | 1613 class OpBits : public BitField<int, 0, 3> {}; |
1611 class StrongBits : public BitField<bool, 3, 1> {}; | 1614 class StrengthBits : public BitField<bool, 3, 1> {}; |
1612 class LeftStateBits : public BitField<CompareICState::State, 4, 4> {}; | 1615 class LeftStateBits : public BitField<CompareICState::State, 4, 4> {}; |
1613 class RightStateBits : public BitField<CompareICState::State, 8, 4> {}; | 1616 class RightStateBits : public BitField<CompareICState::State, 8, 4> {}; |
1614 class StateBits : public BitField<CompareICState::State, 12, 4> {}; | 1617 class StateBits : public BitField<CompareICState::State, 12, 4> {}; |
1615 | 1618 |
1616 Handle<Map> known_map_; | 1619 Handle<Map> known_map_; |
1617 | 1620 |
1618 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1621 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
1619 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); | 1622 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); |
1620 }; | 1623 }; |
1621 | 1624 |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 | 2969 |
2967 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2970 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2968 #undef DEFINE_PLATFORM_CODE_STUB | 2971 #undef DEFINE_PLATFORM_CODE_STUB |
2969 #undef DEFINE_HANDLER_CODE_STUB | 2972 #undef DEFINE_HANDLER_CODE_STUB |
2970 #undef DEFINE_HYDROGEN_CODE_STUB | 2973 #undef DEFINE_HYDROGEN_CODE_STUB |
2971 #undef DEFINE_CODE_STUB | 2974 #undef DEFINE_CODE_STUB |
2972 #undef DEFINE_CODE_STUB_BASE | 2975 #undef DEFINE_CODE_STUB_BASE |
2973 } } // namespace v8::internal | 2976 } } // namespace v8::internal |
2974 | 2977 |
2975 #endif // V8_CODE_STUBS_H_ | 2978 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |