| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } else { | 188 } else { |
| 189 // Allocate the JS Array | 189 // Allocate the JS Array |
| 190 JSFunction* constructor = | 190 JSFunction* constructor = |
| 191 Top::context()->global_context()->array_function(); | 191 Top::context()->global_context()->array_function(); |
| 192 Object* obj = Heap::AllocateJSObject(constructor); | 192 Object* obj = Heap::AllocateJSObject(constructor); |
| 193 if (obj->IsFailure()) return obj; | 193 if (obj->IsFailure()) return obj; |
| 194 array = JSArray::cast(obj); | 194 array = JSArray::cast(obj); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // 'array' now contains the JSArray we should initialize. | 197 // 'array' now contains the JSArray we should initialize. |
| 198 ASSERT(array->HasFastElements()); |
| 198 | 199 |
| 199 // Optimize the case where there is one argument and the argument is a | 200 // Optimize the case where there is one argument and the argument is a |
| 200 // small smi. | 201 // small smi. |
| 201 if (args.length() == 2) { | 202 if (args.length() == 2) { |
| 202 Object* obj = args[1]; | 203 Object* obj = args[1]; |
| 203 if (obj->IsSmi()) { | 204 if (obj->IsSmi()) { |
| 204 int len = Smi::cast(obj)->value(); | 205 int len = Smi::cast(obj)->value(); |
| 205 if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) { | 206 if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) { |
| 206 Object* obj = Heap::AllocateFixedArrayWithHoles(len); | 207 Object* obj = Heap::AllocateFixedArrayWithHoles(len); |
| 207 if (obj->IsFailure()) return obj; | 208 if (obj->IsFailure()) return obj; |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 if (entry->contains(pc)) { | 1515 if (entry->contains(pc)) { |
| 1515 return names_[i]; | 1516 return names_[i]; |
| 1516 } | 1517 } |
| 1517 } | 1518 } |
| 1518 } | 1519 } |
| 1519 return NULL; | 1520 return NULL; |
| 1520 } | 1521 } |
| 1521 | 1522 |
| 1522 | 1523 |
| 1523 } } // namespace v8::internal | 1524 } } // namespace v8::internal |
| OLD | NEW |