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

Side by Side Diff: src/objects.cc

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 8 months 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 7875 matching lines...) Expand 10 before | Expand all | Expand 10 after
7886 if (cell_contents->IsSmi()) { 7886 if (cell_contents->IsSmi()) {
7887 *kind = static_cast<ElementsKind>( 7887 *kind = static_cast<ElementsKind>(
7888 Smi::cast(cell_contents)->value()); 7888 Smi::cast(cell_contents)->value());
7889 return true; 7889 return true;
7890 } 7890 }
7891 } 7891 }
7892 return false; 7892 return false;
7893 } 7893 }
7894 7894
7895 7895
7896 // Heuristic: We only need to create allocation site info if the boilerplate
7897 // elements kind is the initial elements kind.
7898 AllocationSiteMode AllocationSiteInfo::GetMode(
7899 ElementsKind boilerplate_elements_kind) {
7900 if (FLAG_track_allocation_sites &&
7901 IsFastSmiElementsKind(boilerplate_elements_kind)) {
7902 return TRACK_ALLOCATION_SITE;
7903 }
7904
7905 return DONT_TRACK_ALLOCATION_SITE;
7906 }
7907
7908
7909 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
7910 ElementsKind to) {
7911 if (FLAG_track_allocation_sites &&
7912 IsFastSmiElementsKind(from) &&
7913 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
7914 return TRACK_ALLOCATION_SITE;
7915 }
7916
7917 return DONT_TRACK_ALLOCATION_SITE;
7918 }
7919
7920
7921 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { 7896 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) {
7922 // For array indexes mix the length into the hash as an array index could 7897 // For array indexes mix the length into the hash as an array index could
7923 // be zero. 7898 // be zero.
7924 ASSERT(length > 0); 7899 ASSERT(length > 0);
7925 ASSERT(length <= String::kMaxArrayIndexSize); 7900 ASSERT(length <= String::kMaxArrayIndexSize);
7926 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < 7901 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
7927 (1 << String::kArrayIndexValueBits)); 7902 (1 << String::kArrayIndexValueBits));
7928 7903
7929 value <<= String::kHashShift; 7904 value <<= String::kHashShift;
7930 value |= length << String::kArrayIndexHashLengthShift; 7905 value |= length << String::kArrayIndexHashLengthShift;
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
8355 // so they remain fast. 8330 // so they remain fast.
8356 if (!HasFastProperties()) { 8331 if (!HasFastProperties()) {
8357 MaybeObject* new_proto = TransformToFastProperties(0); 8332 MaybeObject* new_proto = TransformToFastProperties(0);
8358 if (new_proto->IsFailure()) return new_proto; 8333 if (new_proto->IsFailure()) return new_proto;
8359 ASSERT(new_proto == this); 8334 ASSERT(new_proto == this);
8360 } 8335 }
8361 return this; 8336 return this;
8362 } 8337 }
8363 8338
8364 8339
8365 MUST_USE_RESULT static MaybeObject* CacheInitialJSArrayMaps( 8340 MUST_USE_RESULT MaybeObject* CacheInitialJSArrayMaps(
8366 Context* native_context, Map* initial_map) { 8341 Context* native_context, Map* initial_map) {
8367 // Replace all of the cached initial array maps in the native context with 8342 // Replace all of the cached initial array maps in the native context with
8368 // the appropriate transitioned elements kind maps. 8343 // the appropriate transitioned elements kind maps.
8369 Heap* heap = native_context->GetHeap(); 8344 Heap* heap = native_context->GetHeap();
8370 MaybeObject* maybe_maps = 8345 MaybeObject* maybe_maps =
8371 heap->AllocateFixedArrayWithHoles(kElementsKindCount); 8346 heap->AllocateFixedArrayWithHoles(kElementsKindCount, TENURED);
8372 FixedArray* maps; 8347 FixedArray* maps;
8373 if (!maybe_maps->To(&maps)) return maybe_maps; 8348 if (!maybe_maps->To(&maps)) return maybe_maps;
8374 8349
8375 Map* current_map = initial_map; 8350 Map* current_map = initial_map;
8376 ElementsKind kind = current_map->elements_kind(); 8351 ElementsKind kind = current_map->elements_kind();
8377 ASSERT(kind == GetInitialFastElementsKind()); 8352 ASSERT(kind == GetInitialFastElementsKind());
8378 maps->set(kind, current_map); 8353 maps->set(kind, current_map);
8379 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1; 8354 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1;
8380 i < kFastElementsKindCount; ++i) { 8355 i < kFastElementsKindCount; ++i) {
8381 Map* new_map; 8356 Map* new_map;
(...skipping 6096 matching lines...) Expand 10 before | Expand all | Expand 10 after
14478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14453 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14454 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14455 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14456 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14457 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14458 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14459 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14485 } 14460 }
14486 14461
14487 } } // namespace v8::internal 14462 } } // namespace v8::internal
OLDNEW
« src/flag-definitions.h ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698