| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 774   virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 774   virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 
| 775   virtual int GetStubFlags() { return kind(); } | 775   virtual int GetStubFlags() { return kind(); } | 
| 776 | 776 | 
| 777  protected: | 777  protected: | 
| 778   HandlerStub() : HICStub() { } | 778   HandlerStub() : HICStub() { } | 
| 779 }; | 779 }; | 
| 780 | 780 | 
| 781 | 781 | 
| 782 class LoadFieldStub: public HandlerStub { | 782 class LoadFieldStub: public HandlerStub { | 
| 783  public: | 783  public: | 
| 784   LoadFieldStub(bool inobject, int index) : HandlerStub() { | 784   LoadFieldStub(bool inobject, int index, Representation representation) | 
| 785     Initialize(Code::LOAD_IC, inobject, index); | 785       : HandlerStub() { | 
|  | 786     Initialize(Code::LOAD_IC, inobject, index, representation); | 
| 786   } | 787   } | 
| 787 | 788 | 
| 788   virtual Handle<Code> GenerateCode(); | 789   virtual Handle<Code> GenerateCode(); | 
| 789 | 790 | 
| 790   virtual void InitializeInterfaceDescriptor( | 791   virtual void InitializeInterfaceDescriptor( | 
| 791       Isolate* isolate, | 792       Isolate* isolate, | 
| 792       CodeStubInterfaceDescriptor* descriptor); | 793       CodeStubInterfaceDescriptor* descriptor); | 
| 793 | 794 | 
| 794   Representation representation() { | 795   Representation representation() { | 
|  | 796     if (unboxed_double()) return Representation::Double(); | 
| 795     return Representation::Tagged(); | 797     return Representation::Tagged(); | 
| 796   } | 798   } | 
| 797 | 799 | 
| 798   virtual Code::Kind kind() const { | 800   virtual Code::Kind kind() const { | 
| 799     return KindBits::decode(bit_field_); | 801     return KindBits::decode(bit_field_); | 
| 800   } | 802   } | 
| 801 | 803 | 
| 802   bool is_inobject() { | 804   bool is_inobject() { | 
| 803     return InobjectBits::decode(bit_field_); | 805     return InobjectBits::decode(bit_field_); | 
| 804   } | 806   } | 
| 805 | 807 | 
| 806   int offset() { | 808   int offset() { | 
| 807     int index = IndexBits::decode(bit_field_); | 809     int index = IndexBits::decode(bit_field_); | 
| 808     int offset = index * kPointerSize; | 810     int offset = index * kPointerSize; | 
| 809     if (is_inobject()) return offset; | 811     if (is_inobject()) return offset; | 
| 810     return FixedArray::kHeaderSize + offset; | 812     return FixedArray::kHeaderSize + offset; | 
| 811   } | 813   } | 
| 812 | 814 | 
|  | 815   bool unboxed_double() { | 
|  | 816     return UnboxedDoubleBits::decode(bit_field_); | 
|  | 817   } | 
|  | 818 | 
| 813   virtual Code::StubType GetStubType() { return Code::FIELD; } | 819   virtual Code::StubType GetStubType() { return Code::FIELD; } | 
| 814 | 820 | 
| 815  protected: | 821  protected: | 
| 816   LoadFieldStub() : HandlerStub() { } | 822   LoadFieldStub() : HandlerStub() { } | 
| 817 | 823 | 
| 818   void Initialize(Code::Kind kind, bool inobject, int index) { | 824   void Initialize(Code::Kind kind, | 
|  | 825                   bool inobject, | 
|  | 826                   int index, | 
|  | 827                   Representation representation) { | 
|  | 828     bool unboxed_double = FLAG_track_double_fields && representation.IsDouble(); | 
| 819     bit_field_ = KindBits::encode(kind) | 829     bit_field_ = KindBits::encode(kind) | 
| 820         | InobjectBits::encode(inobject) | 830         | InobjectBits::encode(inobject) | 
| 821         | IndexBits::encode(index); | 831         | IndexBits::encode(index) | 
|  | 832         | UnboxedDoubleBits::encode(unboxed_double); | 
| 822   } | 833   } | 
| 823 | 834 | 
| 824  private: | 835  private: | 
| 825   STATIC_ASSERT(KindBits::kSize == 4); | 836   STATIC_ASSERT(KindBits::kSize == 4); | 
| 826   class InobjectBits: public BitField<bool, 4, 1> {}; | 837   class InobjectBits: public BitField<bool, 4, 1> {}; | 
| 827   class IndexBits: public BitField<int, 5, 11> {}; | 838   class IndexBits: public BitField<int, 5, 11> {}; | 
|  | 839   class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; | 
| 828   virtual CodeStub::Major MajorKey() { return LoadField; } | 840   virtual CodeStub::Major MajorKey() { return LoadField; } | 
| 829   virtual int NotMissMinorKey() { return bit_field_; } | 841   virtual int NotMissMinorKey() { return bit_field_; } | 
| 830 | 842 | 
| 831   int bit_field_; | 843   int bit_field_; | 
| 832 }; | 844 }; | 
| 833 | 845 | 
| 834 | 846 | 
| 835 class KeyedLoadFieldStub: public LoadFieldStub { | 847 class KeyedLoadFieldStub: public LoadFieldStub { | 
| 836  public: | 848  public: | 
| 837   KeyedLoadFieldStub(bool inobject, int index) : LoadFieldStub() { | 849   KeyedLoadFieldStub(bool inobject, int index, Representation representation) | 
| 838     Initialize(Code::KEYED_LOAD_IC, inobject, index); | 850       : LoadFieldStub() { | 
|  | 851     Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); | 
| 839   } | 852   } | 
| 840 | 853 | 
| 841   virtual void InitializeInterfaceDescriptor( | 854   virtual void InitializeInterfaceDescriptor( | 
| 842       Isolate* isolate, | 855       Isolate* isolate, | 
| 843       CodeStubInterfaceDescriptor* descriptor); | 856       CodeStubInterfaceDescriptor* descriptor); | 
| 844 | 857 | 
| 845   virtual Handle<Code> GenerateCode(); | 858   virtual Handle<Code> GenerateCode(); | 
| 846 | 859 | 
| 847  private: | 860  private: | 
| 848   virtual CodeStub::Major MajorKey() { return KeyedLoadField; } | 861   virtual CodeStub::Major MajorKey() { return KeyedLoadField; } | 
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1950 | 1963 | 
| 1951   // The current function entry hook. | 1964   // The current function entry hook. | 
| 1952   static FunctionEntryHook entry_hook_; | 1965   static FunctionEntryHook entry_hook_; | 
| 1953 | 1966 | 
| 1954   DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1967   DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 
| 1955 }; | 1968 }; | 
| 1956 | 1969 | 
| 1957 } }  // namespace v8::internal | 1970 } }  // namespace v8::internal | 
| 1958 | 1971 | 
| 1959 #endif  // V8_CODE_STUBS_H_ | 1972 #endif  // V8_CODE_STUBS_H_ | 
| OLD | NEW | 
|---|