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

Unified Diff: src/objects.cc

Issue 200363002: Handlify callers of Object::GetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 9 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-inl.h » ('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 92e4dc4c8c9c98f03a6267e2f393dda5c4312803..8ba18ee61d30e2e333830489676280ac038c57d6 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -493,19 +493,11 @@ Handle<Object> Object::GetProperty(Handle<Object> object,
// method (or somewhere else entirely). Needs more global clean-up.
uint32_t index;
Isolate* isolate = name->GetIsolate();
- if (name->AsArrayIndex(&index))
- return GetElement(isolate, object, index);
+ if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index);
CALL_HEAP_FUNCTION(isolate, object->GetProperty(*name), Object);
}
-Handle<Object> Object::GetElement(Isolate* isolate,
- Handle<Object> object,
- uint32_t index) {
- CALL_HEAP_FUNCTION(isolate, object->GetElement(isolate, index), Object);
-}
-
-
MaybeObject* JSProxy::GetElementWithHandler(Object* receiver,
uint32_t index) {
String* name;
@@ -4076,6 +4068,7 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
*name != isolate->heap()->hidden_string();
if (is_observed && lookup->IsDataProperty()) {
old_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
}
// This is a real property that is not read-only, or it is a
@@ -4121,6 +4114,7 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
object->LocalLookup(*name, &new_lookup, true);
if (new_lookup.IsDataProperty()) {
Handle<Object> new_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, new_value);
if (!new_value->SameValue(*old_value)) {
EnqueueChangeRecord(object, "update", name, old_value);
}
@@ -4197,8 +4191,10 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
bool is_observed = object->map()->is_observed() &&
*name != isolate->heap()->hidden_string();
if (is_observed && lookup.IsProperty()) {
- if (lookup.IsDataProperty()) old_value =
- Object::GetProperty(object, name);
+ if (lookup.IsDataProperty()) {
+ old_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
+ }
old_attributes = lookup.GetAttributes();
}
@@ -4243,6 +4239,7 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
bool value_changed = false;
if (new_lookup.IsDataProperty()) {
Handle<Object> new_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, new_value);
value_changed = !old_value->SameValue(*new_value);
}
if (new_lookup.GetAttributes() != old_attributes) {
@@ -5197,9 +5194,12 @@ Handle<Object> JSObject::DeleteElement(Handle<JSObject> object,
if (object->map()->is_observed()) {
should_enqueue_change_record = HasLocalElement(object, index);
if (should_enqueue_change_record) {
- old_value = object->GetLocalElementAccessorPair(index) != NULL
- ? Handle<Object>::cast(factory->the_hole_value())
- : Object::GetElement(isolate, object, index);
+ if (object->GetLocalElementAccessorPair(index) != NULL) {
+ old_value = Handle<Object>::cast(factory->the_hole_value());
+ } else {
+ old_value = Object::GetElement(isolate, object, index);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
+ }
}
}
@@ -5269,6 +5269,7 @@ Handle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
*name != isolate->heap()->hidden_string();
if (is_observed && lookup.IsDataProperty()) {
old_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
}
Handle<Object> result;
@@ -6367,6 +6368,7 @@ void JSObject::DefineAccessor(Handle<JSObject> object,
preexists = HasLocalElement(object, index);
if (preexists && object->GetLocalElementAccessorPair(index) == NULL) {
old_value = Object::GetElement(isolate, object, index);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
}
} else {
LookupResult lookup(isolate);
@@ -6374,6 +6376,7 @@ void JSObject::DefineAccessor(Handle<JSObject> object,
preexists = lookup.IsProperty();
if (preexists && lookup.IsDataProperty()) {
old_value = Object::GetProperty(object, name);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
}
}
}
@@ -11361,9 +11364,14 @@ static bool GetOldValue(Isolate* isolate,
JSReceiver::GetLocalElementAttribute(object, index);
ASSERT(attributes != ABSENT);
if (attributes == DONT_DELETE) return false;
- old_values->Add(object->GetLocalElementAccessorPair(index) == NULL
- ? Object::GetElement(isolate, object, index)
- : Handle<Object>::cast(isolate->factory()->the_hole_value()));
+ Handle<Object> value;
+ if (object->GetLocalElementAccessorPair(index) != NULL) {
+ value = Handle<Object>::cast(isolate->factory()->the_hole_value());
+ } else {
+ value = Object::GetElement(isolate, object, index);
+ CHECK_NOT_EMPTY_HANDLE(isolate, value);
+ }
+ old_values->Add(value);
indices->Add(index);
return true;
}
@@ -12568,8 +12576,10 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
Handle<Object> new_length_handle;
if (old_attributes != ABSENT) {
- if (object->GetLocalElementAccessorPair(index) == NULL)
+ if (object->GetLocalElementAccessorPair(index) == NULL) {
old_value = Object::GetElement(isolate, object, index);
+ CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
+ }
} else if (object->IsJSArray()) {
// Store old array length in case adding an element grows the array.
old_length_handle = handle(Handle<JSArray>::cast(object)->length(),
@@ -12615,6 +12625,7 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
EnqueueChangeRecord(object, "reconfigure", name, old_value);
} else {
Handle<Object> new_value = Object::GetElement(isolate, object, index);
+ CHECK_NOT_EMPTY_HANDLE(isolate, new_value);
bool value_changed = !old_value->SameValue(*new_value);
if (old_attributes != new_attributes) {
if (!value_changed) old_value = isolate->factory()->the_hole_value();
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698