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

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

Issue 1096063002: Fix array allocation overflow check on arm/arm64/mips. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 // Load new object start and calculate next object start. 652 // Load new object start and calculate next object start.
653 // R1: array element type. 653 // R1: array element type.
654 // R2: array length as Smi. 654 // R2: array length as Smi.
655 // R8: points to new space object. 655 // R8: points to new space object.
656 __ LoadFromOffset(R0, R8, top_offset, kNoPP); 656 __ LoadFromOffset(R0, R8, top_offset, kNoPP);
657 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 657 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
658 __ LoadImmediate(R3, fixed_size, kNoPP); 658 __ LoadImmediate(R3, fixed_size, kNoPP);
659 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. 659 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi.
660 ASSERT(kSmiTagShift == 1); 660 ASSERT(kSmiTagShift == 1);
661 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1))); 661 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1)));
662 // R0: potential new object start.
663 // R3: object size in bytes.
662 __ adds(R7, R3, Operand(R0)); 664 __ adds(R7, R3, Operand(R0));
663 __ b(&slow_case, VS); 665 __ b(&slow_case, CS); // Branch if unsigned overflow.
664 666
665 // Check if the allocation fits into the remaining space. 667 // Check if the allocation fits into the remaining space.
666 // R0: potential new object start. 668 // R0: potential new object start.
667 // R1: array element type. 669 // R1: array element type.
668 // R2: array length as Smi. 670 // R2: array length as Smi.
669 // R3: array size. 671 // R3: array size.
670 // R7: potential next object start. 672 // R7: potential next object start.
671 // R8: points to new space object. 673 // R8: points to new space object.
672 __ LoadFromOffset(TMP, R8, end_offset, kNoPP); 674 __ LoadFromOffset(TMP, R8, end_offset, kNoPP);
673 __ CompareRegisters(R7, TMP); 675 __ CompareRegisters(R7, TMP);
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 const Register right = R0; 2104 const Register right = R0;
2103 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2105 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2104 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2106 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
2105 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2106 __ ret(); 2108 __ ret();
2107 } 2109 }
2108 2110
2109 } // namespace dart 2111 } // namespace dart
2110 2112
2111 #endif // defined TARGET_ARCH_ARM64 2113 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698