| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 int elements_size = 0; | 333 int elements_size = 0; |
| 334 if (length > 0) { | 334 if (length > 0) { |
| 335 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 335 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 336 ? FixedDoubleArray::SizeFor(length) | 336 ? FixedDoubleArray::SizeFor(length) |
| 337 : FixedArray::SizeFor(length); | 337 : FixedArray::SizeFor(length); |
| 338 } | 338 } |
| 339 int size = JSArray::kSize + elements_size; | 339 int size = JSArray::kSize + elements_size; |
| 340 | 340 |
| 341 // Allocate both the JS array and the elements array in one big | 341 // Allocate both the JS array and the elements array in one big |
| 342 // allocation. This avoids multiple limit checks. | 342 // allocation. This avoids multiple limit checks. |
| 343 __ AllocateInNewSpace(size, eax, ebx, edx, fail, TAG_OBJECT); | 343 AllocationFlags flags = TAG_OBJECT; |
| 344 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
| 345 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
| 346 } |
| 347 __ AllocateInNewSpace(size, eax, ebx, edx, fail, flags); |
| 344 | 348 |
| 345 // Copy the JS array part. | 349 // Copy the JS array part. |
| 346 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 350 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
| 347 if ((i != JSArray::kElementsOffset) || (length == 0)) { | 351 if ((i != JSArray::kElementsOffset) || (length == 0)) { |
| 348 __ mov(ebx, FieldOperand(ecx, i)); | 352 __ mov(ebx, FieldOperand(ecx, i)); |
| 349 __ mov(FieldOperand(eax, i), ebx); | 353 __ mov(FieldOperand(eax, i), ebx); |
| 350 } | 354 } |
| 351 } | 355 } |
| 352 | 356 |
| 353 if (length > 0) { | 357 if (length > 0) { |
| (...skipping 3718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 __ JumpIfNotSmi(ebx, &slowcase); | 4076 __ JumpIfNotSmi(ebx, &slowcase); |
| 4073 __ cmp(ebx, Immediate(Smi::FromInt(kMaxInlineLength))); | 4077 __ cmp(ebx, Immediate(Smi::FromInt(kMaxInlineLength))); |
| 4074 __ j(above, &slowcase); | 4078 __ j(above, &slowcase); |
| 4075 // Smi-tagging is equivalent to multiplying by 2. | 4079 // Smi-tagging is equivalent to multiplying by 2. |
| 4076 STATIC_ASSERT(kSmiTag == 0); | 4080 STATIC_ASSERT(kSmiTag == 0); |
| 4077 STATIC_ASSERT(kSmiTagSize == 1); | 4081 STATIC_ASSERT(kSmiTagSize == 1); |
| 4078 // Allocate RegExpResult followed by FixedArray with size in ebx. | 4082 // Allocate RegExpResult followed by FixedArray with size in ebx. |
| 4079 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | 4083 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] |
| 4080 // Elements: [Map][Length][..elements..] | 4084 // Elements: [Map][Length][..elements..] |
| 4081 __ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize, | 4085 __ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize, |
| 4082 times_half_pointer_size, | 4086 times_pointer_size, |
| 4083 ebx, // In: Number of elements (times 2, being a smi) | 4087 ebx, // In: Number of elements as a smi |
| 4088 REGISTER_VALUE_IS_SMI, |
| 4084 eax, // Out: Start of allocation (tagged). | 4089 eax, // Out: Start of allocation (tagged). |
| 4085 ecx, // Out: End of allocation. | 4090 ecx, // Out: End of allocation. |
| 4086 edx, // Scratch register | 4091 edx, // Scratch register |
| 4087 &slowcase, | 4092 &slowcase, |
| 4088 TAG_OBJECT); | 4093 TAG_OBJECT); |
| 4089 // eax: Start of allocated area, object-tagged. | 4094 // eax: Start of allocated area, object-tagged. |
| 4090 | 4095 |
| 4091 // Set JSArray map to global.regexp_result_map(). | 4096 // Set JSArray map to global.regexp_result_map(). |
| 4092 // Set empty properties FixedArray. | 4097 // Set empty properties FixedArray. |
| 4093 // Set elements to point to FixedArray allocated right after the JSArray. | 4098 // Set elements to point to FixedArray allocated right after the JSArray. |
| (...skipping 3376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7470 // Restore ecx. | 7475 // Restore ecx. |
| 7471 __ pop(ecx); | 7476 __ pop(ecx); |
| 7472 __ ret(0); | 7477 __ ret(0); |
| 7473 } | 7478 } |
| 7474 | 7479 |
| 7475 #undef __ | 7480 #undef __ |
| 7476 | 7481 |
| 7477 } } // namespace v8::internal | 7482 } } // namespace v8::internal |
| 7478 | 7483 |
| 7479 #endif // V8_TARGET_ARCH_IA32 | 7484 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |