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

Unified Diff: src/objects.cc

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/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 351fba81455d011fe3fe7df20b8672ba8395ec25..3f9a9ca1f7a4b164d905f17a3f2c5cba8c644ef4 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -17,8 +17,6 @@
#include "src/date.h"
#include "src/elements.h"
#include "src/execution.h"
-#include "src/field-index.h"
-#include "src/field-index-inl.h"
#include "src/full-codegen.h"
#include "src/hydrogen.h"
#include "src/isolate-inl.h"
@@ -849,7 +847,8 @@ MaybeHandle<Object> Object::GetProperty(Handle<Object> object,
}
case FIELD:
value = JSObject::FastPropertyAt(handle(result->holder(), isolate),
- result->representation(), FieldIndex::ForLookupResult(result));
+ result->representation(),
+ result->GetFieldIndex().field_index());
break;
case CONSTANT:
return handle(result->GetConstant(), isolate);
@@ -2281,7 +2280,7 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) {
old_details.type() == FIELD);
Object* raw_value = old_details.type() == CONSTANT
? old_descriptors->GetValue(i)
- : object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map, i));
+ : object->RawFastPropertyAt(old_descriptors->GetFieldIndex(i));
Handle<Object> value(raw_value, isolate);
if (!old_details.representation().IsDouble() &&
details.representation().IsDouble()) {
@@ -2317,8 +2316,7 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) {
// avoid overwriting |one_pointer_filler_map|.
int limit = Min(inobject, number_of_fields);
for (int i = 0; i < limit; i++) {
- FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i);
- object->FastPropertyAtPut(index, array->get(external + i));
+ object->FastPropertyAtPut(i, array->get(external + i));
}
// Create filler object past the new instance size.
@@ -3517,7 +3515,7 @@ void JSObject::LookupOwnRealNamedProperty(Handle<Name> name,
// occur as fields.
if (result->IsField() &&
result->IsReadOnly() &&
- RawFastPropertyAt(result->GetFieldIndex())->IsTheHole()) {
+ RawFastPropertyAt(result->GetFieldIndex().field_index())->IsTheHole()) {
result->DisallowCaching();
}
return;
@@ -4033,14 +4031,14 @@ void JSObject::WriteToField(int descriptor, Object* value) {
ASSERT(details.type() == FIELD);
- FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
+ int field_index = desc->GetFieldIndex(descriptor);
if (details.representation().IsDouble()) {
// Nothing more to be done.
if (value->IsUninitialized()) return;
- HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index));
+ HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(field_index));
box->set_value(value->Number());
} else {
- FastPropertyAtPut(index, value);
+ FastPropertyAtPut(field_index, value);
}
}
@@ -4729,9 +4727,8 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
}
case FIELD: {
Handle<Name> key(descs->GetKey(i));
- FieldIndex index = FieldIndex::ForDescriptor(*map, i);
Handle<Object> value(
- object->RawFastPropertyAt(index), isolate);
+ object->RawFastPropertyAt(descs->GetFieldIndex(i)), isolate);
PropertyDetails d =
PropertyDetails(details.attributes(), NORMAL, i + 1);
dictionary = NameDictionary::Add(dictionary, key, value, d);
@@ -5238,9 +5235,8 @@ Object* JSObject::GetHiddenPropertiesHashTable() {
ASSERT(descriptors->GetType(sorted_index) == FIELD);
ASSERT(descriptors->GetDetails(sorted_index).representation().
IsCompatibleForLoad(Representation::Tagged()));
- FieldIndex index = FieldIndex::ForDescriptor(this->map(),
- sorted_index);
- return this->RawFastPropertyAt(index);
+ return this->RawFastPropertyAt(
+ descriptors->GetFieldIndex(sorted_index));
} else {
return GetHeap()->undefined_value();
}
@@ -5920,7 +5916,7 @@ void JSObject::SetObserved(Handle<JSObject> object) {
Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object,
Representation representation,
- FieldIndex index) {
+ int index) {
Isolate* isolate = object->GetIsolate();
Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
return Object::NewStorageFor(isolate, raw_value, representation);
@@ -6011,7 +6007,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
for (int i = 0; i < limit; i++) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.type() != FIELD) continue;
- FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i);
+ int index = descriptors->GetFieldIndex(i);
Handle<Object> value(object->RawFastPropertyAt(index), isolate);
if (value->IsJSObject()) {
ASSIGN_RETURN_ON_EXCEPTION(
@@ -6178,7 +6174,7 @@ Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object,
case FIELD:
result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate),
lookup.representation(),
- lookup.GetFieldIndex());
+ lookup.GetFieldIndex().field_index());
break;
case CONSTANT:
result = Handle<Object>(lookup.GetConstant(), isolate);
@@ -6412,9 +6408,15 @@ static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object,
if (details.type() != FIELD) {
indices = Handle<FixedArray>();
} else {
- FieldIndex field_index = FieldIndex::ForDescriptor(*map, i);
- int load_by_field_index = field_index.GetLoadByFieldIndex();
- indices->set(index, Smi::FromInt(load_by_field_index));
+ int field_index = descs->GetFieldIndex(i);
+ if (field_index >= map->inobject_properties()) {
+ field_index = -(field_index - map->inobject_properties() + 1);
+ }
+ field_index = field_index << 1;
+ if (details.representation().IsDouble()) {
+ field_index |= 1;
+ }
+ indices->set(index, Smi::FromInt(field_index));
}
}
index++;
@@ -7118,8 +7120,7 @@ Object* JSObject::SlowReverseLookup(Object* value) {
DescriptorArray* descs = map()->instance_descriptors();
for (int i = 0; i < number_of_own_descriptors; i++) {
if (descs->GetType(i) == FIELD) {
- Object* property =
- RawFastPropertyAt(FieldIndex::ForDescriptor(map(), i));
+ Object* property = RawFastPropertyAt(descs->GetFieldIndex(i));
if (descs->GetDetails(i).representation().IsDouble()) {
ASSERT(property->IsHeapNumber());
if (value->IsNumber() && property->Number() == value->Number()) {
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698