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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (FLAG_optimize_constructed_arrays) { | 212 if (FLAG_optimize_constructed_arrays) { |
213 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); | 213 AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); |
214 ElementsKind to_kind = array->GetElementsKind(); | 214 if (info != NULL) { |
215 if (info != NULL && info->GetElementsKindPayload(&to_kind)) { | 215 AllocationSite* site = AllocationSite::cast(info->payload()); |
| 216 ElementsKind to_kind = site->GetElementsKindPayload(); |
216 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), | 217 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), |
217 to_kind)) { | 218 to_kind)) { |
218 // We have advice that we should change the elements kind | 219 // We have advice that we should change the elements kind |
219 if (FLAG_trace_track_allocation_sites) { | 220 if (FLAG_trace_track_allocation_sites) { |
220 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", | 221 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", |
221 reinterpret_cast<void*>(array), | 222 reinterpret_cast<void*>(array), |
222 ElementsKindToString(array->GetElementsKind()), | 223 ElementsKindToString(array->GetElementsKind()), |
223 ElementsKindToString(to_kind)); | 224 ElementsKindToString(to_kind)); |
224 } | 225 } |
225 | 226 |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 return Handle<Code>(code_address); \ | 1831 return Handle<Code>(code_address); \ |
1831 } | 1832 } |
1832 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1833 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1833 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1834 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1834 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1835 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1835 #undef DEFINE_BUILTIN_ACCESSOR_C | 1836 #undef DEFINE_BUILTIN_ACCESSOR_C |
1836 #undef DEFINE_BUILTIN_ACCESSOR_A | 1837 #undef DEFINE_BUILTIN_ACCESSOR_A |
1837 | 1838 |
1838 | 1839 |
1839 } } // namespace v8::internal | 1840 } } // namespace v8::internal |
OLD | NEW |