| 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 __ Bind(&fall_through); | 334 __ Bind(&fall_through); |
| 335 return false; | 335 return false; |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 // Set length of growable object array. | 339 // Set length of growable object array. |
| 340 // On stack: growable array (+2), length (+1), return-address (+0). | 340 // On stack: growable array (+2), length (+1), return-address (+0). |
| 341 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { | 341 bool Intrinsifier::GrowableArray_setLength(Assembler* assembler) { |
| 342 Label fall_through; | 342 Label fall_through; |
| 343 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. | 343 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. |
| 344 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Length. | 344 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Length value. |
| 345 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 345 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
| 346 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); | 346 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
| 347 __ j(ABOVE, &fall_through, Assembler::kNearJump); | 347 __ j(ABOVE, &fall_through, Assembler::kNearJump); |
| 348 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), RCX); | 348 __ movq(FieldAddress(RAX, GrowableObjectArray::length_offset()), RCX); |
| 349 __ ret(); | 349 __ ret(); |
| 350 __ Bind(&fall_through); | 350 __ Bind(&fall_through); |
| 351 return false; | 351 return false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 | 354 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 365 RBX); | 365 RBX); |
| 366 __ ret(); | 366 __ ret(); |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 | 369 |
| 370 | 370 |
| 371 // Add an element to growable array if it doesn't need to grow, otherwise | 371 // Add an element to growable array if it doesn't need to grow, otherwise |
| 372 // call into regular code. | 372 // call into regular code. |
| 373 // On stack: growable array (+2), value (+1), return-address (+0). | 373 // On stack: growable array (+2), value (+1), return-address (+0). |
| 374 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { | 374 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { |
| 375 // TODO(srdjan): Enable once crash in apidoc.dart is fixed. | |
| 376 return false; | |
| 377 // In checked mode we need to check the incoming argument. | 375 // In checked mode we need to check the incoming argument. |
| 378 if (FLAG_enable_type_checks) return false; | 376 if (FLAG_enable_type_checks) return false; |
| 379 Label fall_through; | 377 Label fall_through; |
| 380 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. | 378 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. |
| 381 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); | 379 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); |
| 382 // RCX: length. | 380 // RCX: length. |
| 383 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); | 381 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); |
| 384 // RDX: data. | 382 // RDX: data. |
| 385 // Compare length with capacity. | 383 // Compare length with capacity. |
| 386 __ cmpq(RCX, FieldAddress(RDX, GrowableObjectArray::length_offset())); | 384 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); |
| 387 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Must grow data. | 385 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Must grow data. |
| 388 const Immediate value_one = Immediate(reinterpret_cast<int64_t>(Smi::New(1))); | 386 const Immediate value_one = Immediate(reinterpret_cast<int64_t>(Smi::New(1))); |
| 389 // len = len + 1; | 387 // len = len + 1; |
| 390 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one); | 388 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one); |
| 391 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value | 389 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value |
| 392 ASSERT(kSmiTagShift == 1); | 390 ASSERT(kSmiTagShift == 1); |
| 393 __ StoreIntoObject(RDX, | 391 __ StoreIntoObject(RDX, |
| 394 FieldAddress(RDX, RCX, TIMES_4, sizeof(RawArray)), | 392 FieldAddress(RDX, RCX, TIMES_4, sizeof(RawArray)), |
| 395 RAX); | 393 RAX); |
| 394 const Immediate raw_null = |
| 395 Immediate(reinterpret_cast<int64_t>(Object::null())); |
| 396 __ movq(RAX, raw_null); |
| 396 __ ret(); | 397 __ ret(); |
| 397 __ Bind(&fall_through); | 398 __ Bind(&fall_through); |
| 398 return false; | 399 return false; |
| 399 } | 400 } |
| 400 | 401 |
| 401 | 402 |
| 402 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) { | 403 bool Intrinsifier::ByteArrayBase_getLength(Assembler* assembler) { |
| 403 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 404 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 404 __ movq(RAX, FieldAddress(RAX, ByteArray::length_offset())); | 405 __ movq(RAX, FieldAddress(RAX, ByteArray::length_offset())); |
| 405 __ ret(); | 406 __ ret(); |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 __ LoadObject(RAX, bool_true); | 1362 __ LoadObject(RAX, bool_true); |
| 1362 __ ret(); | 1363 __ ret(); |
| 1363 return true; | 1364 return true; |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 #undef __ | 1367 #undef __ |
| 1367 | 1368 |
| 1368 } // namespace dart | 1369 } // namespace dart |
| 1369 | 1370 |
| 1370 #endif // defined TARGET_ARCH_X64 | 1371 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |