| OLD | NEW |
| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 EAX); | 451 EAX); |
| 452 const Immediate& raw_null = | 452 const Immediate& raw_null = |
| 453 Immediate(reinterpret_cast<int32_t>(Object::null())); | 453 Immediate(reinterpret_cast<int32_t>(Object::null())); |
| 454 __ movl(EAX, raw_null); | 454 __ movl(EAX, raw_null); |
| 455 __ ret(); | 455 __ ret(); |
| 456 __ Bind(&fall_through); | 456 __ Bind(&fall_through); |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 // Gets the length of a ByteArray. | |
| 462 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) { | |
| 463 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | |
| 464 __ movl(EAX, FieldAddress(EAX, ByteArray::length_offset())); | |
| 465 __ ret(); | |
| 466 return true; | |
| 467 } | |
| 468 | |
| 469 | |
| 470 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ | 461 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
| 471 Label fall_through; \ | 462 Label fall_through; \ |
| 472 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ | 463 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
| 473 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ | 464 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 474 /* Check that length is a positive Smi. */ \ | 465 /* Check that length is a positive Smi. */ \ |
| 475 /* EDI: requested array length argument. */ \ | 466 /* EDI: requested array length argument. */ \ |
| 476 __ testl(EDI, Immediate(kSmiTagSize)); \ | 467 __ testl(EDI, Immediate(kSmiTagSize)); \ |
| 477 __ j(NOT_ZERO, &fall_through); \ | 468 __ j(NOT_ZERO, &fall_through); \ |
| 478 __ cmpl(EDI, Immediate(0)); \ | 469 __ cmpl(EDI, Immediate(0)); \ |
| 479 __ j(LESS, &fall_through); \ | 470 __ j(LESS, &fall_through); \ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ | 544 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ |
| 554 __ movl(Address(EDI, 0), ECX); \ | 545 __ movl(Address(EDI, 0), ECX); \ |
| 555 __ addl(EDI, Immediate(kWordSize)); \ | 546 __ addl(EDI, Immediate(kWordSize)); \ |
| 556 __ jmp(&init_loop, Assembler::kNearJump); \ | 547 __ jmp(&init_loop, Assembler::kNearJump); \ |
| 557 __ Bind(&done); \ | 548 __ Bind(&done); \ |
| 558 \ | 549 \ |
| 559 __ ret(); \ | 550 __ ret(); \ |
| 560 __ Bind(&fall_through); \ | 551 __ Bind(&fall_through); \ |
| 561 | 552 |
| 562 | 553 |
| 563 #define SCALARLIST_ALLOCATOR(clazz, scale) \ | |
| 564 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ | |
| 565 ScaleFactor scale_fac = scale; \ | |
| 566 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\ | |
| 567 return false; \ | |
| 568 } \ | |
| 569 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ | |
| 570 ScaleFactor scale_fac = scale; \ | |
| 571 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale_fac);\ | |
| 572 return false; \ | |
| 573 } | |
| 574 | |
| 575 | |
| 576 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) | |
| 577 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) | |
| 578 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) | |
| 579 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) | |
| 580 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) | |
| 581 SCALARLIST_ALLOCATOR(Int32Array, TIMES_4) | |
| 582 SCALARLIST_ALLOCATOR(Uint32Array, TIMES_4) | |
| 583 SCALARLIST_ALLOCATOR(Int64Array, TIMES_8) | |
| 584 SCALARLIST_ALLOCATOR(Uint64Array, TIMES_8) | |
| 585 SCALARLIST_ALLOCATOR(Float32Array, TIMES_4) | |
| 586 SCALARLIST_ALLOCATOR(Float64Array, TIMES_8) | |
| 587 | |
| 588 | |
| 589 bool Intrinsifier::Int64Array_getIndexed(Assembler* assembler) { | |
| 590 return false; | |
| 591 } | |
| 592 | |
| 593 | |
| 594 bool Intrinsifier::Uint64Array_getIndexed(Assembler* assembler) { | |
| 595 return false; | |
| 596 } | |
| 597 | |
| 598 | 554 |
| 599 // Gets the length of a TypedData. | 555 // Gets the length of a TypedData. |
| 600 bool Intrinsifier::TypedData_getLength(Assembler* assembler) { | 556 bool Intrinsifier::TypedData_getLength(Assembler* assembler) { |
| 601 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 557 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
| 602 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); | 558 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); |
| 603 __ ret(); | 559 __ ret(); |
| 604 return true; | 560 return true; |
| 605 } | 561 } |
| 606 | 562 |
| 607 | 563 |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 __ SmiTag(EAX); | 1495 __ SmiTag(EAX); |
| 1540 __ movl(FieldAddress(EBX, String::hash_offset()), EAX); | 1496 __ movl(FieldAddress(EBX, String::hash_offset()), EAX); |
| 1541 __ ret(); | 1497 __ ret(); |
| 1542 return true; | 1498 return true; |
| 1543 } | 1499 } |
| 1544 | 1500 |
| 1545 #undef __ | 1501 #undef __ |
| 1546 } // namespace dart | 1502 } // namespace dart |
| 1547 | 1503 |
| 1548 #endif // defined TARGET_ARCH_IA32 | 1504 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |