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

Side by Side Diff: src/objects.cc

Issue 15014020: Elide hole checks on KeyedLoads of holey double arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implement missing platforms and add tests Created 7 years, 7 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 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 } 2999 }
3000 3000
3001 3001
3002 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) { 3002 Map* Map::LookupElementsTransitionMap(ElementsKind to_kind) {
3003 Map* to_map = FindClosestElementsTransition(this, to_kind); 3003 Map* to_map = FindClosestElementsTransition(this, to_kind);
3004 if (to_map->elements_kind() == to_kind) return to_map; 3004 if (to_map->elements_kind() == to_kind) return to_map;
3005 return NULL; 3005 return NULL;
3006 } 3006 }
3007 3007
3008 3008
3009 bool Map::IsMapInArrayPrototypeChain() {
3010 Isolate* isolate = GetIsolate();
3011 if (isolate->initial_array_prototype()->map() == this) {
3012 return true;
3013 }
3014
3015 if (isolate->initial_object_prototype()->map() == this) {
3016 return true;
3017 }
3018
3019 return false;
3020 }
3021
3009 static MaybeObject* AddMissingElementsTransitions(Map* map, 3022 static MaybeObject* AddMissingElementsTransitions(Map* map,
3010 ElementsKind to_kind) { 3023 ElementsKind to_kind) {
3011 ASSERT(IsFastElementsKind(map->elements_kind())); 3024 ASSERT(IsFastElementsKind(map->elements_kind()));
3012 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind()); 3025 int index = GetSequenceIndexFromFastElementsKind(map->elements_kind());
3013 int to_index = IsFastElementsKind(to_kind) 3026 int to_index = IsFastElementsKind(to_kind)
3014 ? GetSequenceIndexFromFastElementsKind(to_kind) 3027 ? GetSequenceIndexFromFastElementsKind(to_kind)
3015 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND); 3028 : GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
3016 3029
3017 ASSERT(index <= to_index); 3030 ASSERT(index <= to_index);
3018 3031
(...skipping 8125 matching lines...) Expand 10 before | Expand all | Expand 10 after
11144 // Adding n elements in fast case is O(n*n). 11157 // Adding n elements in fast case is O(n*n).
11145 // Note: revisit design to have dual undefined values to capture absent 11158 // Note: revisit design to have dual undefined values to capture absent
11146 // elements. 11159 // elements.
11147 MaybeObject* JSObject::SetFastElement(uint32_t index, 11160 MaybeObject* JSObject::SetFastElement(uint32_t index,
11148 Object* value, 11161 Object* value,
11149 StrictModeFlag strict_mode, 11162 StrictModeFlag strict_mode,
11150 bool check_prototype) { 11163 bool check_prototype) {
11151 ASSERT(HasFastSmiOrObjectElements() || 11164 ASSERT(HasFastSmiOrObjectElements() ||
11152 HasFastArgumentsElements()); 11165 HasFastArgumentsElements());
11153 11166
11167 // Array optimizations rely on the prototype lookups of Array objects always
11168 // returning undefined. If there is a store to the initial prototype object,
11169 // make sure all of these optimizations are invalidated.
11170 Isolate* isolate(GetIsolate());
11171 if (isolate->is_initial_object_prototype(this) ||
11172 isolate->is_initial_array_prototype(this)) {
11173 HandleScope scope(GetIsolate());
11174 map()->dependent_code()->DeoptimizeDependentCodeGroup(
11175 GetIsolate(),
11176 DependentCode::kElementsCantBeAddedGroup);
11177 }
11178
11154 FixedArray* backing_store = FixedArray::cast(elements()); 11179 FixedArray* backing_store = FixedArray::cast(elements());
11155 if (backing_store->map() == GetHeap()->non_strict_arguments_elements_map()) { 11180 if (backing_store->map() == GetHeap()->non_strict_arguments_elements_map()) {
11156 backing_store = FixedArray::cast(backing_store->get(1)); 11181 backing_store = FixedArray::cast(backing_store->get(1));
11157 } else { 11182 } else {
11158 MaybeObject* maybe = EnsureWritableFastElements(); 11183 MaybeObject* maybe = EnsureWritableFastElements();
11159 if (!maybe->To(&backing_store)) return maybe; 11184 if (!maybe->To(&backing_store)) return maybe;
11160 } 11185 }
11161 uint32_t capacity = static_cast<uint32_t>(backing_store->length()); 11186 uint32_t capacity = static_cast<uint32_t>(backing_store->length());
11162 11187
11163 if (check_prototype && 11188 if (check_prototype &&
(...skipping 4097 matching lines...) Expand 10 before | Expand all | Expand 10 after
15261 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 15286 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
15262 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 15287 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
15263 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 15288 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
15264 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 15289 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
15265 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 15290 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
15266 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 15291 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
15267 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 15292 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
15268 } 15293 }
15269 15294
15270 } } // namespace v8::internal 15295 } } // namespace v8::internal
OLDNEW
« src/isolate.cc ('K') | « src/objects.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698