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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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, 4 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 | « no previous file | runtime/vm/intrinsifier_x64.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) 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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 // Compute the size to be allocated, it is based on the array length 39 // Compute the size to be allocated, it is based on the array length
40 // and is computed as: 40 // and is computed as:
41 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 41 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
42 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. 42 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length.
43 // Assert that length is a Smi. 43 // Assert that length is a Smi.
44 __ testl(EDI, Immediate(kSmiTagSize)); 44 __ testl(EDI, Immediate(kSmiTagSize));
45 __ j(NOT_ZERO, &fall_through); 45 __ j(NOT_ZERO, &fall_through);
46 __ cmpl(EDI, Immediate(0)); 46 __ cmpl(EDI, Immediate(0));
47 __ j(LESS, &fall_through); 47 __ j(LESS, &fall_through);
48 // Check for maximum allowed length.
49 const Immediate max_len =
50 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)));
51 __ cmpl(EDI, max_len);
52 __ j(GREATER, &fall_through);
48 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 53 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
49 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. 54 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi.
50 ASSERT(kSmiTagShift == 1); 55 ASSERT(kSmiTagShift == 1);
51 __ andl(EDI, Immediate(-kObjectAlignment)); 56 __ andl(EDI, Immediate(-kObjectAlignment));
52 57
53 Isolate* isolate = Isolate::Current(); 58 Isolate* isolate = Isolate::Current();
54 Heap* heap = isolate->heap(); 59 Heap* heap = isolate->heap();
55 60
56 // EDI: allocation size. 61 // EDI: allocation size.
57 __ movl(EAX, Address::Absolute(heap->TopAddress())); 62 __ movl(EAX, Address::Absolute(heap->TopAddress()));
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 __ Bind(&is_true); 1406 __ Bind(&is_true);
1402 __ LoadObject(EAX, bool_true); 1407 __ LoadObject(EAX, bool_true);
1403 __ ret(); 1408 __ ret();
1404 return true; 1409 return true;
1405 } 1410 }
1406 1411
1407 #undef __ 1412 #undef __
1408 } // namespace dart 1413 } // namespace dart
1409 1414
1410 #endif // defined TARGET_ARCH_IA32 1415 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698