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

Side by Side Diff: src/objects-inl.h

Issue 9051014: Reland 10309: Ensure large Smi-only arrays don't transition to FAST_DOUBLE_ARRAY (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version Created 8 years, 11 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.cc ('k') | test/mjsunit/regress/regress-1849.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 // are filler pointers in the array. 1212 // are filler pointers in the array.
1213 FixedArray* fixed_array = 1213 FixedArray* fixed_array =
1214 reinterpret_cast<FixedArray*>(READ_FIELD(this, kElementsOffset)); 1214 reinterpret_cast<FixedArray*>(READ_FIELD(this, kElementsOffset));
1215 Map* map = fixed_array->map(); 1215 Map* map = fixed_array->map();
1216 // Arrays that have been shifted in place can't be verified. 1216 // Arrays that have been shifted in place can't be verified.
1217 if (map != heap->raw_unchecked_one_pointer_filler_map() && 1217 if (map != heap->raw_unchecked_one_pointer_filler_map() &&
1218 map != heap->raw_unchecked_two_pointer_filler_map() && 1218 map != heap->raw_unchecked_two_pointer_filler_map() &&
1219 map != heap->free_space_map()) { 1219 map != heap->free_space_map()) {
1220 for (int i = 0; i < fixed_array->length(); i++) { 1220 for (int i = 0; i < fixed_array->length(); i++) {
1221 Object* current = fixed_array->get(i); 1221 Object* current = fixed_array->get(i);
1222 ASSERT(current->IsSmi() || current == heap->the_hole_value()); 1222 ASSERT(current->IsSmi() || current->IsTheHole());
1223 } 1223 }
1224 } 1224 }
1225 } 1225 }
1226 #endif 1226 #endif
1227 } 1227 }
1228 1228
1229 1229
1230 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { 1230 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() {
1231 #if DEBUG 1231 #if DEBUG
1232 ValidateSmiOnlyElements(); 1232 ValidateSmiOnlyElements();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1283
1284 ASSERT(mode == ALLOW_COPIED_DOUBLE_ELEMENTS); 1284 ASSERT(mode == ALLOW_COPIED_DOUBLE_ELEMENTS);
1285 if (GetElementsKind() == FAST_SMI_ONLY_ELEMENTS) { 1285 if (GetElementsKind() == FAST_SMI_ONLY_ELEMENTS) {
1286 return TransitionElementsKind(FAST_DOUBLE_ELEMENTS); 1286 return TransitionElementsKind(FAST_DOUBLE_ELEMENTS);
1287 } 1287 }
1288 1288
1289 return this; 1289 return this;
1290 } 1290 }
1291 1291
1292 1292
1293 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { 1293 void JSObject::set_map_and_elements(Map* new_map,
1294 FixedArrayBase* value,
1295 WriteBarrierMode mode) {
1296 ASSERT(value->HasValidElements());
1297 #ifdef DEBUG
1298 ValidateSmiOnlyElements();
1299 #endif
1300 if (new_map != NULL) {
1301 if (mode == UPDATE_WRITE_BARRIER) {
1302 set_map(new_map);
1303 } else {
1304 ASSERT(mode == SKIP_WRITE_BARRIER);
1305 set_map_no_write_barrier(new_map);
1306 }
1307 }
1294 ASSERT((map()->has_fast_elements() || 1308 ASSERT((map()->has_fast_elements() ||
1295 map()->has_fast_smi_only_elements()) == 1309 map()->has_fast_smi_only_elements()) ==
1296 (value->map() == GetHeap()->fixed_array_map() || 1310 (value->map() == GetHeap()->fixed_array_map() ||
1297 value->map() == GetHeap()->fixed_cow_array_map())); 1311 value->map() == GetHeap()->fixed_cow_array_map()));
1298 ASSERT(map()->has_fast_double_elements() == 1312 ASSERT(map()->has_fast_double_elements() ==
1299 value->IsFixedDoubleArray()); 1313 value->IsFixedDoubleArray());
1300 ASSERT(value->HasValidElements());
1301 #ifdef DEBUG
1302 ValidateSmiOnlyElements();
1303 #endif
1304 WRITE_FIELD(this, kElementsOffset, value); 1314 WRITE_FIELD(this, kElementsOffset, value);
1305 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); 1315 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode);
1306 } 1316 }
1307 1317
1308 1318
1319 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
1320 set_map_and_elements(NULL, value, mode);
1321 }
1322
1323
1309 void JSObject::initialize_properties() { 1324 void JSObject::initialize_properties() {
1310 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); 1325 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1311 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); 1326 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
1312 } 1327 }
1313 1328
1314 1329
1315 void JSObject::initialize_elements() { 1330 void JSObject::initialize_elements() {
1316 ASSERT(map()->has_fast_elements() || map()->has_fast_smi_only_elements()); 1331 ASSERT(map()->has_fast_elements() || map()->has_fast_smi_only_elements());
1317 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); 1332 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1318 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array()); 1333 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array());
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 #undef WRITE_INT_FIELD 4766 #undef WRITE_INT_FIELD
4752 #undef READ_SHORT_FIELD 4767 #undef READ_SHORT_FIELD
4753 #undef WRITE_SHORT_FIELD 4768 #undef WRITE_SHORT_FIELD
4754 #undef READ_BYTE_FIELD 4769 #undef READ_BYTE_FIELD
4755 #undef WRITE_BYTE_FIELD 4770 #undef WRITE_BYTE_FIELD
4756 4771
4757 4772
4758 } } // namespace v8::internal 4773 } } // namespace v8::internal
4759 4774
4760 #endif // V8_OBJECTS_INL_H_ 4775 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-1849.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698