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