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

Side by Side Diff: runtime/vm/stub_code_mips.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) 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 // T2: Allocation size. 700 // T2: Allocation size.
701 701
702 Isolate* isolate = Isolate::Current(); 702 Isolate* isolate = Isolate::Current();
703 Heap* heap = isolate->heap(); 703 Heap* heap = isolate->heap();
704 const intptr_t cid = kArrayCid; 704 const intptr_t cid = kArrayCid;
705 Heap::Space space = heap->SpaceForAllocation(cid); 705 Heap::Space space = heap->SpaceForAllocation(cid);
706 __ LoadImmediate(T3, heap->TopAddress(space)); 706 __ LoadImmediate(T3, heap->TopAddress(space));
707 __ lw(T0, Address(T3, 0)); // Potential new object start. 707 __ lw(T0, Address(T3, 0)); // Potential new object start.
708 708
709 __ AdduDetectOverflow(T1, T0, T2, CMPRES1); // Potential next object start. 709 __ addu(T1, T0, T2); // Potential next object start.
710 __ bltz(CMPRES1, &slow_case); // CMPRES1 < 0 on overflow. 710 __ BranchUnsignedLess(T1, T0, &slow_case); // Branch on unsigned overflow.
711 711
712 // Check if the allocation fits into the remaining space. 712 // Check if the allocation fits into the remaining space.
713 // T0: potential new object start. 713 // T0: potential new object start.
714 // T1: potential next object start. 714 // T1: potential next object start.
715 // T2: allocation size. 715 // T2: allocation size.
716 __ LoadImmediate(T4, heap->EndAddress(space)); 716 __ LoadImmediate(T4, heap->EndAddress(space));
717 __ lw(T4, Address(T4, 0)); 717 __ lw(T4, Address(T4, 0));
718 __ BranchUnsignedGreaterEqual(T1, T4, &slow_case); 718 __ BranchUnsignedGreaterEqual(T1, T4, &slow_case);
719 719
720 // Successfully allocated the object(s), now update top to point to 720 // Successfully allocated the object(s), now update top to point to
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 const Register right = T0; 2251 const Register right = T0;
2252 __ lw(left, Address(SP, 1 * kWordSize)); 2252 __ lw(left, Address(SP, 1 * kWordSize));
2253 __ lw(right, Address(SP, 0 * kWordSize)); 2253 __ lw(right, Address(SP, 0 * kWordSize));
2254 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2254 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2255 __ Ret(); 2255 __ Ret();
2256 } 2256 }
2257 2257
2258 } // namespace dart 2258 } // namespace dart
2259 2259
2260 #endif // defined TARGET_ARCH_MIPS 2260 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« runtime/vm/intrinsifier_arm64.cc ('K') | « runtime/vm/stub_code_arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698