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 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 if (!maybe->To<Map>(&new_map)) return maybe; | 4081 if (!maybe->To<Map>(&new_map)) return maybe; |
4082 } | 4082 } |
4083 new_map->set_is_extensible(false); | 4083 new_map->set_is_extensible(false); |
4084 set_map(new_map); | 4084 set_map(new_map); |
4085 ASSERT(!map()->is_extensible()); | 4085 ASSERT(!map()->is_extensible()); |
4086 return new_map; | 4086 return new_map; |
4087 } | 4087 } |
4088 | 4088 |
4089 | 4089 |
4090 // Tests for the fast common case for property enumeration: | 4090 // Tests for the fast common case for property enumeration: |
4091 // - This object and all prototypes has an enum cache (which means that it has | 4091 // - This object and all prototypes has an enum cache (which means that |
4092 // no interceptors and needs no access checks). | 4092 // it is no proxy, has no interceptors and needs no access checks). |
4093 // - This object has no elements. | 4093 // - This object has no elements. |
4094 // - No prototype has enumerable properties/elements. | 4094 // - No prototype has enumerable properties/elements. |
4095 bool JSObject::IsSimpleEnum() { | 4095 bool JSReceiver::IsSimpleEnum() { |
4096 Heap* heap = GetHeap(); | 4096 Heap* heap = GetHeap(); |
4097 for (Object* o = this; | 4097 for (Object* o = this; |
4098 o != heap->null_value(); | 4098 o != heap->null_value(); |
4099 o = JSObject::cast(o)->GetPrototype()) { | 4099 o = JSObject::cast(o)->GetPrototype()) { |
| 4100 if (!o->IsJSObject()) return false; |
4100 JSObject* curr = JSObject::cast(o); | 4101 JSObject* curr = JSObject::cast(o); |
4101 if (!curr->map()->instance_descriptors()->HasEnumCache()) return false; | 4102 if (!curr->map()->instance_descriptors()->HasEnumCache()) return false; |
4102 ASSERT(!curr->HasNamedInterceptor()); | 4103 ASSERT(!curr->HasNamedInterceptor()); |
4103 ASSERT(!curr->HasIndexedInterceptor()); | 4104 ASSERT(!curr->HasIndexedInterceptor()); |
4104 ASSERT(!curr->IsAccessCheckNeeded()); | 4105 ASSERT(!curr->IsAccessCheckNeeded()); |
4105 if (curr->NumberOfEnumElements() > 0) return false; | 4106 if (curr->NumberOfEnumElements() > 0) return false; |
4106 if (curr != this) { | 4107 if (curr != this) { |
4107 FixedArray* curr_fixed_array = | 4108 FixedArray* curr_fixed_array = |
4108 FixedArray::cast(curr->map()->instance_descriptors()->GetEnumCache()); | 4109 FixedArray::cast(curr->map()->instance_descriptors()->GetEnumCache()); |
4109 if (curr_fixed_array->length() > 0) return false; | 4110 if (curr_fixed_array->length() > 0) return false; |
(...skipping 8517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12627 if (break_point_objects()->IsUndefined()) return 0; | 12628 if (break_point_objects()->IsUndefined()) return 0; |
12628 // Single break point. | 12629 // Single break point. |
12629 if (!break_point_objects()->IsFixedArray()) return 1; | 12630 if (!break_point_objects()->IsFixedArray()) return 1; |
12630 // Multiple break points. | 12631 // Multiple break points. |
12631 return FixedArray::cast(break_point_objects())->length(); | 12632 return FixedArray::cast(break_point_objects())->length(); |
12632 } | 12633 } |
12633 #endif // ENABLE_DEBUGGER_SUPPORT | 12634 #endif // ENABLE_DEBUGGER_SUPPORT |
12634 | 12635 |
12635 | 12636 |
12636 } } // namespace v8::internal | 12637 } } // namespace v8::internal |
OLD | NEW |