OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3920 if (!maybe->To<Map>(&new_map)) return maybe; | 3920 if (!maybe->To<Map>(&new_map)) return maybe; |
3921 } | 3921 } |
3922 new_map->set_is_extensible(false); | 3922 new_map->set_is_extensible(false); |
3923 set_map(new_map); | 3923 set_map(new_map); |
3924 ASSERT(!map()->is_extensible()); | 3924 ASSERT(!map()->is_extensible()); |
3925 return new_map; | 3925 return new_map; |
3926 } | 3926 } |
3927 | 3927 |
3928 | 3928 |
3929 // Tests for the fast common case for property enumeration: | 3929 // Tests for the fast common case for property enumeration: |
3930 // - This object and all prototypes has an enum cache (which means that it has | 3930 // - This object and all prototypes has an enum cache (which means that |
3931 // no interceptors and needs no access checks). | 3931 // it is no proxy, has no interceptors and needs no access checks). |
3932 // - This object has no elements. | 3932 // - This object has no elements. |
3933 // - No prototype has enumerable properties/elements. | 3933 // - No prototype has enumerable properties/elements. |
3934 bool JSObject::IsSimpleEnum() { | 3934 bool JSReceiver::IsSimpleEnum() { |
3935 Heap* heap = GetHeap(); | 3935 Heap* heap = GetHeap(); |
3936 for (Object* o = this; | 3936 for (Object* o = this; |
3937 o != heap->null_value(); | 3937 o != heap->null_value(); |
3938 o = JSObject::cast(o)->GetPrototype()) { | 3938 o = JSObject::cast(o)->GetPrototype()) { |
| 3939 if (!o->IsJSObject()) return false; |
3939 JSObject* curr = JSObject::cast(o); | 3940 JSObject* curr = JSObject::cast(o); |
3940 if (!curr->map()->instance_descriptors()->HasEnumCache()) return false; | 3941 if (!curr->map()->instance_descriptors()->HasEnumCache()) return false; |
3941 ASSERT(!curr->HasNamedInterceptor()); | 3942 ASSERT(!curr->HasNamedInterceptor()); |
3942 ASSERT(!curr->HasIndexedInterceptor()); | 3943 ASSERT(!curr->HasIndexedInterceptor()); |
3943 ASSERT(!curr->IsAccessCheckNeeded()); | 3944 ASSERT(!curr->IsAccessCheckNeeded()); |
3944 if (curr->NumberOfEnumElements() > 0) return false; | 3945 if (curr->NumberOfEnumElements() > 0) return false; |
3945 if (curr != this) { | 3946 if (curr != this) { |
3946 FixedArray* curr_fixed_array = | 3947 FixedArray* curr_fixed_array = |
3947 FixedArray::cast(curr->map()->instance_descriptors()->GetEnumCache()); | 3948 FixedArray::cast(curr->map()->instance_descriptors()->GetEnumCache()); |
3948 if (curr_fixed_array->length() > 0) return false; | 3949 if (curr_fixed_array->length() > 0) return false; |
(...skipping 8293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12242 if (break_point_objects()->IsUndefined()) return 0; | 12243 if (break_point_objects()->IsUndefined()) return 0; |
12243 // Single break point. | 12244 // Single break point. |
12244 if (!break_point_objects()->IsFixedArray()) return 1; | 12245 if (!break_point_objects()->IsFixedArray()) return 1; |
12245 // Multiple break points. | 12246 // Multiple break points. |
12246 return FixedArray::cast(break_point_objects())->length(); | 12247 return FixedArray::cast(break_point_objects())->length(); |
12247 } | 12248 } |
12248 #endif // ENABLE_DEBUGGER_SUPPORT | 12249 #endif // ENABLE_DEBUGGER_SUPPORT |
12249 | 12250 |
12250 | 12251 |
12251 } } // namespace v8::internal | 12252 } } // namespace v8::internal |
OLD | NEW |