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

Unified Diff: src/code-stubs.h

Issue 329463005: Revert 21720: "Introduce FieldIndex to unify and abstract property/field offset" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/bootstrapper.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 55d8b885c842326f219eb816289bb42e3f36c965..4a93f9920ad7409b70448c216a789864264a6ada 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -897,9 +897,11 @@ class HandlerStub: public HICStub {
class LoadFieldStub: public HandlerStub {
public:
- LoadFieldStub(Isolate* isolate, FieldIndex index)
- : HandlerStub(isolate), index_(index) {
- Initialize(Code::LOAD_IC);
+ LoadFieldStub(Isolate* isolate,
+ bool inobject,
+ int index, Representation representation)
+ : HandlerStub(isolate) {
+ Initialize(Code::LOAD_IC, inobject, index, representation);
}
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
@@ -916,30 +918,42 @@ class LoadFieldStub: public HandlerStub {
return KindBits::decode(bit_field_);
}
- FieldIndex index() const { return index_; }
+ 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;
+ }
bool unboxed_double() {
- return index_.is_double();
+ return UnboxedDoubleBits::decode(bit_field_);
}
virtual Code::StubType GetStubType() { return Code::FAST; }
protected:
- explicit LoadFieldStub(Isolate* isolate);
+ explicit LoadFieldStub(Isolate* isolate) : HandlerStub(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);
+ void Initialize(Code::Kind kind,
+ bool inobject,
+ int index,
+ Representation representation) {
+ bit_field_ = KindBits::encode(kind)
+ | InobjectBits::encode(inobject)
+ | IndexBits::encode(index)
+ | UnboxedDoubleBits::encode(representation.IsDouble());
}
private:
STATIC_ASSERT(KindBits::kSize == 4);
- class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {};
+ class InobjectBits: public BitField<bool, 4, 1> {};
+ class IndexBits: public BitField<int, 5, 11> {};
+ class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
virtual CodeStub::Major MajorKey() { return LoadField; }
- FieldIndex index_;
};
@@ -1084,9 +1098,11 @@ class CallApiGetterStub : public PlatformCodeStub {
class KeyedLoadFieldStub: public LoadFieldStub {
public:
- KeyedLoadFieldStub(Isolate* isolate, FieldIndex index)
- : LoadFieldStub(isolate, index) {
- Initialize(Code::KEYED_LOAD_IC);
+ KeyedLoadFieldStub(Isolate* isolate,
+ bool inobject,
+ int index, Representation representation)
+ : LoadFieldStub(isolate) {
+ Initialize(Code::KEYED_LOAD_IC, inobject, index, representation);
}
virtual void InitializeInterfaceDescriptor(
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698