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 isolate->counters()->array_function_runtime()->Increment(); | 204 isolate->counters()->array_function_runtime()->Increment(); |
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 AllocationMemento* memento = AllocationMemento::FindForJSObject(array); |
215 if (info != NULL && info->IsValid()) { | 215 if (memento != NULL && memento->IsValid()) { |
216 AllocationSite* site = info->GetAllocationSite(); | 216 AllocationSite* site = memento->GetAllocationSite(); |
217 ElementsKind to_kind = site->GetElementsKind(); | 217 ElementsKind to_kind = site->GetElementsKind(); |
218 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), | 218 if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), |
219 to_kind)) { | 219 to_kind)) { |
220 // We have advice that we should change the elements kind | 220 // We have advice that we should change the elements kind |
221 if (FLAG_trace_track_allocation_sites) { | 221 if (FLAG_trace_track_allocation_sites) { |
222 PrintF("AllocationSiteInfo: pre-transitioning array %p(%s->%s)\n", | 222 PrintF("AllocationSite: pre-transitioning array %p(%s->%s)\n", |
223 reinterpret_cast<void*>(array), | 223 reinterpret_cast<void*>(array), |
224 ElementsKindToString(array->GetElementsKind()), | 224 ElementsKindToString(array->GetElementsKind()), |
225 ElementsKindToString(to_kind)); | 225 ElementsKindToString(to_kind)); |
226 } | 226 } |
227 | 227 |
228 maybe_array = array->TransitionElementsKind(to_kind); | 228 maybe_array = array->TransitionElementsKind(to_kind); |
229 if (maybe_array->IsFailure()) return maybe_array; | 229 if (maybe_array->IsFailure()) return maybe_array; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 return Handle<Code>(code_address); \ | 1835 return Handle<Code>(code_address); \ |
1836 } | 1836 } |
1837 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1837 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1838 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1838 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1839 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1839 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1840 #undef DEFINE_BUILTIN_ACCESSOR_C | 1840 #undef DEFINE_BUILTIN_ACCESSOR_C |
1841 #undef DEFINE_BUILTIN_ACCESSOR_A | 1841 #undef DEFINE_BUILTIN_ACCESSOR_A |
1842 | 1842 |
1843 | 1843 |
1844 } } // namespace v8::internal | 1844 } } // namespace v8::internal |
OLD | NEW |