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

Unified Diff: src/runtime.cc

Issue 18089024: Handlify JSObject::SetPrototype method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 4691e18f6a9812d1ac8be2a74794ada62120b149..869c17bf784495cc1c354e9cdce0c0a8e4e3df0e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1450,31 +1450,29 @@ static inline Object* GetPrototypeSkipHiddenPrototypes(Isolate* isolate,
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
ASSERT(args.length() == 2);
- CONVERT_ARG_CHECKED(JSObject, obj, 0);
- CONVERT_ARG_CHECKED(Object, prototype, 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
if (FLAG_harmony_observation && obj->map()->is_observed()) {
- HandleScope scope(isolate);
- Handle<JSObject> receiver(obj);
- Handle<Object> value(prototype, isolate);
Handle<Object> old_value(
- GetPrototypeSkipHiddenPrototypes(isolate, *receiver), isolate);
+ GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
- MaybeObject* result = receiver->SetPrototype(*value, true);
- Handle<Object> hresult;
- if (!result->ToHandle(&hresult, isolate)) return result;
+ Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
+ if (result.is_null()) return Failure::Exception();
Handle<Object> new_value(
- GetPrototypeSkipHiddenPrototypes(isolate, *receiver), isolate);
+ GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
if (!new_value->SameValue(*old_value)) {
- JSObject::EnqueueChangeRecord(receiver, "prototype",
+ JSObject::EnqueueChangeRecord(obj, "prototype",
isolate->factory()->proto_string(),
old_value);
}
- return *hresult;
+ return *result;
}
- return obj->SetPrototype(prototype, true);
+ Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
+ if (result.is_null()) return Failure::Exception();
+ return *result;
}
« src/objects.cc ('K') | « src/objects-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698