Chromium Code Reviews| 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2299 transitioned_map = maybe_transitioned_map; | 2299 transitioned_map = maybe_transitioned_map; |
| 2300 if (!IsFastPackedElementsKind(kind)) packed = false; | 2300 if (!IsFastPackedElementsKind(kind)) packed = false; |
| 2301 } | 2301 } |
| 2302 current_map = maybe_transitioned_map; | 2302 current_map = maybe_transitioned_map; |
| 2303 } | 2303 } |
| 2304 } | 2304 } |
| 2305 return transitioned_map; | 2305 return transitioned_map; |
| 2306 } | 2306 } |
| 2307 | 2307 |
| 2308 | 2308 |
| 2309 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { | 2309 Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { |
| 2310 Map* current_map = map; | 2310 Map* current_map = map; |
| 2311 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | 2311 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); |
| 2312 int to_index = IsFastElementsKind(to_kind) | 2312 int to_index = IsFastElementsKind(to_kind) |
| 2313 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2313 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2314 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2314 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2315 | 2315 |
| 2316 ASSERT(index <= to_index); | 2316 ASSERT(index <= to_index); |
| 2317 | 2317 |
| 2318 for (; index < to_index; ++index) { | 2318 for (; index < to_index; ++index) { |
| 2319 if (!current_map->HasElementsTransition()) return current_map; | 2319 if (!current_map->HasElementsTransition()) return current_map; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2330 } | 2330 } |
| 2331 | 2331 |
| 2332 | 2332 |
| 2333 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { | 2333 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { |
| 2334 Map* to_map = FindClosestElementsTransition(this, to_kind); | 2334 Map* to_map = FindClosestElementsTransition(this, to_kind); |
| 2335 if (to_map->elements_kind() == to_kind) return to_map; | 2335 if (to_map->elements_kind() == to_kind) return to_map; |
| 2336 return NULL; | 2336 return NULL; |
| 2337 } | 2337 } |
| 2338 | 2338 |
| 2339 | 2339 |
| 2340 static MaybeObject* AddMissingElementsTransitions(Map* map, | 2340 MaybeObject* AddMissingElementsTransitions(Map* map, ElementsKind to_kind) { |
|
danno
2012/11/14 15:28:18
Perhaps it is time to move this to be part of the
mvstanton
2012/11/16 15:15:06
Done.
| |
| 2341 ElementsKind to_kind) { | |
| 2342 ASSERT(IsFastElementsKind(map->elements_kind())); | 2341 ASSERT(IsFastElementsKind(map->elements_kind())); |
| 2343 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | 2342 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); |
| 2344 int to_index = IsFastElementsKind(to_kind) | 2343 int to_index = IsFastElementsKind(to_kind) |
| 2345 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2344 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2346 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2345 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2347 | 2346 |
| 2348 ASSERT(index <= to_index); | 2347 ASSERT(index <= to_index); |
| 2349 | 2348 |
| 2350 Map* current_map = map; | 2349 Map* current_map = map; |
| 2351 | 2350 |
| (...skipping 11506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13858 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13857 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13859 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13858 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13860 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13859 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13861 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13860 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13862 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13861 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13863 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13862 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13864 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13863 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13865 } | 13864 } |
| 13866 | 13865 |
| 13867 } } // namespace v8::internal | 13866 } } // namespace v8::internal |
| OLD | NEW |