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

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: We still generated the arrays with feature flag off. Fixed. 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7902 matching lines...) Expand 10 before | Expand all | Expand 10 after
7913 if (cell_contents->IsSmi()) { 7913 if (cell_contents->IsSmi()) {
7914 *kind = static_cast<ElementsKind>( 7914 *kind = static_cast<ElementsKind>(
7915 Smi::cast(cell_contents)->value()); 7915 Smi::cast(cell_contents)->value());
7916 return true; 7916 return true;
7917 } 7917 }
7918 } 7918 }
7919 return false; 7919 return false;
7920 } 7920 }
7921 7921
7922 7922
7923 // Heuristic: We only need to create allocation site info if the boilerplate
7924 // elements kind is the initial elements kind.
7925 AllocationSiteMode AllocationSiteInfo::GetMode(
7926 ElementsKind boilerplate_elements_kind) {
7927 if (FLAG_track_allocation_sites &&
7928 IsFastSmiElementsKind(boilerplate_elements_kind)) {
7929 return TRACK_ALLOCATION_SITE;
7930 }
7931
7932 return DONT_TRACK_ALLOCATION_SITE;
7933 }
7934
7935
7936 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from,
7937 ElementsKind to) {
7938 if (FLAG_track_allocation_sites &&
7939 IsFastSmiElementsKind(from) &&
7940 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) {
7941 return TRACK_ALLOCATION_SITE;
7942 }
7943
7944 return DONT_TRACK_ALLOCATION_SITE;
7945 }
7946
7947
7948 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { 7923 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) {
7949 // For array indexes mix the length into the hash as an array index could 7924 // For array indexes mix the length into the hash as an array index could
7950 // be zero. 7925 // be zero.
7951 ASSERT(length > 0); 7926 ASSERT(length > 0);
7952 ASSERT(length <= String::kMaxArrayIndexSize); 7927 ASSERT(length <= String::kMaxArrayIndexSize);
7953 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < 7928 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
7954 (1 << String::kArrayIndexValueBits)); 7929 (1 << String::kArrayIndexValueBits));
7955 7930
7956 value <<= String::kHashShift; 7931 value <<= String::kHashShift;
7957 value |= length << String::kArrayIndexHashLengthShift; 7932 value |= length << String::kArrayIndexHashLengthShift;
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
8382 // so they remain fast. 8357 // so they remain fast.
8383 if (!HasFastProperties()) { 8358 if (!HasFastProperties()) {
8384 MaybeObject* new_proto = TransformToFastProperties(0); 8359 MaybeObject* new_proto = TransformToFastProperties(0);
8385 if (new_proto->IsFailure()) return new_proto; 8360 if (new_proto->IsFailure()) return new_proto;
8386 ASSERT(new_proto == this); 8361 ASSERT(new_proto == this);
8387 } 8362 }
8388 return this; 8363 return this;
8389 } 8364 }
8390 8365
8391 8366
8392 MUST_USE_RESULT static MaybeObject* CacheInitialJSArrayMaps( 8367 MUST_USE_RESULT MaybeObject* CacheInitialJSArrayMaps(
8393 Context* native_context, Map* initial_map) { 8368 Context* native_context, Map* initial_map) {
8394 // Replace all of the cached initial array maps in the native context with 8369 // Replace all of the cached initial array maps in the native context with
8395 // the appropriate transitioned elements kind maps. 8370 // the appropriate transitioned elements kind maps.
8396 Heap* heap = native_context->GetHeap(); 8371 Heap* heap = native_context->GetHeap();
8397 MaybeObject* maybe_maps = 8372 MaybeObject* maybe_maps =
8398 heap->AllocateFixedArrayWithHoles(kElementsKindCount); 8373 heap->AllocateFixedArrayWithHoles(kElementsKindCount, TENURED);
8399 FixedArray* maps; 8374 FixedArray* maps;
8400 if (!maybe_maps->To(&maps)) return maybe_maps; 8375 if (!maybe_maps->To(&maps)) return maybe_maps;
8401 8376
8402 Map* current_map = initial_map; 8377 Map* current_map = initial_map;
8403 ElementsKind kind = current_map->elements_kind(); 8378 ElementsKind kind = current_map->elements_kind();
8404 ASSERT(kind == GetInitialFastElementsKind()); 8379 ASSERT(kind == GetInitialFastElementsKind());
8405 maps->set(kind, current_map); 8380 maps->set(kind, current_map);
8406 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1; 8381 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1;
8407 i < kFastElementsKindCount; ++i) { 8382 i < kFastElementsKindCount; ++i) {
8408 Map* new_map; 8383 Map* new_map;
(...skipping 6097 matching lines...) Expand 10 before | Expand all | Expand 10 after
14506 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14481 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14507 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14482 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14508 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14483 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14509 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14484 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14510 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14485 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14511 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14486 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14512 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14487 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14513 } 14488 }
14514 14489
14515 } } // namespace v8::internal 14490 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698