| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 V(ArrayNoArgumentConstructor) \ | 76 V(ArrayNoArgumentConstructor) \ |
| 77 V(ArraySingleArgumentConstructor) \ | 77 V(ArraySingleArgumentConstructor) \ |
| 78 V(ArrayNArgumentsConstructor) \ | 78 V(ArrayNArgumentsConstructor) \ |
| 79 V(KeyedStoreElement) \ | 79 V(KeyedStoreElement) \ |
| 80 V(DebuggerStatement) \ | 80 V(DebuggerStatement) \ |
| 81 V(StringDictionaryLookup) \ | 81 V(StringDictionaryLookup) \ |
| 82 V(ElementsTransitionAndStore) \ | 82 V(ElementsTransitionAndStore) \ |
| 83 V(TransitionElementsKind) \ | 83 V(TransitionElementsKind) \ |
| 84 V(StoreArrayLiteralElement) \ | 84 V(StoreArrayLiteralElement) \ |
| 85 V(StubFailureTrampoline) \ | 85 V(StubFailureTrampoline) \ |
| 86 V(ProfileEntryHook) | 86 V(ProfileEntryHook) \ |
| 87 /* IC Handler stubs */ \ |
| 88 V(LoadField) |
| 87 | 89 |
| 88 // List of code stubs only used on ARM platforms. | 90 // List of code stubs only used on ARM platforms. |
| 89 #ifdef V8_TARGET_ARCH_ARM | 91 #ifdef V8_TARGET_ARCH_ARM |
| 90 #define CODE_STUB_LIST_ARM(V) \ | 92 #define CODE_STUB_LIST_ARM(V) \ |
| 91 V(GetProperty) \ | 93 V(GetProperty) \ |
| 92 V(SetProperty) \ | 94 V(SetProperty) \ |
| 93 V(InvokeBuiltin) \ | 95 V(InvokeBuiltin) \ |
| 94 V(RegExpCEntry) \ | 96 V(RegExpCEntry) \ |
| 95 V(DirectCEntry) | 97 V(DirectCEntry) |
| 96 #else | 98 #else |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Generates the assembler code for the stub. | 183 // Generates the assembler code for the stub. |
| 182 virtual Handle<Code> GenerateCode() = 0; | 184 virtual Handle<Code> GenerateCode() = 0; |
| 183 | 185 |
| 184 // BinaryOpStub needs to override this. | 186 // BinaryOpStub needs to override this. |
| 185 virtual InlineCacheState GetICState() { | 187 virtual InlineCacheState GetICState() { |
| 186 return UNINITIALIZED; | 188 return UNINITIALIZED; |
| 187 } | 189 } |
| 188 virtual Code::ExtraICState GetExtraICState() { | 190 virtual Code::ExtraICState GetExtraICState() { |
| 189 return Code::kNoExtraICState; | 191 return Code::kNoExtraICState; |
| 190 } | 192 } |
| 193 virtual Code::StubType GetStubType() { |
| 194 return Code::NORMAL; |
| 195 } |
| 191 | 196 |
| 192 // Returns whether the code generated for this stub needs to be allocated as | 197 // Returns whether the code generated for this stub needs to be allocated as |
| 193 // a fixed (non-moveable) code object. | 198 // a fixed (non-moveable) code object. |
| 194 virtual bool NeedsImmovableCode() { return false; } | 199 virtual bool NeedsImmovableCode() { return false; } |
| 195 | 200 |
| 196 private: | 201 private: |
| 197 // Perform bookkeeping required after code generation when stub code is | 202 // Perform bookkeeping required after code generation when stub code is |
| 198 // initially generated. | 203 // initially generated. |
| 199 void RecordCodeGeneration(Code* code, Isolate* isolate); | 204 void RecordCodeGeneration(Code* code, Isolate* isolate); |
| 200 | 205 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 }; | 609 }; |
| 605 | 610 |
| 606 | 611 |
| 607 class StringLengthStub: public ICStub { | 612 class StringLengthStub: public ICStub { |
| 608 public: | 613 public: |
| 609 StringLengthStub(Code::Kind kind, bool support_wrapper) | 614 StringLengthStub(Code::Kind kind, bool support_wrapper) |
| 610 : ICStub(kind), support_wrapper_(support_wrapper) { } | 615 : ICStub(kind), support_wrapper_(support_wrapper) { } |
| 611 virtual void Generate(MacroAssembler* masm); | 616 virtual void Generate(MacroAssembler* masm); |
| 612 | 617 |
| 613 private: | 618 private: |
| 619 STATIC_ASSERT(KindBits::kSize == 4); |
| 614 class WrapperModeBits: public BitField<bool, 4, 1> {}; | 620 class WrapperModeBits: public BitField<bool, 4, 1> {}; |
| 615 virtual CodeStub::Major MajorKey() { return StringLength; } | 621 virtual CodeStub::Major MajorKey() { return StringLength; } |
| 616 virtual int MinorKey() { | 622 virtual int MinorKey() { |
| 617 return KindBits::encode(kind()) | WrapperModeBits::encode(support_wrapper_); | 623 return KindBits::encode(kind()) | WrapperModeBits::encode(support_wrapper_); |
| 618 } | 624 } |
| 619 | 625 |
| 620 bool support_wrapper_; | 626 bool support_wrapper_; |
| 621 }; | 627 }; |
| 622 | 628 |
| 623 | 629 |
| 624 class StoreICStub: public ICStub { | 630 class StoreICStub: public ICStub { |
| 625 public: | 631 public: |
| 626 StoreICStub(Code::Kind kind, StrictModeFlag strict_mode) | 632 StoreICStub(Code::Kind kind, StrictModeFlag strict_mode) |
| 627 : ICStub(kind), strict_mode_(strict_mode) { } | 633 : ICStub(kind), strict_mode_(strict_mode) { } |
| 628 | 634 |
| 629 protected: | 635 protected: |
| 630 virtual Code::ExtraICState GetExtraICState() { | 636 virtual Code::ExtraICState GetExtraICState() { |
| 631 return strict_mode_; | 637 return strict_mode_; |
| 632 } | 638 } |
| 633 | 639 |
| 634 private: | 640 private: |
| 641 STATIC_ASSERT(KindBits::kSize == 4); |
| 635 class StrictModeBits: public BitField<bool, 4, 1> {}; | 642 class StrictModeBits: public BitField<bool, 4, 1> {}; |
| 636 virtual int MinorKey() { | 643 virtual int MinorKey() { |
| 637 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); | 644 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); |
| 638 } | 645 } |
| 639 | 646 |
| 640 StrictModeFlag strict_mode_; | 647 StrictModeFlag strict_mode_; |
| 641 }; | 648 }; |
| 642 | 649 |
| 643 | 650 |
| 644 class StoreArrayLengthStub: public StoreICStub { | 651 class StoreArrayLengthStub: public StoreICStub { |
| 645 public: | 652 public: |
| 646 explicit StoreArrayLengthStub(Code::Kind kind, StrictModeFlag strict_mode) | 653 explicit StoreArrayLengthStub(Code::Kind kind, StrictModeFlag strict_mode) |
| 647 : StoreICStub(kind, strict_mode) { } | 654 : StoreICStub(kind, strict_mode) { } |
| 648 virtual void Generate(MacroAssembler* masm); | 655 virtual void Generate(MacroAssembler* masm); |
| 649 | 656 |
| 650 private: | 657 private: |
| 651 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } | 658 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } |
| 652 }; | 659 }; |
| 653 | 660 |
| 654 | 661 |
| 662 class HandlerStub: public ICStub { |
| 663 public: |
| 664 explicit HandlerStub(Code::Kind kind) : ICStub(kind) { } |
| 665 |
| 666 protected: |
| 667 virtual Code::ExtraICState GetExtraICState() { |
| 668 return Code::HANDLER_FRAGMENT; |
| 669 } |
| 670 }; |
| 671 |
| 672 |
| 673 class LoadFieldStub: public HandlerStub { |
| 674 public: |
| 675 LoadFieldStub(Register reg, bool inobject, int index) |
| 676 : HandlerStub(Code::LOAD_IC), |
| 677 reg_(reg), |
| 678 inobject_(inobject), |
| 679 index_(index) { } |
| 680 virtual void Generate(MacroAssembler* masm); |
| 681 |
| 682 protected: |
| 683 virtual Code::StubType GetStubType() { return Code::FIELD; } |
| 684 |
| 685 private: |
| 686 STATIC_ASSERT(KindBits::kSize == 4); |
| 687 class RegisterBits: public BitField<int, 4, 6> {}; |
| 688 class InobjectBits: public BitField<bool, 10, 1> {}; |
| 689 class IndexBits: public BitField<int, 11, 11> {}; |
| 690 virtual CodeStub::Major MajorKey() { return LoadField; } |
| 691 virtual int MinorKey() { |
| 692 return KindBits::encode(kind()) |
| 693 | RegisterBits::encode(reg_.code()) |
| 694 | InobjectBits::encode(inobject_) |
| 695 | IndexBits::encode(index_); |
| 696 } |
| 697 |
| 698 Register reg_; |
| 699 bool inobject_; |
| 700 int index_; |
| 701 }; |
| 702 |
| 703 |
| 655 class BinaryOpStub: public PlatformCodeStub { | 704 class BinaryOpStub: public PlatformCodeStub { |
| 656 public: | 705 public: |
| 657 BinaryOpStub(Token::Value op, OverwriteMode mode) | 706 BinaryOpStub(Token::Value op, OverwriteMode mode) |
| 658 : op_(op), | 707 : op_(op), |
| 659 mode_(mode), | 708 mode_(mode), |
| 660 platform_specific_bit_(false), | 709 platform_specific_bit_(false), |
| 661 left_type_(BinaryOpIC::UNINITIALIZED), | 710 left_type_(BinaryOpIC::UNINITIALIZED), |
| 662 right_type_(BinaryOpIC::UNINITIALIZED), | 711 right_type_(BinaryOpIC::UNINITIALIZED), |
| 663 result_type_(BinaryOpIC::UNINITIALIZED) { | 712 result_type_(BinaryOpIC::UNINITIALIZED) { |
| 664 Initialize(); | 713 Initialize(); |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 | 1614 |
| 1566 // The current function entry hook. | 1615 // The current function entry hook. |
| 1567 static FunctionEntryHook entry_hook_; | 1616 static FunctionEntryHook entry_hook_; |
| 1568 | 1617 |
| 1569 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1618 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1570 }; | 1619 }; |
| 1571 | 1620 |
| 1572 } } // namespace v8::internal | 1621 } } // namespace v8::internal |
| 1573 | 1622 |
| 1574 #endif // V8_CODE_STUBS_H_ | 1623 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |