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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 JSArray* array; | 206 JSArray* array; |
207 if (CalledAsConstructor(isolate)) { | 207 if (CalledAsConstructor(isolate)) { |
208 array = JSArray::cast((*args)[0]); | 208 array = JSArray::cast((*args)[0]); |
209 // Initialize elements and length in case later allocations fail so that the | 209 // Initialize elements and length in case later allocations fail so that the |
210 // array object is initialized in a valid state. | 210 // array object is initialized in a valid state. |
211 MaybeObject* maybe_array = array->Initialize(0); | 211 MaybeObject* maybe_array = array->Initialize(0); |
212 if (maybe_array->IsFailure()) return maybe_array; | 212 if (maybe_array->IsFailure()) return maybe_array; |
213 | 213 |
214 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); | 214 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); |
215 ElementsKind to_kind = array->GetElementsKind(); | 215 if (info != NULL && info->IsValid()) { |
216 if (info != NULL && info->GetElementsKindPayload(&to_kind)) { | 216 AllocationSite* site = info->GetAllocationSite(); |
| 217 ElementsKind to_kind = site->GetElementsKindPayload(); |
217 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), | 218 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), |
218 to_kind)) { | 219 to_kind)) { |
219 // We have advice that we should change the elements kind | 220 // We have advice that we should change the elements kind |
220 if (FLAG_trace_track_allocation_sites) { | 221 if (FLAG_trace_track_allocation_sites) { |
221 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", | 222 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", |
222 reinterpret_cast<void*>(array), | 223 reinterpret_cast<void*>(array), |
223 ElementsKindToString(array->GetElementsKind()), | 224 ElementsKindToString(array->GetElementsKind()), |
224 ElementsKindToString(to_kind)); | 225 ElementsKindToString(to_kind)); |
225 } | 226 } |
226 | 227 |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 return Handle<Code>(code_address); \ | 1835 return Handle<Code>(code_address); \ |
1835 } | 1836 } |
1836 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1837 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1837 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1838 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1838 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1839 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1839 #undef DEFINE_BUILTIN_ACCESSOR_C | 1840 #undef DEFINE_BUILTIN_ACCESSOR_C |
1840 #undef DEFINE_BUILTIN_ACCESSOR_A | 1841 #undef DEFINE_BUILTIN_ACCESSOR_A |
1841 | 1842 |
1842 | 1843 |
1843 } } // namespace v8::internal | 1844 } } // namespace v8::internal |
OLD | NEW |