Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index ea895d669f909be12dc9f72fffe0d5e77d6df3ba..c4bc555e36b4e02671c84a57049fe3062f88179f 100644 |
| --- a/src/code-stubs.h |
| +++ b/src/code-stubs.h |
| @@ -87,7 +87,8 @@ namespace internal { |
| V(ArrayConstructor) \ |
| V(ProfileEntryHook) \ |
| /* IC Handler stubs */ \ |
| - V(LoadField) |
| + V(LoadField) \ |
| + V(KeyedLoadField) |
| // List of code stubs only used on ARM platforms. |
| #ifdef V8_TARGET_ARCH_ARM |
| @@ -185,6 +186,12 @@ class CodeStub BASE_EMBEDDED { |
| virtual Code::ExtraICState GetExtraICState() { |
| return Code::kNoExtraICState; |
| } |
| + virtual Code::StubType GetStubType() { |
| + return Code::NORMAL; |
| + } |
| + virtual int GetStubFlags() { |
| + return -1; |
| + } |
| protected: |
| static bool CanUseFPRegisters(); |
| @@ -192,9 +199,6 @@ class CodeStub BASE_EMBEDDED { |
| // Generates the assembler code for the stub. |
| virtual Handle<Code> GenerateCode() = 0; |
| - virtual Code::StubType GetStubType() { |
| - return Code::NORMAL; |
| - } |
| // Returns whether the code generated for this stub needs to be allocated as |
| // a fixed (non-moveable) code object. |
| @@ -253,7 +257,6 @@ class PlatformCodeStub : public CodeStub { |
| virtual Handle<Code> GenerateCode(); |
| virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
| - virtual int GetStubFlags() { return -1; } |
| protected: |
| // Generates the assembler code for the stub. |
| @@ -754,9 +757,25 @@ class StoreArrayLengthStub: public StoreICStub { |
| }; |
| -class HandlerStub: public ICStub { |
| +class HICStub: public HydrogenCodeStub { |
| public: |
| - explicit HandlerStub(Code::Kind kind) : ICStub(kind) { } |
| + explicit HICStub(Code::Kind kind) |
| + : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS), kind_(kind) { } |
| + virtual Code::Kind GetCodeKind() const { return kind_; } |
| + virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
| + |
| + protected: |
| + class KindBits: public BitField<Code::Kind, 0, 4> {}; |
| + Code::Kind kind() { return kind_; } |
|
danno
2013/05/02 15:32:36
Either make virtual or remove.
|
| + |
| + private: |
| + Code::Kind kind_; |
| +}; |
| + |
| + |
| +class HandlerStub: public HICStub { |
| + public: |
| + explicit HandlerStub(Code::Kind kind) : HICStub(kind) { } |
| virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
| virtual int GetStubFlags() { return kind(); } |
| }; |
| @@ -764,32 +783,62 @@ class HandlerStub: public ICStub { |
| class LoadFieldStub: public HandlerStub { |
| public: |
| - LoadFieldStub(Register reg, bool inobject, int index) |
| - : HandlerStub(Code::LOAD_IC), |
| - reg_(reg), |
| - inobject_(inobject), |
| - index_(index) { } |
| - virtual void Generate(MacroAssembler* masm); |
| + LoadFieldStub(bool inobject, |
| + int index, |
| + Code::Kind kind = Code::LOAD_IC) |
| + : HandlerStub(kind) { |
| + bit_field_ = KindBits::encode(kind) |
| + | InobjectBits::encode(inobject) |
| + | IndexBits::encode(index); |
| + } |
| + virtual Handle<Code> GenerateCode(); |
| + |
| + virtual void InitializeInterfaceDescriptor( |
| + Isolate* isolate, |
| + CodeStubInterfaceDescriptor* descriptor); |
| + |
| + Representation representation() { |
| + return Representation::Tagged(); |
| + } |
| + |
| + bool is_inobject() { |
| + return InobjectBits::decode(bit_field_); |
| + } |
| + |
| + int offset() { |
| + int index = IndexBits::decode(bit_field_); |
| + int offset = index * kPointerSize; |
| + if (is_inobject()) return offset; |
| + return FixedArray::kHeaderSize + offset; |
| + } |
| - protected: |
| virtual Code::StubType GetStubType() { return Code::FIELD; } |
| private: |
| STATIC_ASSERT(KindBits::kSize == 4); |
| - class RegisterBits: public BitField<int, 4, 6> {}; |
| - class InobjectBits: public BitField<bool, 10, 1> {}; |
| - class IndexBits: public BitField<int, 11, 11> {}; |
| + class InobjectBits: public BitField<bool, 4, 1> {}; |
| + class IndexBits: public BitField<int, 5, 11> {}; |
| virtual CodeStub::Major MajorKey() { return LoadField; } |
| - virtual int MinorKey() { |
| - return KindBits::encode(kind()) |
| - | RegisterBits::encode(reg_.code()) |
| - | InobjectBits::encode(inobject_) |
| - | IndexBits::encode(index_); |
| - } |
| + virtual int NotMissMinorKey() { return bit_field_; } |
| - Register reg_; |
| - bool inobject_; |
| - int index_; |
| + int bit_field_; |
| +}; |
| + |
| + |
| +class KeyedLoadFieldStub: public LoadFieldStub { |
| + public: |
| + KeyedLoadFieldStub(bool inobject, |
| + int index) |
| + : LoadFieldStub(inobject, index, Code::KEYED_LOAD_IC) { } |
| + |
| + virtual void InitializeInterfaceDescriptor( |
| + Isolate* isolate, |
| + CodeStubInterfaceDescriptor* descriptor); |
| + |
| + virtual Handle<Code> GenerateCode(); |
| + |
| + private: |
| + virtual CodeStub::Major MajorKey() { return KeyedLoadField; } |
| }; |