| 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 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 transitioned_map = maybe_transitioned_map; | 2324 transitioned_map = maybe_transitioned_map; |
| 2325 if (!IsFastPackedElementsKind(kind)) packed = false; | 2325 if (!IsFastPackedElementsKind(kind)) packed = false; |
| 2326 } | 2326 } |
| 2327 current_map = maybe_transitioned_map; | 2327 current_map = maybe_transitioned_map; |
| 2328 } | 2328 } |
| 2329 } | 2329 } |
| 2330 return transitioned_map; | 2330 return transitioned_map; |
| 2331 } | 2331 } |
| 2332 | 2332 |
| 2333 | 2333 |
| 2334 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { | 2334 Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { |
| 2335 Map* current_map = map; | 2335 Map* current_map = map; |
| 2336 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | 2336 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); |
| 2337 int to_index = IsFastElementsKind(to_kind) | 2337 int to_index = IsFastElementsKind(to_kind) |
| 2338 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2338 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2339 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2339 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2340 | 2340 |
| 2341 ASSERT(index <= to_index); | 2341 ASSERT(index <= to_index); |
| 2342 | 2342 |
| 2343 for (; index < to_index; ++index) { | 2343 for (; index < to_index; ++index) { |
| 2344 if (!current_map->HasElementsTransition()) return current_map; | 2344 if (!current_map->HasElementsTransition()) return current_map; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2355 } | 2355 } |
| 2356 | 2356 |
| 2357 | 2357 |
| 2358 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { | 2358 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { |
| 2359 Map* to_map = FindClosestElementsTransition(this, to_kind); | 2359 Map* to_map = FindClosestElementsTransition(this, to_kind); |
| 2360 if (to_map->elements_kind() == to_kind) return to_map; | 2360 if (to_map->elements_kind() == to_kind) return to_map; |
| 2361 return NULL; | 2361 return NULL; |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 | 2364 |
| 2365 static MaybeObject* AddMissingElementsTransitions(Map* map, | 2365 MaybeObject* Map::AddMissingElementsTransitions(ElementsKind to_kind) { |
| 2366 ElementsKind to_kind) { | 2366 ASSERT(IsFastElementsKind(elements_kind())); |
| 2367 ASSERT(IsFastElementsKind(map->elements_kind())); | 2367 int index = GetSequenceIndexFromFastElementsKind(elements_kind()); |
| 2368 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | |
| 2369 int to_index = IsFastElementsKind(to_kind) | 2368 int to_index = IsFastElementsKind(to_kind) |
| 2370 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2369 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2371 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2370 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2372 | 2371 |
| 2373 ASSERT(index <= to_index); | 2372 ASSERT(index <= to_index); |
| 2374 | 2373 |
| 2375 Map* current_map = map; | 2374 Map* current_map = this; |
| 2376 | 2375 |
| 2377 for (; index < to_index; ++index) { | 2376 for (; index < to_index; ++index) { |
| 2378 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1); | 2377 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1); |
| 2379 MaybeObject* maybe_next_map = | 2378 MaybeObject* maybe_next_map = |
| 2380 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); | 2379 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); |
| 2381 if (!maybe_next_map->To(¤t_map)) return maybe_next_map; | 2380 if (!maybe_next_map->To(¤t_map)) return maybe_next_map; |
| 2382 } | 2381 } |
| 2383 | 2382 |
| 2384 // In case we are exiting the fast elements kind system, just add the map in | 2383 // In case we are exiting the fast elements kind system, just add the map in |
| 2385 // the end. | 2384 // the end. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 if (!allow_store_transition) { | 2428 if (!allow_store_transition) { |
| 2430 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION); | 2429 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION); |
| 2431 } | 2430 } |
| 2432 | 2431 |
| 2433 Map* closest_map = FindClosestElementsTransition(start_map, to_kind); | 2432 Map* closest_map = FindClosestElementsTransition(start_map, to_kind); |
| 2434 | 2433 |
| 2435 if (closest_map->elements_kind() == to_kind) { | 2434 if (closest_map->elements_kind() == to_kind) { |
| 2436 return closest_map; | 2435 return closest_map; |
| 2437 } | 2436 } |
| 2438 | 2437 |
| 2439 return AddMissingElementsTransitions(closest_map, to_kind); | 2438 return closest_map->AddMissingElementsTransitions(to_kind); |
| 2440 } | 2439 } |
| 2441 | 2440 |
| 2442 | 2441 |
| 2443 void JSObject::LocalLookupRealNamedProperty(String* name, | 2442 void JSObject::LocalLookupRealNamedProperty(String* name, |
| 2444 LookupResult* result) { | 2443 LookupResult* result) { |
| 2445 if (IsJSGlobalProxy()) { | 2444 if (IsJSGlobalProxy()) { |
| 2446 Object* proto = GetPrototype(); | 2445 Object* proto = GetPrototype(); |
| 2447 if (proto->IsNull()) return result->NotFound(); | 2446 if (proto->IsNull()) return result->NotFound(); |
| 2448 ASSERT(proto->IsJSGlobalObject()); | 2447 ASSERT(proto->IsJSGlobalObject()); |
| 2449 // A GlobalProxy's prototype should always be a proper JSObject. | 2448 // A GlobalProxy's prototype should always be a proper JSObject. |
| (...skipping 11584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14034 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14033 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 14035 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14034 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 14036 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14035 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 14037 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14036 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 14038 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14037 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 14039 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14038 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 14040 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14039 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 14041 } | 14040 } |
| 14042 | 14041 |
| 14043 } } // namespace v8::internal | 14042 } } // namespace v8::internal |
| OLD | NEW |