Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 285543002: Recognize List constructor and turn it into CreateArray ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // Compute the size to be allocated, it is based on the array length 613 // Compute the size to be allocated, it is based on the array length
614 // and is computed as: 614 // and is computed as:
615 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 615 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
616 // Assert that length is a Smi. 616 // Assert that length is a Smi.
617 __ testl(EDX, Immediate(kSmiTagMask)); 617 __ testl(EDX, Immediate(kSmiTagMask));
618 if (FLAG_use_slow_path) { 618 if (FLAG_use_slow_path) {
619 __ jmp(&slow_case); 619 __ jmp(&slow_case);
620 } else { 620 } else {
621 __ j(NOT_ZERO, &slow_case); 621 __ j(NOT_ZERO, &slow_case);
622 } 622 }
623 __ cmpl(EDX, Immediate(0));
624 __ j(LESS, &slow_case);
625
626 // Check for maximum allowed length.
627 const Immediate& max_len =
628 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)));
629 __ cmpl(EDX, max_len);
630 __ j(GREATER, &slow_case);
631
623 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); 632 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
624 __ movl(EDI, Address(EDI, Isolate::heap_offset())); 633 __ movl(EDI, Address(EDI, Isolate::heap_offset()));
625 __ movl(EDI, Address(EDI, Heap::new_space_offset())); 634 __ movl(EDI, Address(EDI, Heap::new_space_offset()));
626 635
627 // Calculate and align allocation size. 636 // Calculate and align allocation size.
628 // Load new object start and calculate next object start. 637 // Load new object start and calculate next object start.
629 // ECX: array element type. 638 // ECX: array element type.
630 // EDX: Array length as Smi. 639 // EDX: Array length as Smi.
631 // EDI: Points to new space object. 640 // EDI: Points to new space object.
632 __ movl(EAX, Address(EDI, Scavenger::top_offset())); 641 __ movl(EAX, Address(EDI, Scavenger::top_offset()));
633 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 642 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
634 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi. 643 __ leal(EBX, Address(EDX, TIMES_2, fixed_size)); // EDX is Smi.
635 ASSERT(kSmiTagShift == 1); 644 ASSERT(kSmiTagShift == 1);
636 __ andl(EBX, Immediate(-kObjectAlignment)); 645 __ andl(EBX, Immediate(-kObjectAlignment));
637 __ leal(EBX, Address(EAX, EBX, TIMES_1, 0)); 646
647 // Check for overflow.
648 __ addl(EBX, EAX);
649 __ j(CARRY, &slow_case);
638 650
639 // Check if the allocation fits into the remaining space. 651 // Check if the allocation fits into the remaining space.
640 // EAX: potential new object start. 652 // EAX: potential new object start.
641 // EBX: potential next object start. 653 // EBX: potential next object start.
642 // ECX: array element type. 654 // ECX: array element type.
643 // EDX: Array length as Smi. 655 // EDX: Array length as Smi.
644 // EDI: Points to new space object. 656 // EDI: Points to new space object.
645 __ cmpl(EBX, Address(EDI, Scavenger::end_offset())); 657 __ cmpl(EBX, Address(EDI, Scavenger::end_offset()));
646 __ j(ABOVE_EQUAL, &slow_case); 658 __ j(ABOVE_EQUAL, &slow_case);
647 659
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 const Register temp = ECX; 1925 const Register temp = ECX;
1914 __ movl(left, Address(ESP, 2 * kWordSize)); 1926 __ movl(left, Address(ESP, 2 * kWordSize));
1915 __ movl(right, Address(ESP, 1 * kWordSize)); 1927 __ movl(right, Address(ESP, 1 * kWordSize));
1916 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1928 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1917 __ ret(); 1929 __ ret();
1918 } 1930 }
1919 1931
1920 } // namespace dart 1932 } // namespace dart
1921 1933
1922 #endif // defined TARGET_ARCH_IA32 1934 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698