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

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

Issue 11195007: Add value tests to intrinisics GrowableArray _setData and setLength. Thos are private native method… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 return false; 399 return false;
400 } 400 }
401 401
402 402
403 // Set length of growable object array. 403 // Set length of growable object array.
404 // On stack: growable array (+2), length (+1), return-address (+0). 404 // On stack: growable array (+2), length (+1), return-address (+0).
405 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { 405 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) {
406 Label fall_through; 406 Label fall_through;
407 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array. 407 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array.
408 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Length value. 408 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Length value.
409 __ testl(EBX, Immediate(kSmiTagMask));
410 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi length.
409 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); 411 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset()));
410 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); 412 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset()));
411 __ j(ABOVE, &fall_through, Assembler::kNearJump); 413 __ j(ABOVE, &fall_through, Assembler::kNearJump);
412 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), EBX); 414 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), EBX);
413 __ ret(); 415 __ ret();
414 __ Bind(&fall_through); 416 __ Bind(&fall_through);
415 return false; 417 return false;
416 } 418 }
417 419
418 420
419 // Set data of growable object array. 421 // Set data of growable object array.
420 // On stack: growable array (+2), data (+1), return-address (+0). 422 // On stack: growable array (+2), data (+1), return-address (+0).
421 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) { 423 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) {
422 if (FLAG_enable_type_checks) { 424 if (FLAG_enable_type_checks) {
423 return false; 425 return false;
424 } 426 }
425 __ movl(EAX, Address(ESP, + 2 * kWordSize)); 427 Label fall_through;
426 __ movl(EBX, Address(ESP, + 1 * kWordSize)); 428 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Data.
429 // Check that data is an ObjectArray.
430 __ testl(EBX, Immediate(kSmiTagMask));
431 __ j(ZERO, &fall_through, Assembler::kNearJump); // Data is Smi.
432 __ CompareClassId(EBX, kArrayCid, EAX);
433 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
434 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array.
427 __ StoreIntoObject(EAX, 435 __ StoreIntoObject(EAX,
428 FieldAddress(EAX, GrowableObjectArray::data_offset()), 436 FieldAddress(EAX, GrowableObjectArray::data_offset()),
429 EBX); 437 EBX);
430 __ ret(); 438 __ ret();
431 return true; 439 __ Bind(&fall_through);
440 return false;
432 } 441 }
433 442
434 443
435 // Add an element to growable array if it doesn't need to grow, otherwise 444 // Add an element to growable array if it doesn't need to grow, otherwise
436 // call into regular code. 445 // call into regular code.
437 // On stack: growable array (+2), value (+1), return-address (+0). 446 // On stack: growable array (+2), value (+1), return-address (+0).
438 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { 447 bool Intrinsifier::GrowableArray_add(Assembler* assembler) {
439 // In checked mode we need to type-check the incoming argument. 448 // In checked mode we need to type-check the incoming argument.
440 if (FLAG_enable_type_checks) return false; 449 if (FLAG_enable_type_checks) return false;
441 Label fall_through; 450 Label fall_through;
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 __ Bind(&is_true); 1559 __ Bind(&is_true);
1551 __ LoadObject(EAX, bool_true); 1560 __ LoadObject(EAX, bool_true);
1552 __ ret(); 1561 __ ret();
1553 return true; 1562 return true;
1554 } 1563 }
1555 1564
1556 #undef __ 1565 #undef __
1557 } // namespace dart 1566 } // namespace dart
1558 1567
1559 #endif // defined TARGET_ARCH_IA32 1568 #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