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

Side by Side Diff: src/heap.cc

Issue 661105: Faster filling of arrays of holes. (Closed)
Patch Set: Addressing comments Created 10 years, 9 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
« no previous file with comments | « no previous file | src/utils.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 2971
2972 Object* Heap::AllocateFixedArrayWithHoles(int length) { 2972 Object* Heap::AllocateFixedArrayWithHoles(int length) {
2973 if (length == 0) return empty_fixed_array(); 2973 if (length == 0) return empty_fixed_array();
2974 Object* result = AllocateRawFixedArray(length); 2974 Object* result = AllocateRawFixedArray(length);
2975 if (!result->IsFailure()) { 2975 if (!result->IsFailure()) {
2976 // Initialize header. 2976 // Initialize header.
2977 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); 2977 reinterpret_cast<Array*>(result)->set_map(fixed_array_map());
2978 FixedArray* array = FixedArray::cast(result); 2978 FixedArray* array = FixedArray::cast(result);
2979 array->set_length(length); 2979 array->set_length(length);
2980 // Initialize body. 2980 // Initialize body.
2981 Object* value = the_hole_value(); 2981 ASSERT(!Heap::InNewSpace(the_hole_value()));
2982 for (int index = 0; index < length; index++) { 2982 MemsetPointer(HeapObject::RawField(array, FixedArray::kHeaderSize),
2983 ASSERT(!Heap::InNewSpace(value)); // value = the hole 2983 the_hole_value(),
2984 array->set(index, value, SKIP_WRITE_BARRIER); 2984 length);
2985 }
2986 } 2985 }
2987 return result; 2986 return result;
2988 } 2987 }
2989 2988
2990 2989
2991 Object* Heap::AllocateHashTable(int length) { 2990 Object* Heap::AllocateHashTable(int length) {
2992 Object* result = Heap::AllocateFixedArray(length); 2991 Object* result = Heap::AllocateFixedArray(length);
2993 if (result->IsFailure()) return result; 2992 if (result->IsFailure()) return result;
2994 reinterpret_cast<Array*>(result)->set_map(hash_table_map()); 2993 reinterpret_cast<Array*>(result)->set_map(hash_table_map());
2995 ASSERT(result->IsHashTable()); 2994 ASSERT(result->IsHashTable());
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 void ExternalStringTable::TearDown() { 4218 void ExternalStringTable::TearDown() {
4220 new_space_strings_.Free(); 4219 new_space_strings_.Free();
4221 old_space_strings_.Free(); 4220 old_space_strings_.Free();
4222 } 4221 }
4223 4222
4224 4223
4225 List<Object*> ExternalStringTable::new_space_strings_; 4224 List<Object*> ExternalStringTable::new_space_strings_;
4226 List<Object*> ExternalStringTable::old_space_strings_; 4225 List<Object*> ExternalStringTable::old_space_strings_;
4227 4226
4228 } } // namespace v8::internal 4227 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698