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

Unified Diff: src/builtins.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
« no previous file with comments | « src/api.cc ('k') | src/handles.cc » ('j') | src/ic.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 3f810867388e4915c9c95d6c1bed6aaad880dec6..a823da13d8297fb2321c50085a7a54fc30f6462f 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1109,16 +1109,16 @@ BUILTIN(StrictModePoisonPill) {
// Searches the hidden prototype chain of the given object for the first
// object that is an instance of the given type. If no such object can
// be found then Heap::null_value() is returned.
-static inline Object* FindHidden(Heap* heap,
- Object* object,
- FunctionTemplateInfo* type) {
- if (type->IsTemplateFor(object)) return object;
- Object* proto = object->GetPrototype(heap->isolate());
+static inline Handle<Object> FindHidden(Isolate* isolate,
+ Handle<Object> object,
+ Handle<FunctionTemplateInfo> type) {
Yang 2014/04/15 13:10:48 It seems like we don't need to handlify this and i
+ if (type->IsTemplateFor(*object)) return object;
+ Handle<Object> proto = Object::GetPrototype(isolate, object);
if (proto->IsJSObject() &&
- JSObject::cast(proto)->map()->is_hidden_prototype()) {
- return FindHidden(heap, proto, type);
+ JSObject::cast(*proto)->map()->is_hidden_prototype()) {
+ return FindHidden(isolate, proto, type);
}
- return heap->null_value();
+ return Handle<Object>();
}
@@ -1132,6 +1132,9 @@ static inline Object* TypeCheck(Heap* heap,
int argc,
Object** argv,
FunctionTemplateInfo* info) {
+ Isolate* isolate = heap->isolate();
+ HandleScope scope(isolate);
+ DisallowHeapAllocation no_alloc;
Object* recv = argv[0];
// API calls are only supported with JSObject receivers.
if (!recv->IsJSObject()) return heap->null_value();
@@ -1142,8 +1145,13 @@ static inline Object* TypeCheck(Heap* heap,
Object* recv_type = sig->receiver();
Object* holder = recv;
if (!recv_type->IsUndefined()) {
- holder = FindHidden(heap, holder, FunctionTemplateInfo::cast(recv_type));
- if (holder == heap->null_value()) return heap->null_value();
+ Handle<Object> hidden =
+ FindHidden(
+ isolate,
+ handle(holder, isolate),
+ handle(FunctionTemplateInfo::cast(recv_type)));
+ if (hidden.is_null()) return heap->null_value();
+ holder = *hidden;
}
Object* args_obj = sig->args();
// If there is no argument signature we're done
@@ -1155,10 +1163,14 @@ static inline Object* TypeCheck(Heap* heap,
Object* argtype = args->get(i);
if (argtype->IsUndefined()) continue;
Object** arg = &argv[-1 - i];
- Object* current = *arg;
- current = FindHidden(heap, current, FunctionTemplateInfo::cast(argtype));
- if (current == heap->null_value()) current = heap->undefined_value();
- *arg = current;
+ Handle<Object> current(*arg, isolate);
+ current = FindHidden(
+ isolate, current, handle(FunctionTemplateInfo::cast(argtype)));
+ if (!current.is_null()) {
+ *arg = *current;
+ } else {
+ *arg = heap->undefined_value();
+ }
}
return holder;
}
« no previous file with comments | « src/api.cc ('k') | src/handles.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698