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

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

Issue 8996024: Fix a bug in intrinsified Array_setIndexed type check. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 static bool Array_setIndexed(Assembler* assembler) { 192 static bool Array_setIndexed(Assembler* assembler) {
193 if (FLAG_enable_type_checks) { 193 if (FLAG_enable_type_checks) {
194 return false; 194 return false;
195 } 195 }
196 const Immediate raw_null = 196 const Immediate raw_null =
197 Immediate(reinterpret_cast<intptr_t>(Object::null())); 197 Immediate(reinterpret_cast<intptr_t>(Object::null()));
198 Label fall_through; 198 Label fall_through;
199 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value. 199 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value.
200 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index. 200 __ movl(EBX, Address(ESP, + 2 * kWordSize)); // Index.
201 __ orl(EAX, EBX); 201 __ orl(EAX, EBX);
202 __ testl(EBX, Immediate(kSmiTagMask)); 202 __ testl(EAX, Immediate(kSmiTagMask));
siva 2011/12/20 01:38:00 Is there a unit test which exposes this bug and va
srdjan 2011/12/20 02:06:33 It is difficult to test, since the only thing it d
203 // Value or index not Smi. 203 // Value or index not Smi.
204 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 204 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
205 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array. 205 __ movl(EAX, Address(ESP, + 3 * kWordSize)); // Array.
206 // Range check. 206 // Range check.
207 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset())); 207 __ cmpl(EBX, FieldAddress(EAX, Array::length_offset()));
208 // Runtime throws exception. 208 // Runtime throws exception.
209 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 209 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
210 // Note that EBX is Smi, i.e, times 2. 210 // Note that EBX is Smi, i.e, times 2.
211 ASSERT(kSmiTagShift == 1); 211 ASSERT(kSmiTagShift == 1);
212 // Destroy ECX as we will not continue in the function. 212 // Destroy ECX as we will not continue in the function.
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } \ 1007 } \
1008 1008
1009 INTRINSIC_LIST(FIND_INTRINSICS); 1009 INTRINSIC_LIST(FIND_INTRINSICS);
1010 #undef FIND_INTRINSICS 1010 #undef FIND_INTRINSICS
1011 return false; 1011 return false;
1012 } 1012 }
1013 1013
1014 } // namespace dart 1014 } // namespace dart
1015 1015
1016 #endif // defined TARGET_ARCH_IA32 1016 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/opt_code_generator_ia32.h » ('j') | runtime/vm/opt_code_generator_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698