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

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

Issue 10874061: Fix intrinsified allocation of arrays which cuased crash on ia32: do not allow allocation of arrays… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/intrinsifier_ia32.cc ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // Compute the size to be allocated, it is based on the array length 38 // Compute the size to be allocated, it is based on the array length
39 // and is computed as: 39 // and is computed as:
40 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 40 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
41 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length. 41 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length.
42 // Assert that length is a Smi. 42 // Assert that length is a Smi.
43 __ testq(RDI, Immediate(kSmiTagSize)); 43 __ testq(RDI, Immediate(kSmiTagSize));
44 __ j(NOT_ZERO, &fall_through); 44 __ j(NOT_ZERO, &fall_through);
45 __ cmpq(RDI, Immediate(0)); 45 __ cmpq(RDI, Immediate(0));
46 __ j(LESS, &fall_through); 46 __ j(LESS, &fall_through);
47 // Check for maximum allowed length.
48 const Immediate max_len =
49 Immediate(reinterpret_cast<int64_t>(Smi::New(Array::kMaxElements)));
50 __ cmpq(RDI, max_len);
51 __ j(GREATER, &fall_through);
47 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 52 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
48 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi. 53 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi.
49 ASSERT(kSmiTagShift == 1); 54 ASSERT(kSmiTagShift == 1);
50 __ andq(RDI, Immediate(-kObjectAlignment)); 55 __ andq(RDI, Immediate(-kObjectAlignment));
51 56
52 Isolate* isolate = Isolate::Current(); 57 Isolate* isolate = Isolate::Current();
53 Heap* heap = isolate->heap(); 58 Heap* heap = isolate->heap();
54 59
55 // RDI: allocation size. 60 // RDI: allocation size.
56 __ movq(RAX, Immediate(heap->TopAddress())); 61 __ movq(RAX, Immediate(heap->TopAddress()));
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 __ LoadObject(RAX, bool_true); 1361 __ LoadObject(RAX, bool_true);
1357 __ ret(); 1362 __ ret();
1358 return true; 1363 return true;
1359 } 1364 }
1360 1365
1361 #undef __ 1366 #undef __
1362 1367
1363 } // namespace dart 1368 } // namespace dart
1364 1369
1365 #endif // defined TARGET_ARCH_X64 1370 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698