Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: src/objects.cc

Issue 11365174: A change in the way we place TransitionElementKinds in the tree. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Now have instruction writing, map check updating. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 transitioned_map = maybe_transitioned_map; 2316 transitioned_map = maybe_transitioned_map;
2317 if (!IsFastPackedElementsKind(kind)) packed = false; 2317 if (!IsFastPackedElementsKind(kind)) packed = false;
2318 } 2318 }
2319 current_map = maybe_transitioned_map; 2319 current_map = maybe_transitioned_map;
2320 } 2320 }
2321 } 2321 }
2322 return transitioned_map; 2322 return transitioned_map;
2323 } 2323 }
2324 2324
2325 2325
2326 static Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) { 2326 Map* FindClosestElementsTransition(Map* map, ElementsKind to_kind) {
2327 Map* current_map = map; 2327 Map* current_map = map;
2328 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); 2328 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind());
2329 int to_index = IsFastElementsKind(to_kind) 2329 int to_index = IsFastElementsKind(to_kind)
2330 ? GetSequenceIndexFromFastElementsKind(to_kind) 2330 ? GetSequenceIndexFromFastElementsKind(to_kind)
2331 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); 2331 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
2332 2332
2333 ASSERT(index <= to_index); 2333 ASSERT(index <= to_index);
2334 2334
2335 for (; index < to_index; ++index) { 2335 for (; index < to_index; ++index) {
2336 if (!current_map->HasElementsTransition()) return current_map; 2336 if (!current_map->HasElementsTransition()) return current_map;
(...skipping 10 matching lines...) Expand all
2347 } 2347 }
2348 2348
2349 2349
2350 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { 2350 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) {
2351 Map* to_map = FindClosestElementsTransition(this, to_kind); 2351 Map* to_map = FindClosestElementsTransition(this, to_kind);
2352 if (to_map->elements_kind() == to_kind) return to_map; 2352 if (to_map->elements_kind() == to_kind) return to_map;
2353 return NULL; 2353 return NULL;
2354 } 2354 }
2355 2355
2356 2356
2357 static MaybeObject* AddMissingElementsTransitions(Map* map, 2357 MaybeObject* Map::AddMissingElementsTransitions(ElementsKind to_kind) {
2358 ElementsKind to_kind) { 2358 ASSERT(IsFastElementsKind(elements_kind()));
2359 ASSERT(IsFastElementsKind(map->elements_kind())); 2359 int index = GetSequenceIndexFromFastElementsKind(elements_kind());
2360 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind());
2361 int to_index = IsFastElementsKind(to_kind) 2360 int to_index = IsFastElementsKind(to_kind)
2362 ? GetSequenceIndexFromFastElementsKind(to_kind) 2361 ? GetSequenceIndexFromFastElementsKind(to_kind)
2363 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); 2362 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
2364 2363
2365 ASSERT(index <= to_index); 2364 ASSERT(index <= to_index);
2366 2365
2367 Map* current_map = map; 2366 Map* current_map = this;
2368 2367
2369 for (; index < to_index; ++index) { 2368 for (; index < to_index; ++index) {
2370 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1); 2369 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(index + 1);
2371 MaybeObject* maybe_next_map = 2370 MaybeObject* maybe_next_map =
2372 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); 2371 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION);
2373 if (!maybe_next_map->To(&current_map)) return maybe_next_map; 2372 if (!maybe_next_map->To(&current_map)) return maybe_next_map;
2374 } 2373 }
2375 2374
2376 // In case we are exiting the fast elements kind system, just add the map in 2375 // In case we are exiting the fast elements kind system, just add the map in
2377 // the end. 2376 // the end.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 if (!allow_store_transition) { 2420 if (!allow_store_transition) {
2422 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION); 2421 return start_map->CopyAsElementsKind(to_kind, OMIT_TRANSITION);
2423 } 2422 }
2424 2423
2425 Map* closest_map = FindClosestElementsTransition(start_map, to_kind); 2424 Map* closest_map = FindClosestElementsTransition(start_map, to_kind);
2426 2425
2427 if (closest_map->elements_kind() == to_kind) { 2426 if (closest_map->elements_kind() == to_kind) {
2428 return closest_map; 2427 return closest_map;
2429 } 2428 }
2430 2429
2431 return AddMissingElementsTransitions(closest_map, to_kind); 2430 return closest_map->AddMissingElementsTransitions(to_kind);
2432 } 2431 }
2433 2432
2434 2433
2435 void JSObject::LocalLookupRealNamedProperty(String* name, 2434 void JSObject::LocalLookupRealNamedProperty(String* name,
2436 LookupResult* result) { 2435 LookupResult* result) {
2437 if (IsJSGlobalProxy()) { 2436 if (IsJSGlobalProxy()) {
2438 Object* proto = GetPrototype(); 2437 Object* proto = GetPrototype();
2439 if (proto->IsNull()) return result->NotFound(); 2438 if (proto->IsNull()) return result->NotFound();
2440 ASSERT(proto->IsJSGlobalObject()); 2439 ASSERT(proto->IsJSGlobalObject());
2441 // A GlobalProxy's prototype should always be a proper JSObject. 2440 // A GlobalProxy's prototype should always be a proper JSObject.
(...skipping 11437 matching lines...) Expand 10 before | Expand all | Expand 10 after
13879 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13878 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13880 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13879 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13881 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13880 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13882 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13881 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13883 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13882 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13884 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13883 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13885 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13884 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13886 } 13885 }
13887 13886
13888 } } // namespace v8::internal 13887 } } // namespace v8::internal
OLDNEW
« src/hydrogen.cc ('K') | « src/objects.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698