 Chromium Code Reviews
 Chromium Code Reviews Issue 116533003:
  Avoid duplication of a hidden & inherited prototype's properties.  (Closed) 
  Base URL: git://github.com/v8/v8.git@bleeding_edge
    
  
    Issue 116533003:
  Avoid duplication of a hidden & inherited prototype's properties.  (Closed) 
  Base URL: git://github.com/v8/v8.git@bleeding_edge| Index: src/runtime.cc | 
| diff --git a/src/runtime.cc b/src/runtime.cc | 
| index 8d84fdace2562f4f6f834940706f298bfdf481a5..89d49fe78cdf73c6da7d600c5ebb66ea37d313a4 100644 | 
| --- a/src/runtime.cc | 
| +++ b/src/runtime.cc | 
| @@ -5726,6 +5726,22 @@ 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(); | 
| + if (!constructor->IsJSFunction()) { | 
| 
jochen (gone - plz use gerrit)
2013/12/17 15:00:53
nit. v8 style is if (...) return false; (in one li
 | 
| + return false; | 
| + } | 
| + JSFunction *constructor_fun = JSFunction::cast(constructor); | 
| + if (!constructor_fun->shared()->IsApiFunction()) { | 
| + return false; | 
| + } | 
| + return constructor_fun->shared()-> | 
| 
jochen (gone - plz use gerrit)
2013/12/17 15:00:53
nit the -> should go on the next line
 | 
| + 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 +5749,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)) { | 
| count++; | 
| proto = JSObject::cast(proto)->GetPrototype(); | 
| } |