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

Unified Diff: src/ic.cc

Issue 300283002: Introduce FieldIndex to unify and abstract property/field offset (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix mutable boxed double runtime function 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/ic.h ('k') | src/json-parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 07745378a3c6f6bb80e531224a80231cd01fd4a6..0544a5bf9b734b88ce19c8b906d690f115c71fce 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -838,14 +838,12 @@ Handle<Code> LoadIC::megamorphic_stub() {
}
-Handle<Code> LoadIC::SimpleFieldLoad(int offset,
- bool inobject,
- Representation representation) {
+Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) {
if (kind() == Code::LOAD_IC) {
- LoadFieldStub stub(isolate(), inobject, offset, representation);
+ LoadFieldStub stub(isolate(), index);
return stub.GetCode();
} else {
- KeyedLoadFieldStub stub(isolate(), inobject, offset, representation);
+ KeyedLoadFieldStub stub(isolate(), index);
return stub.GetCode();
}
}
@@ -924,8 +922,8 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
InlineCacheHolderFlag cache_holder) {
if (object->IsString() &&
String::Equals(isolate()->factory()->length_string(), name)) {
- int length_index = String::kLengthOffset / kPointerSize;
- return SimpleFieldLoad(length_index);
+ FieldIndex index = FieldIndex::ForInObjectOffset(String::kLengthOffset);
+ return SimpleFieldLoad(index);
}
if (object->IsStringWrapper() &&
@@ -945,11 +943,9 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
switch (lookup->type()) {
case FIELD: {
- PropertyIndex field = lookup->GetFieldIndex();
+ FieldIndex field = lookup->GetFieldIndex();
if (object.is_identical_to(holder)) {
- return SimpleFieldLoad(field.translate(holder),
- field.is_inobject(holder),
- lookup->representation());
+ return SimpleFieldLoad(field);
}
return compiler.CompileLoadField(
type, holder, name, field, lookup->representation());
@@ -985,12 +981,15 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
// Use simple field loads for some well-known callback properties.
if (object->IsJSObject()) {
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
+ Handle<Map> map(receiver->map());
Handle<HeapType> type = IC::MapToType<HeapType>(
handle(receiver->map()), isolate());
int object_offset;
if (Accessors::IsJSObjectFieldAccessor<HeapType>(
type, name, &object_offset)) {
- return SimpleFieldLoad(object_offset / kPointerSize);
+ FieldIndex index = FieldIndex::ForInObjectOffset(
+ object_offset, receiver->map());
+ return SimpleFieldLoad(index);
}
}
« no previous file with comments | « src/ic.h ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698