| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6244 bool JSObject::HasNamedInterceptor() { | 6244 bool JSObject::HasNamedInterceptor() { |
| 6245 return map()->has_named_interceptor(); | 6245 return map()->has_named_interceptor(); |
| 6246 } | 6246 } |
| 6247 | 6247 |
| 6248 | 6248 |
| 6249 bool JSObject::HasIndexedInterceptor() { | 6249 bool JSObject::HasIndexedInterceptor() { |
| 6250 return map()->has_indexed_interceptor(); | 6250 return map()->has_indexed_interceptor(); |
| 6251 } | 6251 } |
| 6252 | 6252 |
| 6253 | 6253 |
| 6254 MaybeObject* JSObject::EnsureWritableFastElements() { | |
| 6255 ASSERT(HasFastSmiOrObjectElements()); | |
| 6256 FixedArray* elems = FixedArray::cast(elements()); | |
| 6257 Isolate* isolate = GetIsolate(); | |
| 6258 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; | |
| 6259 Object* writable_elems; | |
| 6260 { MaybeObject* maybe_writable_elems = isolate->heap()->CopyFixedArrayWithMap( | |
| 6261 elems, isolate->heap()->fixed_array_map()); | |
| 6262 if (!maybe_writable_elems->ToObject(&writable_elems)) { | |
| 6263 return maybe_writable_elems; | |
| 6264 } | |
| 6265 } | |
| 6266 set_elements(FixedArray::cast(writable_elems)); | |
| 6267 isolate->counters()->cow_arrays_converted()->Increment(); | |
| 6268 return writable_elems; | |
| 6269 } | |
| 6270 | |
| 6271 | |
| 6272 NameDictionary* JSObject::property_dictionary() { | 6254 NameDictionary* JSObject::property_dictionary() { |
| 6273 ASSERT(!HasFastProperties()); | 6255 ASSERT(!HasFastProperties()); |
| 6274 return NameDictionary::cast(properties()); | 6256 return NameDictionary::cast(properties()); |
| 6275 } | 6257 } |
| 6276 | 6258 |
| 6277 | 6259 |
| 6278 SeededNumberDictionary* JSObject::element_dictionary() { | 6260 SeededNumberDictionary* JSObject::element_dictionary() { |
| 6279 ASSERT(HasDictionaryElements()); | 6261 ASSERT(HasDictionaryElements()); |
| 6280 return SeededNumberDictionary::cast(elements()); | 6262 return SeededNumberDictionary::cast(elements()); |
| 6281 } | 6263 } |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6803 IsFastDoubleElementsKind(array->GetElementsKind())) || | 6785 IsFastDoubleElementsKind(array->GetElementsKind())) || |
| 6804 ((storage->map() != array->GetHeap()->fixed_double_array_map()) && | 6786 ((storage->map() != array->GetHeap()->fixed_double_array_map()) && |
| 6805 (IsFastObjectElementsKind(array->GetElementsKind()) || | 6787 (IsFastObjectElementsKind(array->GetElementsKind()) || |
| 6806 (IsFastSmiElementsKind(array->GetElementsKind()) && | 6788 (IsFastSmiElementsKind(array->GetElementsKind()) && |
| 6807 Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles())))); | 6789 Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles())))); |
| 6808 array->set_elements(*storage); | 6790 array->set_elements(*storage); |
| 6809 array->set_length(Smi::FromInt(storage->length())); | 6791 array->set_length(Smi::FromInt(storage->length())); |
| 6810 } | 6792 } |
| 6811 | 6793 |
| 6812 | 6794 |
| 6813 MaybeObject* FixedArray::Copy() { | |
| 6814 if (length() == 0) return this; | |
| 6815 return GetHeap()->CopyFixedArray(this); | |
| 6816 } | |
| 6817 | |
| 6818 | |
| 6819 MaybeObject* FixedDoubleArray::Copy() { | |
| 6820 if (length() == 0) return this; | |
| 6821 return GetHeap()->CopyFixedDoubleArray(this); | |
| 6822 } | |
| 6823 | |
| 6824 | |
| 6825 MaybeObject* ConstantPoolArray::Copy() { | |
| 6826 if (length() == 0) return this; | |
| 6827 return GetHeap()->CopyConstantPoolArray(this); | |
| 6828 } | |
| 6829 | |
| 6830 | |
| 6831 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { | 6795 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { |
| 6832 return isolate->factory()->uninitialized_symbol(); | 6796 return isolate->factory()->uninitialized_symbol(); |
| 6833 } | 6797 } |
| 6834 | 6798 |
| 6835 | 6799 |
| 6836 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { | 6800 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { |
| 6837 return isolate->factory()->megamorphic_symbol(); | 6801 return isolate->factory()->megamorphic_symbol(); |
| 6838 } | 6802 } |
| 6839 | 6803 |
| 6840 | 6804 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7041 #undef READ_SHORT_FIELD | 7005 #undef READ_SHORT_FIELD |
| 7042 #undef WRITE_SHORT_FIELD | 7006 #undef WRITE_SHORT_FIELD |
| 7043 #undef READ_BYTE_FIELD | 7007 #undef READ_BYTE_FIELD |
| 7044 #undef WRITE_BYTE_FIELD | 7008 #undef WRITE_BYTE_FIELD |
| 7045 #undef NOBARRIER_READ_BYTE_FIELD | 7009 #undef NOBARRIER_READ_BYTE_FIELD |
| 7046 #undef NOBARRIER_WRITE_BYTE_FIELD | 7010 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7047 | 7011 |
| 7048 } } // namespace v8::internal | 7012 } } // namespace v8::internal |
| 7049 | 7013 |
| 7050 #endif // V8_OBJECTS_INL_H_ | 7014 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |