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 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 array->set_length(length); | 2960 array->set_length(length); |
2961 Object* value = undefined_value(); | 2961 Object* value = undefined_value(); |
2962 for (int index = 0; index < length; index++) { | 2962 for (int index = 0; index < length; index++) { |
2963 ASSERT(!Heap::InNewSpace(value)); // value = undefined | 2963 ASSERT(!Heap::InNewSpace(value)); // value = undefined |
2964 array->set(index, value, SKIP_WRITE_BARRIER); | 2964 array->set(index, value, SKIP_WRITE_BARRIER); |
2965 } | 2965 } |
2966 return array; | 2966 return array; |
2967 } | 2967 } |
2968 | 2968 |
2969 | 2969 |
| 2970 Object* Heap::AllocateUninitializedFixedArray(int length) { |
| 2971 if (length == 0) return empty_fixed_array(); |
| 2972 |
| 2973 Object* obj = AllocateRawFixedArray(length); |
| 2974 if (obj->IsFailure()) return obj; |
| 2975 |
| 2976 reinterpret_cast<FixedArray*>(obj)->set_map(fixed_array_map()); |
| 2977 FixedArray::cast(obj)->set_length(length); |
| 2978 return obj; |
| 2979 } |
| 2980 |
| 2981 |
2970 Object* Heap::AllocateFixedArrayWithHoles(int length) { | 2982 Object* Heap::AllocateFixedArrayWithHoles(int length) { |
2971 if (length == 0) return empty_fixed_array(); | 2983 if (length == 0) return empty_fixed_array(); |
2972 Object* result = AllocateRawFixedArray(length); | 2984 Object* result = AllocateRawFixedArray(length); |
2973 if (!result->IsFailure()) { | 2985 if (!result->IsFailure()) { |
2974 // Initialize header. | 2986 // Initialize header. |
2975 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); | 2987 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); |
2976 FixedArray* array = FixedArray::cast(result); | 2988 FixedArray* array = FixedArray::cast(result); |
2977 array->set_length(length); | 2989 array->set_length(length); |
2978 // Initialize body. | 2990 // Initialize body. |
2979 ASSERT(!Heap::InNewSpace(the_hole_value())); | 2991 ASSERT(!Heap::InNewSpace(the_hole_value())); |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4226 void ExternalStringTable::TearDown() { | 4238 void ExternalStringTable::TearDown() { |
4227 new_space_strings_.Free(); | 4239 new_space_strings_.Free(); |
4228 old_space_strings_.Free(); | 4240 old_space_strings_.Free(); |
4229 } | 4241 } |
4230 | 4242 |
4231 | 4243 |
4232 List<Object*> ExternalStringTable::new_space_strings_; | 4244 List<Object*> ExternalStringTable::new_space_strings_; |
4233 List<Object*> ExternalStringTable::old_space_strings_; | 4245 List<Object*> ExternalStringTable::old_space_strings_; |
4234 | 4246 |
4235 } } // namespace v8::internal | 4247 } } // namespace v8::internal |
OLD | NEW |