| 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 4100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4111 Top::ReportFailedAccessCheck(*obj, v8::ACCESS_KEYS); | 4111 Top::ReportFailedAccessCheck(*obj, v8::ACCESS_KEYS); |
| 4112 return *Factory::NewJSArray(0); | 4112 return *Factory::NewJSArray(0); |
| 4113 } | 4113 } |
| 4114 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); | 4114 obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype())); |
| 4115 } | 4115 } |
| 4116 | 4116 |
| 4117 // Find the number of objects making up this. | 4117 // Find the number of objects making up this. |
| 4118 int length = LocalPrototypeChainLength(*obj); | 4118 int length = LocalPrototypeChainLength(*obj); |
| 4119 | 4119 |
| 4120 // Find the number of local properties for each of the objects. | 4120 // Find the number of local properties for each of the objects. |
| 4121 int* local_property_count = NewArray<int>(length); | 4121 ScopedVector<int> local_property_count(length); |
| 4122 int total_property_count = 0; | 4122 int total_property_count = 0; |
| 4123 Handle<JSObject> jsproto = obj; | 4123 Handle<JSObject> jsproto = obj; |
| 4124 for (int i = 0; i < length; i++) { | 4124 for (int i = 0; i < length; i++) { |
| 4125 // Only collect names if access is permitted. | 4125 // Only collect names if access is permitted. |
| 4126 if (jsproto->IsAccessCheckNeeded() && | 4126 if (jsproto->IsAccessCheckNeeded() && |
| 4127 !Top::MayNamedAccess(*jsproto, | 4127 !Top::MayNamedAccess(*jsproto, |
| 4128 Heap::undefined_value(), | 4128 Heap::undefined_value(), |
| 4129 v8::ACCESS_KEYS)) { | 4129 v8::ACCESS_KEYS)) { |
| 4130 Top::ReportFailedAccessCheck(*jsproto, v8::ACCESS_KEYS); | 4130 Top::ReportFailedAccessCheck(*jsproto, v8::ACCESS_KEYS); |
| 4131 return *Factory::NewJSArray(0); | 4131 return *Factory::NewJSArray(0); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4164 int dest_pos = 0; | 4164 int dest_pos = 0; |
| 4165 for (int i = 0; i < total_property_count; i++) { | 4165 for (int i = 0; i < total_property_count; i++) { |
| 4166 Object* name = old_names->get(i); | 4166 Object* name = old_names->get(i); |
| 4167 if (name == Heap::hidden_symbol()) { | 4167 if (name == Heap::hidden_symbol()) { |
| 4168 continue; | 4168 continue; |
| 4169 } | 4169 } |
| 4170 names->set(dest_pos++, name); | 4170 names->set(dest_pos++, name); |
| 4171 } | 4171 } |
| 4172 } | 4172 } |
| 4173 | 4173 |
| 4174 DeleteArray(local_property_count); | |
| 4175 return *Factory::NewJSArrayWithElements(names); | 4174 return *Factory::NewJSArrayWithElements(names); |
| 4176 } | 4175 } |
| 4177 | 4176 |
| 4178 | 4177 |
| 4179 // Return the names of the local indexed properties. | 4178 // Return the names of the local indexed properties. |
| 4180 // args[0]: object | 4179 // args[0]: object |
| 4181 static Object* Runtime_GetLocalElementNames(Arguments args) { | 4180 static Object* Runtime_GetLocalElementNames(Arguments args) { |
| 4182 HandleScope scope; | 4181 HandleScope scope; |
| 4183 ASSERT(args.length() == 1); | 4182 ASSERT(args.length() == 1); |
| 4184 if (!args[0]->IsJSObject()) { | 4183 if (!args[0]->IsJSObject()) { |
| (...skipping 5804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9989 } else { | 9988 } else { |
| 9990 // Handle last resort GC and make sure to allow future allocations | 9989 // Handle last resort GC and make sure to allow future allocations |
| 9991 // to grow the heap without causing GCs (if possible). | 9990 // to grow the heap without causing GCs (if possible). |
| 9992 Counters::gc_last_resort_from_js.Increment(); | 9991 Counters::gc_last_resort_from_js.Increment(); |
| 9993 Heap::CollectAllGarbage(false); | 9992 Heap::CollectAllGarbage(false); |
| 9994 } | 9993 } |
| 9995 } | 9994 } |
| 9996 | 9995 |
| 9997 | 9996 |
| 9998 } } // namespace v8::internal | 9997 } } // namespace v8::internal |
| OLD | NEW |