| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 array->set_elements(heap->empty_fixed_array()); | 199 array->set_elements(heap->empty_fixed_array()); |
| 200 if (!FLAG_smi_only_arrays) { | 200 if (!FLAG_smi_only_arrays) { |
| 201 Context* global_context = isolate->context()->global_context(); | 201 Context* global_context = isolate->context()->global_context(); |
| 202 if (array->GetElementsKind() == FAST_SMI_ONLY_ELEMENTS && | 202 if (array->GetElementsKind() == FAST_SMI_ONLY_ELEMENTS && |
| 203 !global_context->object_js_array_map()->IsUndefined()) { | 203 !global_context->object_js_array_map()->IsUndefined()) { |
| 204 array->set_map(Map::cast(global_context->object_js_array_map())); | 204 array->set_map(Map::cast(global_context->object_js_array_map())); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } else { | 207 } else { |
| 208 // Allocate the JS Array | 208 // Allocate the JS Array |
| 209 MaybeObject* maybe_obj = | 209 MaybeObject* maybe_obj = heap->AllocateJSObject(constructor); |
| 210 heap->AllocateEmptyJSArray(FAST_SMI_ONLY_ELEMENTS); | |
| 211 if (!maybe_obj->To(&array)) return maybe_obj; | 210 if (!maybe_obj->To(&array)) return maybe_obj; |
| 212 } | 211 } |
| 213 | 212 |
| 214 // Optimize the case where there is one argument and the argument is a | 213 // Optimize the case where there is one argument and the argument is a |
| 215 // small smi. | 214 // small smi. |
| 216 if (args->length() == 2) { | 215 if (args->length() == 2) { |
| 217 Object* obj = (*args)[1]; | 216 Object* obj = (*args)[1]; |
| 218 if (obj->IsSmi()) { | 217 if (obj->IsSmi()) { |
| 219 int len = Smi::cast(obj)->value(); | 218 int len = Smi::cast(obj)->value(); |
| 220 if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) { | 219 if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) { |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 return Handle<Code>(code_address); \ | 1756 return Handle<Code>(code_address); \ |
| 1758 } | 1757 } |
| 1759 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1758 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1760 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1759 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1761 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1760 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1762 #undef DEFINE_BUILTIN_ACCESSOR_C | 1761 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1763 #undef DEFINE_BUILTIN_ACCESSOR_A | 1762 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1764 | 1763 |
| 1765 | 1764 |
| 1766 } } // namespace v8::internal | 1765 } } // namespace v8::internal |
| OLD | NEW |