From 26107e0d7a850e9713c993e1e578e74c4f7ac6bf Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Tue, 5 Aug 2014 11:22:29 +0000 Subject: [PATCH] Cleanup hydrogen generated handlers BUG= R=ishell@chromium.org Review URL: https://codereview.chromium.org/445563002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22859 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs.h | 99 +++++++----------------------------------------- src/ic.cc | 2 - 2 files changed, 13 insertions(+), 88 deletions(-) diff --git a/src/code-stubs.h b/src/code-stubs.h index 7e2a456413..89365b9344 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -828,26 +828,6 @@ class MathPowStub: public PlatformCodeStub { }; -class ICStub: public PlatformCodeStub { - public: - ICStub(Isolate* isolate, Code::Kind kind) - : PlatformCodeStub(isolate), kind_(kind) { } - virtual Code::Kind GetCodeKind() const { return kind_; } - virtual InlineCacheState GetICState() { return MONOMORPHIC; } - - bool Describes(Code* code) { return code->stub_key() == GetKey(); } - - protected: - class KindBits: public BitField {}; - Code::Kind kind() const { return kind_; } - - virtual int MinorKey() const { return KindBits::encode(kind_); } - - private: - Code::Kind kind_; -}; - - class CallICStub: public PlatformCodeStub { public: CallICStub(Isolate* isolate, const CallIC::State& state) @@ -917,47 +897,16 @@ class FunctionPrototypeStub : public PlatformCodeStub { }; -class StoreICStub: public ICStub { - public: - StoreICStub(Isolate* isolate, Code::Kind kind, StrictMode strict_mode) - : ICStub(isolate, kind), strict_mode_(strict_mode) { } - - protected: - virtual ExtraICState GetExtraICState() const { - return StoreIC::ComputeExtraICState(strict_mode_); - } - - private: - STATIC_ASSERT(KindBits::kSize == 4); - class StrictModeBits: public BitField {}; - virtual int MinorKey() const { - return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); - } - - StrictMode strict_mode_; -}; - - -class HICStub: public HydrogenCodeStub { - public: - explicit HICStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } - virtual Code::Kind GetCodeKind() const { return kind(); } - virtual InlineCacheState GetICState() { return MONOMORPHIC; } - - protected: - class KindBits: public BitField {}; - virtual Code::Kind kind() const = 0; -}; - - -class HandlerStub: public HICStub { +class HandlerStub : public HydrogenCodeStub { public: virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } virtual ExtraICState GetExtraICState() const { return kind(); } protected: - explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { } + explicit HandlerStub(Isolate* isolate) + : HydrogenCodeStub(isolate), bit_field_(0) {} virtual int NotMissMinorKey() const { return bit_field_; } + virtual Code::Kind kind() const = 0; int bit_field_; }; @@ -966,7 +915,8 @@ class LoadFieldStub: public HandlerStub { public: LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate), index_(index) { - Initialize(Code::LOAD_IC); + int property_index_key = index_.GetLoadFieldStubKey(); + bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key); } virtual Handle GenerateCode() V8_OVERRIDE; @@ -979,32 +929,16 @@ class LoadFieldStub: public HandlerStub { return Representation::Tagged(); } - virtual Code::Kind kind() const { - return KindBits::decode(bit_field_); - } - FieldIndex index() const { return index_; } - - bool unboxed_double() { - return index_.is_double(); - } - - virtual Code::StubType GetStubType() { return Code::FAST; } + bool unboxed_double() { return index_.is_double(); } protected: explicit LoadFieldStub(Isolate* isolate); - - void Initialize(Code::Kind kind) { - int property_index_key = index_.GetLoadFieldStubKey(); - // Save a copy of the essence of the property index into the bit field to - // make sure that hashing of unique stubs works correctly.. - bit_field_ = KindBits::encode(kind) | - EncodedLoadFieldByIndexBits::encode(property_index_key); - } + virtual Code::Kind kind() const { return Code::LOAD_IC; } + virtual Code::StubType GetStubType() { return Code::FAST; } private: - STATIC_ASSERT(KindBits::kSize == 4); - class EncodedLoadFieldByIndexBits: public BitField {}; + class EncodedLoadFieldByIndexBits : public BitField {}; virtual CodeStub::Major MajorKey() const { return LoadField; } FieldIndex index_; }; @@ -1012,21 +946,14 @@ class LoadFieldStub: public HandlerStub { class StringLengthStub: public HandlerStub { public: - explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { - Initialize(Code::LOAD_IC); - } + explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} virtual Handle GenerateCode() V8_OVERRIDE; virtual void InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; protected: - virtual Code::Kind kind() const { - return KindBits::decode(bit_field_); - } - - void Initialize(Code::Kind kind) { - bit_field_ = KindBits::encode(kind); - } + virtual Code::Kind kind() const { return Code::LOAD_IC; } + virtual Code::StubType GetStubType() { return Code::FAST; } private: virtual CodeStub::Major MajorKey() const { return StringLength; } diff --git a/src/ic.cc b/src/ic.cc index 5bd557eb64..846d361c08 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -1448,7 +1448,6 @@ Handle StoreIC::CompileStoreHandler(LookupResult* lookup, case FIELD: return compiler.CompileStoreField(lookup, name); case NORMAL: - if (kind() == Code::KEYED_STORE_IC) break; if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) { // The stub generated for the global object picks the value directly // from the property cell. So the property must be directly on the @@ -1503,7 +1502,6 @@ Handle StoreIC::CompileStoreHandler(LookupResult* lookup, break; } case INTERCEPTOR: - if (kind() == Code::KEYED_STORE_IC) break; DCHECK(HasInterceptorSetter(*holder)); return compiler.CompileStoreInterceptor(name); case CONSTANT: