| 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 4207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 Top::ReportFailedAccessCheck(*obj, v8::ACCESS_KEYS); | 4218 Top::ReportFailedAccessCheck(*obj, v8::ACCESS_KEYS); |
| 4219 return *Factory::NewJSArray(0); | 4219 return *Factory::NewJSArray(0); |
| 4220 } | 4220 } |
| 4221 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); | 4221 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); |
| 4222 } | 4222 } |
| 4223 | 4223 |
| 4224 // Find the number of objects making up this. | 4224 // Find the number of objects making up this. |
| 4225 int length = LocalPrototypeChainLength(*obj); | 4225 int length = LocalPrototypeChainLength(*obj); |
| 4226 | 4226 |
| 4227 // Find the number of local properties for each of the objects. | 4227 // Find the number of local properties for each of the objects. |
| 4228 int* local_property_count = NewArray<int>(length); | 4228 ScopedVector<int> local_property_count(length); |
| 4229 int total_property_count = 0; | 4229 int total_property_count = 0; |
| 4230 Handle<JSObject> jsproto = obj; | 4230 Handle<JSObject> jsproto = obj; |
| 4231 for (int i = 0; i < length; i++) { | 4231 for (int i = 0; i < length; i++) { |
| 4232 // Only collect names if access is permitted. | 4232 // Only collect names if access is permitted. |
| 4233 if (jsproto->IsAccessCheckNeeded() && | 4233 if (jsproto->IsAccessCheckNeeded() && |
| 4234 !Top::MayNamedAccess(*jsproto, | 4234 !Top::MayNamedAccess(*jsproto, |
| 4235 Heap::undefined_value(), | 4235 Heap::undefined_value(), |
| 4236 v8::ACCESS_KEYS)) { | 4236 v8::ACCESS_KEYS)) { |
| 4237 Top::ReportFailedAccessCheck(*jsproto, v8::ACCESS_KEYS); | 4237 Top::ReportFailedAccessCheck(*jsproto, v8::ACCESS_KEYS); |
| 4238 return *Factory::NewJSArray(0); | 4238 return *Factory::NewJSArray(0); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4271 int dest_pos = 0; | 4271 int dest_pos = 0; |
| 4272 for (int i = 0; i < total_property_count; i++) { | 4272 for (int i = 0; i < total_property_count; i++) { |
| 4273 Object* name = old_names->get(i); | 4273 Object* name = old_names->get(i); |
| 4274 if (name == Heap::hidden_symbol()) { | 4274 if (name == Heap::hidden_symbol()) { |
| 4275 continue; | 4275 continue; |
| 4276 } | 4276 } |
| 4277 names->set(dest_pos++, name); | 4277 names->set(dest_pos++, name); |
| 4278 } | 4278 } |
| 4279 } | 4279 } |
| 4280 | 4280 |
| 4281 DeleteArray(local_property_count); | |
| 4282 return *Factory::NewJSArrayWithElements(names); | 4281 return *Factory::NewJSArrayWithElements(names); |
| 4283 } | 4282 } |
| 4284 | 4283 |
| 4285 | 4284 |
| 4286 // Return the names of the local indexed properties. | 4285 // Return the names of the local indexed properties. |
| 4287 // args[0]: object | 4286 // args[0]: object |
| 4288 static Object* Runtime_GetLocalElementNames(Arguments args) { | 4287 static Object* Runtime_GetLocalElementNames(Arguments args) { |
| 4289 HandleScope scope; | 4288 HandleScope scope; |
| 4290 ASSERT(args.length() == 1); | 4289 ASSERT(args.length() == 1); |
| 4291 if (!args[0]->IsJSObject()) { | 4290 if (!args[0]->IsJSObject()) { |
| (...skipping 5983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10275 } else { | 10274 } else { |
| 10276 // Handle last resort GC and make sure to allow future allocations | 10275 // Handle last resort GC and make sure to allow future allocations |
| 10277 // to grow the heap without causing GCs (if possible). | 10276 // to grow the heap without causing GCs (if possible). |
| 10278 Counters::gc_last_resort_from_js.Increment(); | 10277 Counters::gc_last_resort_from_js.Increment(); |
| 10279 Heap::CollectAllGarbage(false); | 10278 Heap::CollectAllGarbage(false); |
| 10280 } | 10279 } |
| 10281 } | 10280 } |
| 10282 | 10281 |
| 10283 | 10282 |
| 10284 } } // namespace v8::internal | 10283 } } // namespace v8::internal |
| OLD | NEW |