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

Unified Diff: src/objects.cc

Issue 9352012: DescriptorArray::IsProperty-related cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 | « no previous file | no next file » | 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 d3d2d8fdeaa72ecd0f12655e9615f9325f76111f..eedd9ee193201a33a34992225d64615f8f11ea82 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3773,12 +3773,14 @@ MaybeObject* JSObject::GetHiddenPropertiesDictionary(bool create_if_absent) {
// code zero) it will always occupy the first entry if present.
DescriptorArray* descriptors = this->map()->instance_descriptors();
if ((descriptors->number_of_descriptors() > 0) &&
- (descriptors->GetKey(0) == GetHeap()->hidden_symbol()) &&
- descriptors->IsProperty(0)) {
- ASSERT(descriptors->GetType(0) == FIELD);
- Object* hidden_store =
- this->FastPropertyAt(descriptors->GetFieldIndex(0));
- return StringDictionary::cast(hidden_store);
+ (descriptors->GetKey(0) == GetHeap()->hidden_symbol())) {
+ if (descriptors->GetType(0) == FIELD) {
+ Object* hidden_store =
+ this->FastPropertyAt(descriptors->GetFieldIndex(0));
+ return StringDictionary::cast(hidden_store);
+ } else {
+ ASSERT(descriptors->GetType(0) == MAP_TRANSITION);
+ }
}
} else {
PropertyAttributes attributes;
@@ -3819,11 +3821,13 @@ MaybeObject* JSObject::SetHiddenPropertiesDictionary(
// code zero) it will always occupy the first entry if present.
DescriptorArray* descriptors = this->map()->instance_descriptors();
if ((descriptors->number_of_descriptors() > 0) &&
- (descriptors->GetKey(0) == GetHeap()->hidden_symbol()) &&
- descriptors->IsProperty(0)) {
- ASSERT(descriptors->GetType(0) == FIELD);
- this->FastPropertyAtPut(descriptors->GetFieldIndex(0), dictionary);
- return this;
+ (descriptors->GetKey(0) == GetHeap()->hidden_symbol())) {
+ if (descriptors->GetType(0) == FIELD) {
+ this->FastPropertyAtPut(descriptors->GetFieldIndex(0), dictionary);
+ return this;
+ } else {
+ ASSERT(descriptors->GetType(0) == MAP_TRANSITION);
+ }
}
}
MaybeObject* store_result =
@@ -5832,14 +5836,14 @@ MaybeObject* DescriptorArray::RemoveTransitions() {
// not be allocated.
// Compute the size of the map transition entries to be removed.
- int num_removed = 0;
+ int new_number_of_descriptors = 0;
for (int i = 0; i < number_of_descriptors(); i++) {
- if (!IsProperty(i)) num_removed++;
+ if (IsProperty(i)) new_number_of_descriptors++;
}
// Allocate the new descriptor array.
DescriptorArray* new_descriptors;
- { MaybeObject* maybe_result = Allocate(number_of_descriptors() - num_removed);
+ { MaybeObject* maybe_result = Allocate(new_number_of_descriptors);
if (!maybe_result->To<DescriptorArray>(&new_descriptors)) {
return maybe_result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698