OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |