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

Unified Diff: src/objects.cc

Issue 238973003: Handlify Object::GetPrototype and (most) callers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor Created 6 years, 8 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 3fb447fcc8ee8d310d6b16c8f31a49b6525ee745..97fb83aa1ab494c55e84024f8c8595941edb827e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2964,7 +2964,7 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
Isolate *isolate = object->GetIsolate();
for (Handle<Object> proto = handle(object->GetPrototype(), isolate);
!proto->IsNull();
- proto = handle(proto->GetPrototype(isolate), isolate)) {
+ proto = Object::GetPrototype(isolate, proto)) {
if (proto->IsJSProxy()) {
return JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<JSProxy>::cast(proto),
@@ -3433,14 +3433,14 @@ void JSObject::LookupRealNamedProperty(Name* name, LookupResult* result) {
void JSObject::LookupRealNamedPropertyInPrototypes(Name* name,
LookupResult* result) {
Isolate* isolate = GetIsolate();
- Heap* heap = isolate->heap();
- for (Object* pt = GetPrototype();
- pt != heap->null_value();
- pt = pt->GetPrototype(isolate)) {
+ DisallowHeapAllocation no_alloc;
+ for (Handle<Object> pt = handle(GetPrototype(), isolate);
Yang 2014/04/15 13:10:48 No need to handlify. Especially since none of the
+ !pt->IsNull();
+ pt = Object::GetPrototype(isolate, pt)) {
if (pt->IsJSProxy()) {
- return result->HandlerResult(JSProxy::cast(pt));
+ return result->HandlerResult(JSProxy::cast(*pt));
}
- JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result);
+ JSObject::cast(*pt)->LocalLookupRealNamedProperty(name, result);
ASSERT(!(result->IsFound() && result->type() == INTERCEPTOR));
if (result->IsFound()) return;
}
@@ -6428,22 +6428,24 @@ bool JSObject::CanSetCallback(Handle<JSObject> object, Handle<Name> name) {
bool Map::DictionaryElementsInPrototypeChainOnly() {
- Heap* heap = GetHeap();
+ Isolate* isolate = GetIsolate();
+ HandleScope scope(isolate);
+ DisallowHeapAllocation no_alloc;
Yang 2014/04/15 13:10:48 No need to handlify.
if (IsDictionaryElementsKind(elements_kind())) {
return false;
}
- for (Object* prototype = this->prototype();
- prototype != heap->null_value();
- prototype = prototype->GetPrototype(GetIsolate())) {
+ for (Handle<Object> prototype(this->prototype(), isolate);
+ !prototype->IsNull();
+ prototype = Object::GetPrototype(isolate, prototype)) {
if (prototype->IsJSProxy()) {
// Be conservative, don't walk into proxies.
return true;
}
if (IsDictionaryElementsKind(
- JSObject::cast(prototype)->map()->elements_kind())) {
+ JSObject::cast(*prototype)->map()->elements_kind())) {
return true;
}
}
@@ -11991,10 +11993,10 @@ Handle<Object> JSObject::SetPrototype(Handle<JSObject> object,
// prototype cycles are prevented.
// It is sufficient to validate that the receiver is not in the new prototype
// chain.
- for (Object* pt = *value;
- pt != heap->null_value();
- pt = pt->GetPrototype(isolate)) {
- if (JSReceiver::cast(pt) == *object) {
+ for (Handle<Object> pt = value;
+ !pt->IsNull();
+ pt = Object::GetPrototype(isolate, pt)) {
+ if (JSReceiver::cast(*pt) == *object) {
Yang 2014/04/15 13:10:48 you could use if (pt.is_identical_to(object)) { ..
// Cycle detected.
Handle<Object> error = isolate->factory()->NewError(
"cyclic_proto", HandleVector<Object>(NULL, 0));
@@ -12010,11 +12012,11 @@ Handle<Object> JSObject::SetPrototype(Handle<JSObject> object,
if (skip_hidden_prototypes) {
// Find the first object in the chain whose prototype object is not
// hidden and set the new prototype on that object.
- Object* current_proto = real_receiver->GetPrototype();
+ Handle<Object> current_proto(real_receiver->GetPrototype(), isolate);
while (current_proto->IsJSObject() &&
- JSObject::cast(current_proto)->map()->is_hidden_prototype()) {
- real_receiver = handle(JSObject::cast(current_proto), isolate);
- current_proto = current_proto->GetPrototype(isolate);
+ JSObject::cast(*current_proto)->map()->is_hidden_prototype()) {
+ real_receiver = handle(JSObject::cast(*current_proto));
+ current_proto = Object::GetPrototype(isolate, current_proto);
}
}

Powered by Google App Engine
This is Rietveld 408576698