| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 5946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5957 if (i < length - 1) { | 5957 if (i < length - 1) { |
| 5958 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 5958 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 5959 } | 5959 } |
| 5960 } | 5960 } |
| 5961 | 5961 |
| 5962 // Allocate an array with storage for all the property names. | 5962 // Allocate an array with storage for all the property names. |
| 5963 Handle<FixedArray> names = Factory::NewFixedArray(total_property_count); | 5963 Handle<FixedArray> names = Factory::NewFixedArray(total_property_count); |
| 5964 | 5964 |
| 5965 // Get the property names. | 5965 // Get the property names. |
| 5966 jsproto = obj; | 5966 jsproto = obj; |
| 5967 int proto_with_hidden_properties = 0; |
| 5967 for (int i = 0; i < length; i++) { | 5968 for (int i = 0; i < length; i++) { |
| 5968 jsproto->GetLocalPropertyNames(*names, | 5969 jsproto->GetLocalPropertyNames(*names, |
| 5969 i == 0 ? 0 : local_property_count[i - 1]); | 5970 i == 0 ? 0 : local_property_count[i - 1]); |
| 5971 if (!GetHiddenProperties(jsproto, false)->IsUndefined()) { |
| 5972 proto_with_hidden_properties++; |
| 5973 } |
| 5970 if (i < length - 1) { | 5974 if (i < length - 1) { |
| 5971 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 5975 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 5972 } | 5976 } |
| 5973 } | 5977 } |
| 5974 | 5978 |
| 5979 // Filter out name of hidden propeties object. |
| 5980 if (proto_with_hidden_properties > 0) { |
| 5981 Handle<FixedArray> old_names = names; |
| 5982 names = Factory::NewFixedArray( |
| 5983 names->length() - proto_with_hidden_properties); |
| 5984 int dest_pos = 0; |
| 5985 for (int i = 0; i < total_property_count; i++) { |
| 5986 Object* name = old_names->get(i); |
| 5987 if (name == Heap::hidden_symbol()) { |
| 5988 continue; |
| 5989 } |
| 5990 names->set(dest_pos++, name); |
| 5991 } |
| 5992 } |
| 5993 |
| 5975 DeleteArray(local_property_count); | 5994 DeleteArray(local_property_count); |
| 5976 return *Factory::NewJSArrayWithElements(names); | 5995 return *Factory::NewJSArrayWithElements(names); |
| 5977 } | 5996 } |
| 5978 | 5997 |
| 5979 | 5998 |
| 5980 // Return the names of the local indexed properties. | 5999 // Return the names of the local indexed properties. |
| 5981 // args[0]: object | 6000 // args[0]: object |
| 5982 static Object* Runtime_DebugLocalElementNames(Arguments args) { | 6001 static Object* Runtime_DebugLocalElementNames(Arguments args) { |
| 5983 HandleScope scope; | 6002 HandleScope scope; |
| 5984 ASSERT(args.length() == 1); | 6003 ASSERT(args.length() == 1); |
| (...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7839 } else { | 7858 } else { |
| 7840 // Handle last resort GC and make sure to allow future allocations | 7859 // Handle last resort GC and make sure to allow future allocations |
| 7841 // to grow the heap without causing GCs (if possible). | 7860 // to grow the heap without causing GCs (if possible). |
| 7842 Counters::gc_last_resort_from_js.Increment(); | 7861 Counters::gc_last_resort_from_js.Increment(); |
| 7843 Heap::CollectAllGarbage(false); | 7862 Heap::CollectAllGarbage(false); |
| 7844 } | 7863 } |
| 7845 } | 7864 } |
| 7846 | 7865 |
| 7847 | 7866 |
| 7848 } } // namespace v8::internal | 7867 } } // namespace v8::internal |
| OLD | NEW |