OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return array; | 165 return array; |
166 } | 166 } |
167 } | 167 } |
168 // Take the argument as the length. | 168 // Take the argument as the length. |
169 obj = array->Initialize(0); | 169 obj = array->Initialize(0); |
170 if (obj->IsFailure()) return obj; | 170 if (obj->IsFailure()) return obj; |
171 return array->SetElementsLength(args[1]); | 171 return array->SetElementsLength(args[1]); |
172 } | 172 } |
173 | 173 |
174 // Optimize the case where there are no parameters passed. | 174 // Optimize the case where there are no parameters passed. |
175 if (args.length() == 1) return array->Initialize(4); | 175 if (args.length() == 1) { |
| 176 return array->Initialize(JSArray::kPreallocatedArrayElements); |
| 177 } |
176 | 178 |
177 // Take the arguments as elements. | 179 // Take the arguments as elements. |
178 int number_of_elements = args.length() - 1; | 180 int number_of_elements = args.length() - 1; |
179 Smi* len = Smi::FromInt(number_of_elements); | 181 Smi* len = Smi::FromInt(number_of_elements); |
180 Object* obj = Heap::AllocateFixedArrayWithHoles(len->value()); | 182 Object* obj = Heap::AllocateFixedArrayWithHoles(len->value()); |
181 if (obj->IsFailure()) return obj; | 183 if (obj->IsFailure()) return obj; |
182 FixedArray* elms = FixedArray::cast(obj); | 184 FixedArray* elms = FixedArray::cast(obj); |
183 WriteBarrierMode mode = elms->GetWriteBarrierMode(); | 185 WriteBarrierMode mode = elms->GetWriteBarrierMode(); |
184 // Fill in the content | 186 // Fill in the content |
185 for (int index = 0; index < number_of_elements; index++) { | 187 for (int index = 0; index < number_of_elements; index++) { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 if (entry->contains(pc)) { | 755 if (entry->contains(pc)) { |
754 return names_[i]; | 756 return names_[i]; |
755 } | 757 } |
756 } | 758 } |
757 } | 759 } |
758 return NULL; | 760 return NULL; |
759 } | 761 } |
760 | 762 |
761 | 763 |
762 } } // namespace v8::internal | 764 } } // namespace v8::internal |
OLD | NEW |