OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 6644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6655 __ TailCallRuntime(ExternalReference(Runtime::kNewContext), 1, 1); | 6655 __ TailCallRuntime(ExternalReference(Runtime::kNewContext), 1, 1); |
6656 } | 6656 } |
6657 | 6657 |
6658 | 6658 |
6659 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { | 6659 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
6660 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; | 6660 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; |
6661 int size = JSArray::kSize + elements_size; | 6661 int size = JSArray::kSize + elements_size; |
6662 | 6662 |
6663 // Load boilerplate object into ecx and check if we need to create a | 6663 // Load boilerplate object into ecx and check if we need to create a |
6664 // boilerplate. | 6664 // boilerplate. |
| 6665 Label slow_case; |
6665 __ mov(ecx, Operand(esp, 3 * kPointerSize)); | 6666 __ mov(ecx, Operand(esp, 3 * kPointerSize)); |
6666 __ mov(eax, Operand(esp, 2 * kPointerSize)); | 6667 __ mov(eax, Operand(esp, 2 * kPointerSize)); |
6667 ASSERT(kPointerSize == 4); | 6668 ASSERT((kPointerSize == 4) && (kSmiTagSize == 1) && (kSmiTag == 0)); |
6668 __ mov(ecx, FieldOperand(ecx, | 6669 __ mov(ecx, FieldOperand(ecx, eax, times_2, FixedArray::kHeaderSize)); |
6669 eax, | |
6670 times_2, | |
6671 FixedArray::kHeaderSize)); | |
6672 __ cmp(ecx, Factory::undefined_value()); | 6670 __ cmp(ecx, Factory::undefined_value()); |
6673 Label slow_case; | |
6674 __ j(equal, &slow_case); | 6671 __ j(equal, &slow_case); |
6675 | 6672 |
6676 | |
6677 // Allocate both the JS array and the elements array in one big | 6673 // Allocate both the JS array and the elements array in one big |
6678 // allocation. This avoids multiple limit checks. | 6674 // allocation. This avoids multiple limit checks. |
6679 __ AllocateInNewSpace(size, eax, ebx, edx, &slow_case, TAG_OBJECT); | 6675 __ AllocateInNewSpace(size, eax, ebx, edx, &slow_case, TAG_OBJECT); |
6680 | 6676 |
6681 // Copy the JS array part. | 6677 // Copy the JS array part. |
6682 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 6678 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
6683 if ((i != JSArray::kElementsOffset) || (length_ == 0)) { | 6679 if ((i != JSArray::kElementsOffset) || (length_ == 0)) { |
6684 __ mov(ebx, FieldOperand(ecx, i)); | 6680 __ mov(ebx, FieldOperand(ecx, i)); |
6685 __ mov(FieldOperand(eax, i), ebx); | 6681 __ mov(FieldOperand(eax, i), ebx); |
6686 } | 6682 } |
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8904 __ add(Operand(dest), Immediate(2)); | 8900 __ add(Operand(dest), Immediate(2)); |
8905 } | 8901 } |
8906 __ sub(Operand(count), Immediate(1)); | 8902 __ sub(Operand(count), Immediate(1)); |
8907 __ j(not_zero, &loop); | 8903 __ j(not_zero, &loop); |
8908 } | 8904 } |
8909 | 8905 |
8910 | 8906 |
8911 #undef __ | 8907 #undef __ |
8912 | 8908 |
8913 } } // namespace v8::internal | 8909 } } // namespace v8::internal |
OLD | NEW |