Chromium Code Reviews| 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 5986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5997 if (i < length - 1) { | 5997 if (i < length - 1) { |
| 5998 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 5998 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 5999 } | 5999 } |
| 6000 } | 6000 } |
| 6001 | 6001 |
| 6002 // Allocate an array with storage for all the property names. | 6002 // Allocate an array with storage for all the property names. |
| 6003 Handle<FixedArray> names = Factory::NewFixedArray(total_property_count); | 6003 Handle<FixedArray> names = Factory::NewFixedArray(total_property_count); |
| 6004 | 6004 |
| 6005 // Get the property names. | 6005 // Get the property names. |
| 6006 jsproto = obj; | 6006 jsproto = obj; |
| 6007 int proto_with_hidden_properties = 0; | |
| 6007 for (int i = 0; i < length; i++) { | 6008 for (int i = 0; i < length; i++) { |
| 6008 jsproto->GetLocalPropertyNames(*names, | 6009 jsproto->GetLocalPropertyNames(*names, |
| 6009 i == 0 ? 0 : local_property_count[i - 1]); | 6010 i == 0 ? 0 : local_property_count[i - 1]); |
| 6011 if (!GetHiddenProperties(jsproto, false)->IsUndefined()) { | |
| 6012 proto_with_hidden_properties++; | |
| 6013 } | |
| 6010 if (i < length - 1) { | 6014 if (i < length - 1) { |
| 6011 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); | 6015 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); |
| 6012 } | 6016 } |
| 6013 } | 6017 } |
| 6014 | 6018 |
| 6019 // Filter out name of hidden propeties object. | |
| 6020 if (proto_with_hidden_properties > 0) { | |
| 6021 Handle<FixedArray> old_names = names; | |
| 6022 names = Factory::NewFixedArray( | |
| 6023 names->length() - proto_with_hidden_properties); | |
| 6024 int dest_pos = 0; | |
| 6025 for (int i = 0; i < total_property_count; i++) { | |
| 6026 Object* e = old_names->get(i); | |
|
Mads Ager (chromium)
2009/11/10 16:04:08
Rename 'e' to 'name'?
yurys
2009/11/10 16:09:07
Done.
| |
| 6027 if (e == Heap::hidden_symbol()) { | |
| 6028 continue; | |
| 6029 } | |
| 6030 names->set(dest_pos++, e); | |
| 6031 } | |
| 6032 } | |
| 6033 | |
| 6015 DeleteArray(local_property_count); | 6034 DeleteArray(local_property_count); |
| 6016 return *Factory::NewJSArrayWithElements(names); | 6035 return *Factory::NewJSArrayWithElements(names); |
| 6017 } | 6036 } |
| 6018 | 6037 |
| 6019 | 6038 |
| 6020 // Return the names of the local indexed properties. | 6039 // Return the names of the local indexed properties. |
| 6021 // args[0]: object | 6040 // args[0]: object |
| 6022 static Object* Runtime_DebugLocalElementNames(Arguments args) { | 6041 static Object* Runtime_DebugLocalElementNames(Arguments args) { |
| 6023 HandleScope scope; | 6042 HandleScope scope; |
| 6024 ASSERT(args.length() == 1); | 6043 ASSERT(args.length() == 1); |
| (...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7886 } else { | 7905 } else { |
| 7887 // Handle last resort GC and make sure to allow future allocations | 7906 // Handle last resort GC and make sure to allow future allocations |
| 7888 // to grow the heap without causing GCs (if possible). | 7907 // to grow the heap without causing GCs (if possible). |
| 7889 Counters::gc_last_resort_from_js.Increment(); | 7908 Counters::gc_last_resort_from_js.Increment(); |
| 7890 Heap::CollectAllGarbage(false); | 7909 Heap::CollectAllGarbage(false); |
| 7891 } | 7910 } |
| 7892 } | 7911 } |
| 7893 | 7912 |
| 7894 | 7913 |
| 7895 } } // namespace v8::internal | 7914 } } // namespace v8::internal |
| OLD | NEW |