Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index ea895d669f909be12dc9f72fffe0d5e77d6df3ba..bb78523aa4753ec92486aaac5b27e040fb6ac0d5 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 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_; } |
| + |
| + private: |
| + Code::Kind kind_; |
| +}; |
| + |
| + |
| +class HandlerStub: public HICStub { |
| public: |
| - explicit HandlerStub(Code::Kind kind) : ICStub(kind) { } |
| + explicit HandlerStub(Code::Kind kind) : HICStub(kind) { } |
| virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
| virtual int GetStubFlags() { return kind(); } |
| }; |
| @@ -764,32 +783,71 @@ class HandlerStub: public ICStub { |
| class LoadFieldStub: public HandlerStub { |
| public: |
| - LoadFieldStub(Register reg, bool inobject, int index) |
| - : HandlerStub(Code::LOAD_IC), |
| - reg_(reg), |
| + LoadFieldStub(bool inobject, |
| + int index, |
| + Representation representation, |
| + Code::Kind kind = Code::LOAD_IC) |
| + : HandlerStub(kind), |
| inobject_(inobject), |
| - index_(index) { } |
| - virtual void Generate(MacroAssembler* masm); |
| + index_(index) { |
| + unboxed_double_ = FLAG_track_double_fields && representation.IsDouble(); |
| + } |
| + virtual Handle<Code> GenerateCode(); |
| + |
| + virtual void InitializeInterfaceDescriptor( |
| + Isolate* isolate, |
| + CodeStubInterfaceDescriptor* descriptor); |
| + |
| + Representation representation() { |
| + if (unboxed_double_) return Representation::Double(); |
|
danno
2013/05/02 11:41:48
Not yet?
|
| + return Representation::Tagged(); |
| + } |
| + |
| + bool is_inobject() { return inobject_; } |
| + |
| + int offset() { |
| + 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> {}; |
| + class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; |
|
danno
2013/05/02 10:56:59
Seems premature for this CL?
|
| virtual CodeStub::Major MajorKey() { return LoadField; } |
| - virtual int MinorKey() { |
| + |
| + virtual int NotMissMinorKey() { |
| return KindBits::encode(kind()) |
| - | RegisterBits::encode(reg_.code()) |
| | InobjectBits::encode(inobject_) |
| - | IndexBits::encode(index_); |
| + | IndexBits::encode(index_) |
| + | UnboxedDoubleBits::encode(unboxed_double_); |
| } |
| - Register reg_; |
| bool inobject_; |
|
danno
2013/05/02 10:56:59
Other stubs store the |'ed version in a field call
|
| int index_; |
| + bool unboxed_double_; |
| +}; |
| + |
| + |
| +class KeyedLoadFieldStub: public LoadFieldStub { |
| + public: |
| + KeyedLoadFieldStub(bool inobject, |
| + int index, |
| + Representation representation) |
| + : LoadFieldStub(inobject, index, representation, Code::KEYED_LOAD_IC) { } |
| + |
| + virtual void InitializeInterfaceDescriptor( |
| + Isolate* isolate, |
| + CodeStubInterfaceDescriptor* descriptor); |
| + |
| + virtual Handle<Code> GenerateCode(); |
| + |
| + private: |
| + virtual CodeStub::Major MajorKey() { return KeyedLoadField; } |
| }; |