| 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 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2315 transitioned_map = maybe_transitioned_map; | 2315 transitioned_map = maybe_transitioned_map; |
| 2316 if (!IsFastPackedElementsKind(kind)) packed = false; | 2316 if (!IsFastPackedElementsKind(kind)) packed = false; |
| 2317 } | 2317 } |
| 2318 current_map = maybe_transitioned_map; | 2318 current_map = maybe_transitioned_map; |
| 2319 } | 2319 } |
| 2320 } | 2320 } |
| 2321 return transitioned_map; | 2321 return transitioned_map; |
| 2322 } | 2322 } |
| 2323 | 2323 |
| 2324 | 2324 |
| 2325 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { | 2325 Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { |
| 2326 Map* current_map = map; | 2326 Map* current_map = map; |
| 2327 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | 2327 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); |
| 2328 int to_index = IsFastElementsKind(to_kind) | 2328 int to_index = IsFastElementsKind(to_kind) |
| 2329 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2329 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2330 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2330 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2331 | 2331 |
| 2332 ASSERT(index <= to_index); | 2332 ASSERT(index <= to_index); |
| 2333 | 2333 |
| 2334 for (; index < to_index; ++index) { | 2334 for (; index < to_index; ++index) { |
| 2335 if (!current_map->HasElementsTransition()) return current_map; | 2335 if (!current_map->HasElementsTransition()) return current_map; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2346 } | 2346 } |
| 2347 | 2347 |
| 2348 | 2348 |
| 2349 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { | 2349 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { |
| 2350 Map* to_map = FindClosestElementsTransition(this, to_kind); | 2350 Map* to_map = FindClosestElementsTransition(this, to_kind); |
| 2351 if (to_map->elements_kind() == to_kind) return to_map; | 2351 if (to_map->elements_kind() == to_kind) return to_map; |
| 2352 return NULL; | 2352 return NULL; |
| 2353 } | 2353 } |
| 2354 | 2354 |
| 2355 | 2355 |
| 2356 static MaybeObject* AddMissingElementsTransitions(Map* map, | 2356 MaybeObject* Map::AddMissingElementsTransitions(ElementsKind to_kind) { |
| 2357 ElementsKind to_kind) { | 2357 ASSERT(IsFastElementsKind(elements_kind())); |
| 2358 ASSERT(IsFastElementsKind(map->elements_kind())); | 2358 int index = GetSequenceIndexFromFastElementsKind(elements_kind()); |
| 2359 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); | |
| 2360 int to_index = IsFastElementsKind(to_kind) | 2359 int to_index = IsFastElementsKind(to_kind) |
| 2361 ? GetSequenceIndexFromFastElementsKind(to_kind) | 2360 ? GetSequenceIndexFromFastElementsKind(to_kind) |
| 2362 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); | 2361 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); |
| 2363 | 2362 |
| 2364 ASSERT(index <= to_index); | 2363 ASSERT(index <= to_index); |
| 2365 | 2364 |
| 2366 Map* current_map = map; | 2365 Map* current_map = this; |
| 2367 | 2366 |
| 2368 for (; index < to_index; ++index) { | 2367 for (; index < to_index; ++index) { |
| 2369 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1); | 2368 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1); |
| 2370 MaybeObject* maybe_next_map = | 2369 MaybeObject* maybe_next_map = |
| 2371 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); | 2370 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); |
| 2372 if (!maybe_next_map->To(¤t_map)) return maybe_next_map; | 2371 if (!maybe_next_map->To(¤t_map)) return maybe_next_map; |
| 2373 } | 2372 } |
| 2374 | 2373 |
| 2375 // In case we are exiting the fast elements kind system, just add the map in | 2374 // In case we are exiting the fast elements kind system, just add the map in |
| 2376 // the end. | 2375 // the end. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 if (!allow_store_transition) { | 2419 if (!allow_store_transition) { |
| 2421 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION); | 2420 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION); |
| 2422 } | 2421 } |
| 2423 | 2422 |
| 2424 Map* closest_map = FindClosestElementsTransition(start_map, to_kind); | 2423 Map* closest_map = FindClosestElementsTransition(start_map, to_kind); |
| 2425 | 2424 |
| 2426 if (closest_map->elements_kind() == to_kind) { | 2425 if (closest_map->elements_kind() == to_kind) { |
| 2427 return closest_map; | 2426 return closest_map; |
| 2428 } | 2427 } |
| 2429 | 2428 |
| 2430 return AddMissingElementsTransitions(closest_map, to_kind); | 2429 return closest_map->AddMissingElementsTransitions(to_kind); |
| 2431 } | 2430 } |
| 2432 | 2431 |
| 2433 | 2432 |
| 2434 void JSObject::LocalLookupRealNamedProperty(String* name, | 2433 void JSObject::LocalLookupRealNamedProperty(String* name, |
| 2435 LookupResult* result) { | 2434 LookupResult* result) { |
| 2436 if (IsJSGlobalProxy()) { | 2435 if (IsJSGlobalProxy()) { |
| 2437 Object* proto = GetPrototype(); | 2436 Object* proto = GetPrototype(); |
| 2438 if (proto->IsNull()) return result->NotFound(); | 2437 if (proto->IsNull()) return result->NotFound(); |
| 2439 ASSERT(proto->IsJSGlobalObject()); | 2438 ASSERT(proto->IsJSGlobalObject()); |
| 2440 // A GlobalProxy's prototype should always be a proper JSObject. | 2439 // A GlobalProxy's prototype should always be a proper JSObject. |
| (...skipping 11427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13868 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13867 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13869 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13868 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13870 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13869 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13871 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13870 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13872 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13871 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13873 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13872 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13874 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13873 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13875 } | 13874 } |
| 13876 | 13875 |
| 13877 } } // namespace v8::internal | 13876 } } // namespace v8::internal |
| OLD | NEW |