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
This commit is contained in:
parent
7c667b812d
commit
26107e0d7a
@ -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, 0, 4> {};
|
|
||||||
Code::Kind kind() const { return kind_; }
|
|
||||||
|
|
||||||
virtual int MinorKey() const { return KindBits::encode(kind_); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
Code::Kind kind_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CallICStub: public PlatformCodeStub {
|
class CallICStub: public PlatformCodeStub {
|
||||||
public:
|
public:
|
||||||
CallICStub(Isolate* isolate, const CallIC::State& state)
|
CallICStub(Isolate* isolate, const CallIC::State& state)
|
||||||
@ -917,47 +897,16 @@ class FunctionPrototypeStub : public PlatformCodeStub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class StoreICStub: public ICStub {
|
class HandlerStub : public HydrogenCodeStub {
|
||||||
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<bool, 4, 1> {};
|
|
||||||
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<Code::Kind, 0, 4> {};
|
|
||||||
virtual Code::Kind kind() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class HandlerStub: public HICStub {
|
|
||||||
public:
|
public:
|
||||||
virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
|
virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
|
||||||
virtual ExtraICState GetExtraICState() const { return kind(); }
|
virtual ExtraICState GetExtraICState() const { return kind(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { }
|
explicit HandlerStub(Isolate* isolate)
|
||||||
|
: HydrogenCodeStub(isolate), bit_field_(0) {}
|
||||||
virtual int NotMissMinorKey() const { return bit_field_; }
|
virtual int NotMissMinorKey() const { return bit_field_; }
|
||||||
|
virtual Code::Kind kind() const = 0;
|
||||||
int bit_field_;
|
int bit_field_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -966,7 +915,8 @@ class LoadFieldStub: public HandlerStub {
|
|||||||
public:
|
public:
|
||||||
LoadFieldStub(Isolate* isolate, FieldIndex index)
|
LoadFieldStub(Isolate* isolate, FieldIndex index)
|
||||||
: HandlerStub(isolate), index_(index) {
|
: HandlerStub(isolate), index_(index) {
|
||||||
Initialize(Code::LOAD_IC);
|
int property_index_key = index_.GetLoadFieldStubKey();
|
||||||
|
bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
|
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
|
||||||
@ -979,32 +929,16 @@ class LoadFieldStub: public HandlerStub {
|
|||||||
return Representation::Tagged();
|
return Representation::Tagged();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Code::Kind kind() const {
|
|
||||||
return KindBits::decode(bit_field_);
|
|
||||||
}
|
|
||||||
|
|
||||||
FieldIndex index() const { return index_; }
|
FieldIndex index() const { return index_; }
|
||||||
|
bool unboxed_double() { return index_.is_double(); }
|
||||||
bool unboxed_double() {
|
|
||||||
return index_.is_double();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Code::StubType GetStubType() { return Code::FAST; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit LoadFieldStub(Isolate* isolate);
|
explicit LoadFieldStub(Isolate* isolate);
|
||||||
|
virtual Code::Kind kind() const { return Code::LOAD_IC; }
|
||||||
void Initialize(Code::Kind kind) {
|
virtual Code::StubType GetStubType() { return Code::FAST; }
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
STATIC_ASSERT(KindBits::kSize == 4);
|
class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {};
|
||||||
class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {};
|
|
||||||
virtual CodeStub::Major MajorKey() const { return LoadField; }
|
virtual CodeStub::Major MajorKey() const { return LoadField; }
|
||||||
FieldIndex index_;
|
FieldIndex index_;
|
||||||
};
|
};
|
||||||
@ -1012,21 +946,14 @@ class LoadFieldStub: public HandlerStub {
|
|||||||
|
|
||||||
class StringLengthStub: public HandlerStub {
|
class StringLengthStub: public HandlerStub {
|
||||||
public:
|
public:
|
||||||
explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {
|
explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {}
|
||||||
Initialize(Code::LOAD_IC);
|
|
||||||
}
|
|
||||||
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
|
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
|
||||||
virtual void InitializeInterfaceDescriptor(
|
virtual void InitializeInterfaceDescriptor(
|
||||||
CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
|
CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Code::Kind kind() const {
|
virtual Code::Kind kind() const { return Code::LOAD_IC; }
|
||||||
return KindBits::decode(bit_field_);
|
virtual Code::StubType GetStubType() { return Code::FAST; }
|
||||||
}
|
|
||||||
|
|
||||||
void Initialize(Code::Kind kind) {
|
|
||||||
bit_field_ = KindBits::encode(kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual CodeStub::Major MajorKey() const { return StringLength; }
|
virtual CodeStub::Major MajorKey() const { return StringLength; }
|
||||||
|
@ -1448,7 +1448,6 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
|
|||||||
case FIELD:
|
case FIELD:
|
||||||
return compiler.CompileStoreField(lookup, name);
|
return compiler.CompileStoreField(lookup, name);
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
if (kind() == Code::KEYED_STORE_IC) break;
|
|
||||||
if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) {
|
if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) {
|
||||||
// The stub generated for the global object picks the value directly
|
// The stub generated for the global object picks the value directly
|
||||||
// from the property cell. So the property must be directly on the
|
// from the property cell. So the property must be directly on the
|
||||||
@ -1503,7 +1502,6 @@ Handle<Code> StoreIC::CompileStoreHandler(LookupResult* lookup,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INTERCEPTOR:
|
case INTERCEPTOR:
|
||||||
if (kind() == Code::KEYED_STORE_IC) break;
|
|
||||||
DCHECK(HasInterceptorSetter(*holder));
|
DCHECK(HasInterceptorSetter(*holder));
|
||||||
return compiler.CompileStoreInterceptor(name);
|
return compiler.CompileStoreInterceptor(name);
|
||||||
case CONSTANT:
|
case CONSTANT:
|
||||||
|
Loading…
Reference in New Issue
Block a user