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

Unified Diff: src/objects-inl.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/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index cd61ab52b92a657d66eaef1d2b759e3123584d0d..5f58306ec22d41b4dd98ba8303c00b06b6c5a656 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -17,7 +17,6 @@
#include "src/objects.h"
#include "src/contexts.h"
#include "src/conversions-inl.h"
-#include "src/field-index-inl.h"
#include "src/heap.h"
#include "src/isolate.h"
#include "src/heap-inl.h"
@@ -1946,22 +1945,29 @@ void JSObject::SetInternalField(int index, Smi* value) {
// Access fast-case object properties at index. The use of these routines
// is needed to correctly distinguish between properties stored in-object and
// properties stored in the properties array.
-Object* JSObject::RawFastPropertyAt(FieldIndex index) {
- if (index.is_inobject()) {
- return READ_FIELD(this, index.offset());
+Object* JSObject::RawFastPropertyAt(int index) {
+ // Adjust for the number of properties stored in the object.
+ index -= map()->inobject_properties();
+ if (index < 0) {
+ int offset = map()->instance_size() + (index * kPointerSize);
+ return READ_FIELD(this, offset);
} else {
- return properties()->get(index.outobject_array_index());
+ ASSERT(index < properties()->length());
+ return properties()->get(index);
}
}
-void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) {
- if (index.is_inobject()) {
- int offset = index.offset();
+void JSObject::FastPropertyAtPut(int index, Object* value) {
+ // Adjust for the number of properties stored in the object.
+ index -= map()->inobject_properties();
+ if (index < 0) {
+ int offset = map()->instance_size() + (index * kPointerSize);
WRITE_FIELD(this, offset, value);
WRITE_BARRIER(GetHeap(), this, offset, value);
} else {
- properties()->set(index.outobject_array_index(), value);
+ ASSERT(index < properties()->length());
+ properties()->set(index, value);
}
}
@@ -4070,7 +4076,7 @@ int Map::pre_allocated_property_fields() {
int Map::GetInObjectPropertyOffset(int index) {
// Adjust for the number of properties stored in the object.
index -= inobject_properties();
- ASSERT(index <= 0);
+ ASSERT(index < 0);
return instance_size() + (index * kPointerSize);
}
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698