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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
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 // 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 408
409 // Gets the length of a TypedData. 409 // Gets the length of a TypedData.
410 void Intrinsifier::TypedDataLength(Assembler* assembler) { 410 void Intrinsifier::TypedDataLength(Assembler* assembler) {
411 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 411 __ movl(EAX, Address(ESP, + 1 * kWordSize));
412 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); 412 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset()));
413 __ ret(); 413 __ ret();
414 } 414 }
415 415
416 416
417 void Intrinsifier::Uint8ArrayGetIndexed(Assembler* assembler) {
418 Label fall_through;
419 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
420 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
421 __ testl(EBX, Immediate(kSmiTagMask));
422 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
423 // Range check.
424 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
425 // Runtime throws exception.
426 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
427
428 __ SmiUntag(EBX);
429 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, TypedData::data_offset()));
430 __ SmiTag(EAX);
431 __ ret();
432 __ Bind(&fall_through);
433 }
434
435
436 void Intrinsifier::ExternalUint8ArrayGetIndexed(Assembler* assembler) {
437 Label fall_through;
438 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
439 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
440 __ testl(EBX, Immediate(kSmiTagMask));
441 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
442 // Range check.
443 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
444 // Runtime throws exception.
445 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
446
447 __ movl(EAX, FieldAddress(EAX, ExternalTypedData::data_offset()));
448 __ SmiUntag(EBX);
449 __ movzxb(EAX, Address(EAX, EBX, TIMES_1, 0));
450 __ SmiTag(EAX);
451 __ ret();
452 __ Bind(&fall_through);
453 }
454
455
456 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { 417 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) {
457 Label fall_through; 418 Label fall_through;
458 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. 419 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
459 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. 420 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array.
460 __ testl(EBX, Immediate(kSmiTagMask)); 421 __ testl(EBX, Immediate(kSmiTagMask));
461 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. 422 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
462 // Range check. 423 // Range check.
463 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset())); 424 __ cmpl(EBX, FieldAddress(EAX, TypedData::length_offset()));
464 // Runtime throws exception. 425 // Runtime throws exception.
465 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 426 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 Isolate::current_tag_offset()); 1751 Isolate::current_tag_offset());
1791 // Set return value to Isolate::current_tag_. 1752 // Set return value to Isolate::current_tag_.
1792 __ movl(EAX, current_tag_addr); 1753 __ movl(EAX, current_tag_addr);
1793 __ ret(); 1754 __ ret();
1794 } 1755 }
1795 1756
1796 #undef __ 1757 #undef __
1797 } // namespace dart 1758 } // namespace dart
1798 1759
1799 #endif // defined TARGET_ARCH_IA32 1760 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698