OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3372 } | 3372 } |
3373 | 3373 |
3374 | 3374 |
3375 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { | 3375 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { |
3376 Map* current_map = map; | 3376 Map* current_map = map; |
3377 int target_kind = | 3377 int target_kind = |
3378 IsFastElementsKind(to_kind) || IsExternalArrayElementsKind(to_kind) | 3378 IsFastElementsKind(to_kind) || IsExternalArrayElementsKind(to_kind) |
3379 ? to_kind | 3379 ? to_kind |
3380 : TERMINAL_FAST_ELEMENTS_KIND; | 3380 : TERMINAL_FAST_ELEMENTS_KIND; |
3381 | 3381 |
3382 // Support for legacy API. | 3382 // Support for legacy API: SetIndexedPropertiesTo{External,Pixel}Data |
3383 // allows to change elements from arbitrary kind to any | |
Igor Sheludko
2014/05/23 12:24:14
nit: please reformat comment
| |
3384 // ExternalArray elements kind. Satisfy its requirements, checking whether | |
3385 // we already have the cached transition. | |
3383 if (IsExternalArrayElementsKind(to_kind) && | 3386 if (IsExternalArrayElementsKind(to_kind) && |
3384 !IsFixedTypedArrayElementsKind(map->elements_kind())) { | 3387 !IsFixedTypedArrayElementsKind(map->elements_kind())) { |
3388 if (map->HasElementsTransition()) { | |
3389 Map* next_map = map->elements_transition_map(); | |
3390 if (next_map->elements_kind() == to_kind) return next_map; | |
3391 } | |
3385 return map; | 3392 return map; |
3386 } | 3393 } |
3387 | 3394 |
3388 ElementsKind kind = map->elements_kind(); | 3395 ElementsKind kind = map->elements_kind(); |
3389 while (kind != target_kind) { | 3396 while (kind != target_kind) { |
3390 kind = GetNextTransitionElementsKind(kind); | 3397 kind = GetNextTransitionElementsKind(kind); |
3391 if (!current_map->HasElementsTransition()) return current_map; | 3398 if (!current_map->HasElementsTransition()) return current_map; |
3392 current_map = current_map->elements_transition_map(); | 3399 current_map = current_map->elements_transition_map(); |
3393 } | 3400 } |
3394 | 3401 |
(...skipping 13860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17255 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17262 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17256 static const char* error_messages_[] = { | 17263 static const char* error_messages_[] = { |
17257 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17264 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17258 }; | 17265 }; |
17259 #undef ERROR_MESSAGES_TEXTS | 17266 #undef ERROR_MESSAGES_TEXTS |
17260 return error_messages_[reason]; | 17267 return error_messages_[reason]; |
17261 } | 17268 } |
17262 | 17269 |
17263 | 17270 |
17264 } } // namespace v8::internal | 17271 } } // namespace v8::internal |
OLD | NEW |