| OLD | NEW |
| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 __ ret(); | 392 __ ret(); |
| 393 __ Bind(&fall_through); | 393 __ Bind(&fall_through); |
| 394 return false; | 394 return false; |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 // Set length of growable object array. | 398 // Set length of growable object array. |
| 399 // On stack: growable array (+2), length (+1), return-address (+0). | 399 // On stack: growable array (+2), length (+1), return-address (+0). |
| 400 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { | 400 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { |
| 401 Label fall_through; | 401 Label fall_through; |
| 402 __ movl(EAX, Address(ESP, + 2 * kWordSize)); | 402 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Growable array. |
| 403 __ movl(EBX, Address(ESP, + 1 * kWordSize)); | 403 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Length value. |
| 404 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); | 404 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); |
| 405 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); | 405 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); |
| 406 __ j(ABOVE, &fall_through, Assembler::kNearJump); | 406 __ j(ABOVE, &fall_through, Assembler::kNearJump); |
| 407 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), EBX); | 407 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), EBX); |
| 408 __ ret(); | 408 __ ret(); |
| 409 __ Bind(&fall_through); | 409 __ Bind(&fall_through); |
| 410 return false; | 410 return false; |
| 411 } | 411 } |
| 412 | 412 |
| 413 | 413 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 424 EBX); | 424 EBX); |
| 425 __ ret(); | 425 __ ret(); |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 // Add an element to growable array if it doesn't need to grow, otherwise | 430 // Add an element to growable array if it doesn't need to grow, otherwise |
| 431 // call into regular code. | 431 // call into regular code. |
| 432 // On stack: growable array (+2), value (+1), return-address (+0). | 432 // On stack: growable array (+2), value (+1), return-address (+0). |
| 433 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { | 433 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { |
| 434 // TODO(srdjan): Enable once crash in apidoc.dart is fixed. | 434 // In checked mode we need to type-check the incoming argument. |
| 435 return false; | |
| 436 // In checked mode we need to check the incoming argument. | |
| 437 if (FLAG_enable_type_checks) return false; | 435 if (FLAG_enable_type_checks) return false; |
| 438 Label fall_through; | 436 Label fall_through; |
| 439 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. | 437 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Array. |
| 440 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); | 438 __ movl(EBX, FieldAddress(EAX, GrowableObjectArray::length_offset())); |
| 441 // EBX: length. | 439 // EBX: length. |
| 442 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); | 440 __ movl(EDI, FieldAddress(EAX, GrowableObjectArray::data_offset())); |
| 443 // EDI: data. | 441 // EDI: data. |
| 444 // Compare length with capacity. | 442 // Compare length with capacity. |
| 445 __ cmpl(EBX, FieldAddress(EDI, GrowableObjectArray::length_offset())); | 443 __ cmpl(EBX, FieldAddress(EDI, Array::length_offset())); |
| 446 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Must grow data. | 444 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Must grow data. |
| 447 const Immediate value_one = Immediate(reinterpret_cast<int32_t>(Smi::New(1))); | 445 const Immediate value_one = Immediate(reinterpret_cast<int32_t>(Smi::New(1))); |
| 448 // len = len + 1; | 446 // len = len + 1; |
| 449 __ addl(FieldAddress(EAX, GrowableObjectArray::length_offset()), value_one); | 447 __ addl(FieldAddress(EAX, GrowableObjectArray::length_offset()), value_one); |
| 450 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value | 448 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Value |
| 451 ASSERT(kSmiTagShift == 1); | 449 ASSERT(kSmiTagShift == 1); |
| 452 __ StoreIntoObject(EDI, | 450 __ StoreIntoObject(EDI, |
| 453 FieldAddress(EDI, EBX, TIMES_2, sizeof(RawArray)), | 451 FieldAddress(EDI, EBX, TIMES_2, sizeof(RawArray)), |
| 454 EAX); | 452 EAX); |
| 453 const Immediate raw_null = |
| 454 Immediate(reinterpret_cast<int32_t>(Object::null())); |
| 455 __ movl(EAX, raw_null); |
| 455 __ ret(); | 456 __ ret(); |
| 456 __ Bind(&fall_through); | 457 __ Bind(&fall_through); |
| 457 return false; | 458 return false; |
| 458 } | 459 } |
| 459 | 460 |
| 460 | 461 |
| 461 // Gets the length of a ByteArray. | 462 // Gets the length of a ByteArray. |
| 462 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) { | 463 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) { |
| 463 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 464 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
| 464 __ movl(EAX, FieldAddress(EAX, ByteArray::length_offset())); | 465 __ movl(EAX, FieldAddress(EAX, ByteArray::length_offset())); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 __ Bind(&is_true); | 1407 __ Bind(&is_true); |
| 1407 __ LoadObject(EAX, bool_true); | 1408 __ LoadObject(EAX, bool_true); |
| 1408 __ ret(); | 1409 __ ret(); |
| 1409 return true; | 1410 return true; |
| 1410 } | 1411 } |
| 1411 | 1412 |
| 1412 #undef __ | 1413 #undef __ |
| 1413 } // namespace dart | 1414 } // namespace dart |
| 1414 | 1415 |
| 1415 #endif // defined TARGET_ARCH_IA32 | 1416 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |