Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: src/code-stubs.h

Issue 14847004: Turn the load field code stub into a hydrogen code stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index ea895d669f909be12dc9f72fffe0d5e77d6df3ba..4848768382c9e207b0f2c4e2b6accc4110d95983 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,42 +757,95 @@ class StoreArrayLengthStub: public StoreICStub {
};
-class HandlerStub: public ICStub {
+class HICStub: public HydrogenCodeStub {
+ public:
+ virtual Code::Kind GetCodeKind() const { return kind(); }
+ virtual InlineCacheState GetICState() { return MONOMORPHIC; }
+
+ protected:
+ HICStub() : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS) { }
+ class KindBits: public BitField<Code::Kind, 0, 4> {};
+ virtual Code::Kind kind() const = 0;
+};
+
+
+class HandlerStub: public HICStub {
public:
- explicit HandlerStub(Code::Kind kind) : ICStub(kind) { }
virtual Code::Kind GetCodeKind() const { return Code::STUB; }
virtual int GetStubFlags() { return kind(); }
+
+ protected:
+ HandlerStub() : HICStub() { }
};
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) : HandlerStub() {
+ Initialize(Code::LOAD_IC, inobject, index);
+ }
+
+ virtual Handle<Code> GenerateCode();
+
+ virtual void InitializeInterfaceDescriptor(
+ Isolate* isolate,
+ CodeStubInterfaceDescriptor* descriptor);
+
+ Representation representation() {
+ return Representation::Tagged();
+ }
+
+ virtual Code::Kind kind() const {
+ return KindBits::decode(bit_field_);
+ }
+
+ 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; }
+ protected:
+ LoadFieldStub() : HandlerStub() { }
+
+ void Initialize(Code::Kind kind, bool inobject, int index) {
+ bit_field_ = KindBits::encode(kind)
+ | InobjectBits::encode(inobject)
+ | IndexBits::encode(index);
+ }
+
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_; }
+
+ int bit_field_;
+};
+
+
+class KeyedLoadFieldStub: public LoadFieldStub {
+ public:
+ KeyedLoadFieldStub(bool inobject, int index) : LoadFieldStub() {
+ Initialize(Code::KEYED_LOAD_IC, inobject, index);
}
- Register reg_;
- bool inobject_;
- int index_;
+ virtual void InitializeInterfaceDescriptor(
+ Isolate* isolate,
+ CodeStubInterfaceDescriptor* descriptor);
+
+ virtual Handle<Code> GenerateCode();
+
+ private:
+ virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
};
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698