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