Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index 8d84fdace2562f4f6f834940706f298bfdf481a5..eb1e173def6b9eafa95ba9941eda57d81866aa14 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -5726,6 +5726,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPropertyNamesFast) { |
| } |
| +// Returns true if inherited accessors have been copied down |
| +// to obj from proto's function template. |
| +static bool IsInheritedApiFunctionOf(JSObject *obj, Object *proto) { |
| + Object *constructor = HeapObject::cast(proto)->map()->constructor(); |
|
rossberg
2013/12/20 12:54:54
Note that .constructor is a mutable property, so I
|
| + if (!constructor->IsJSFunction()) return false; |
| + JSFunction *constructor_fun = JSFunction::cast(constructor); |
| + if (!constructor_fun->shared()->IsApiFunction()) return false; |
| + return constructor_fun->shared() |
| + ->get_api_func_data()->IsTemplateFor(obj); |
| +} |
| + |
| + |
| // Find the length of the prototype chain that is to to handled as one. If a |
| // prototype object is hidden it is to be viewed as part of the the object it |
| // is prototype for. |
| @@ -5733,7 +5745,8 @@ static int LocalPrototypeChainLength(JSObject* obj) { |
| int count = 1; |
| Object* proto = obj->GetPrototype(); |
| while (proto->IsJSObject() && |
| - JSObject::cast(proto)->map()->is_hidden_prototype()) { |
| + JSObject::cast(proto)->map()->is_hidden_prototype() && |
| + !IsInheritedApiFunctionOf(obj, proto)) { |
|
dcarney
2013/12/19 19:46:12
filtering here is problematic as there could be pr
sof
2013/12/22 08:39:55
Thanks, the initial version wasn't general enough
|
| count++; |
| proto = JSObject::cast(proto)->GetPrototype(); |
| } |