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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1462 | 1462 |
1463 void PrintBaseName(std::ostream& os) const override; // NOLINT | 1463 void PrintBaseName(std::ostream& os) const override; // NOLINT |
1464 | 1464 |
1465 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1465 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1466 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1466 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1467 }; | 1467 }; |
1468 | 1468 |
1469 | 1469 |
1470 class CompareICStub : public PlatformCodeStub { | 1470 class CompareICStub : public PlatformCodeStub { |
1471 public: | 1471 public: |
1472 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, | 1472 CompareICStub(Isolate* isolate, Token::Value op, bool strong, |
rossberg
2015/05/08 13:54:36
Use LanguageMode here
conradw
2015/05/08 14:08:21
After offline discussion, keeping bool for now. Wi
| |
1473 CompareICState::State right, CompareICState::State state) | 1473 CompareICState::State left, CompareICState::State right, |
1474 CompareICState::State state) | |
1474 : PlatformCodeStub(isolate) { | 1475 : PlatformCodeStub(isolate) { |
1475 DCHECK(Token::IsCompareOp(op)); | 1476 DCHECK(Token::IsCompareOp(op)); |
1476 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | | 1477 minor_key_ = OpBits::encode(op - Token::EQ) | StrongBits::encode(strong) | |
1477 RightStateBits::encode(right) | StateBits::encode(state); | 1478 LeftStateBits::encode(left) | RightStateBits::encode(right) | |
1479 StateBits::encode(state); | |
1478 } | 1480 } |
1479 | 1481 |
1480 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1482 void set_known_map(Handle<Map> map) { known_map_ = map; } |
1481 | 1483 |
1482 InlineCacheState GetICState() const override; | 1484 InlineCacheState GetICState() const override; |
1483 | 1485 |
1484 Token::Value op() const { | 1486 Token::Value op() const { |
1485 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1487 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
1486 } | 1488 } |
1487 | 1489 |
1490 bool strong() const { return StrongBits::decode(minor_key_); } | |
1491 | |
1488 CompareICState::State left() const { | 1492 CompareICState::State left() const { |
1489 return LeftStateBits::decode(minor_key_); | 1493 return LeftStateBits::decode(minor_key_); |
1490 } | 1494 } |
1491 CompareICState::State right() const { | 1495 CompareICState::State right() const { |
1492 return RightStateBits::decode(minor_key_); | 1496 return RightStateBits::decode(minor_key_); |
1493 } | 1497 } |
1494 CompareICState::State state() const { return StateBits::decode(minor_key_); } | 1498 CompareICState::State state() const { return StateBits::decode(minor_key_); } |
1495 | 1499 |
1496 private: | 1500 private: |
1497 Code::Kind GetCodeKind() const override { return Code::COMPARE_IC; } | 1501 Code::Kind GetCodeKind() const override { return Code::COMPARE_IC; } |
(...skipping 11 matching lines...) Expand all Loading... | |
1509 bool strict() const { return op() == Token::EQ_STRICT; } | 1513 bool strict() const { return op() == Token::EQ_STRICT; } |
1510 Condition GetCondition() const; | 1514 Condition GetCondition() const; |
1511 | 1515 |
1512 void AddToSpecialCache(Handle<Code> new_object) override; | 1516 void AddToSpecialCache(Handle<Code> new_object) override; |
1513 bool FindCodeInSpecialCache(Code** code_out) override; | 1517 bool FindCodeInSpecialCache(Code** code_out) override; |
1514 bool UseSpecialCache() override { | 1518 bool UseSpecialCache() override { |
1515 return state() == CompareICState::KNOWN_OBJECT; | 1519 return state() == CompareICState::KNOWN_OBJECT; |
1516 } | 1520 } |
1517 | 1521 |
1518 class OpBits : public BitField<int, 0, 3> {}; | 1522 class OpBits : public BitField<int, 0, 3> {}; |
1519 class LeftStateBits : public BitField<CompareICState::State, 3, 4> {}; | 1523 class StrongBits : public BitField<bool, 3, 1> {}; |
1520 class RightStateBits : public BitField<CompareICState::State, 7, 4> {}; | 1524 class LeftStateBits : public BitField<CompareICState::State, 4, 4> {}; |
1521 class StateBits : public BitField<CompareICState::State, 11, 4> {}; | 1525 class RightStateBits : public BitField<CompareICState::State, 8, 4> {}; |
1526 class StateBits : public BitField<CompareICState::State, 12, 4> {}; | |
1522 | 1527 |
1523 Handle<Map> known_map_; | 1528 Handle<Map> known_map_; |
1524 | 1529 |
1525 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1530 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
1526 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); | 1531 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); |
1527 }; | 1532 }; |
1528 | 1533 |
1529 | 1534 |
1530 class CompareNilICStub : public HydrogenCodeStub { | 1535 class CompareNilICStub : public HydrogenCodeStub { |
1531 public: | 1536 public: |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2835 | 2840 |
2836 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2841 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2837 #undef DEFINE_PLATFORM_CODE_STUB | 2842 #undef DEFINE_PLATFORM_CODE_STUB |
2838 #undef DEFINE_HANDLER_CODE_STUB | 2843 #undef DEFINE_HANDLER_CODE_STUB |
2839 #undef DEFINE_HYDROGEN_CODE_STUB | 2844 #undef DEFINE_HYDROGEN_CODE_STUB |
2840 #undef DEFINE_CODE_STUB | 2845 #undef DEFINE_CODE_STUB |
2841 #undef DEFINE_CODE_STUB_BASE | 2846 #undef DEFINE_CODE_STUB_BASE |
2842 } } // namespace v8::internal | 2847 } } // namespace v8::internal |
2843 | 2848 |
2844 #endif // V8_CODE_STUBS_H_ | 2849 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |