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

Side by Side Diff: runtime/vm/intrinsifier_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 318
319 // Gets the length of a TypedData. 319 // Gets the length of a TypedData.
320 void Intrinsifier::TypedDataLength(Assembler* assembler) { 320 void Intrinsifier::TypedDataLength(Assembler* assembler) {
321 __ ldr(R0, Address(SP, 0 * kWordSize)); 321 __ ldr(R0, Address(SP, 0 * kWordSize));
322 __ ldr(R0, FieldAddress(R0, TypedData::length_offset())); 322 __ ldr(R0, FieldAddress(R0, TypedData::length_offset()));
323 __ ret(); 323 __ ret();
324 } 324 }
325 325
326 326
327 void Intrinsifier::Uint8ArrayGetIndexed(Assembler* assembler) {
328 Label fall_through;
329 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
330 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
331 __ tsti(R0, kSmiTagMask);
332 __ b(&fall_through, NE); // Index is not a smi, fall through.
333
334 // Range check.
335 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
336 __ cmp(R0, Operand(R6));
337 __ b(&fall_through, CS);
338
339 // Array element at R1 + R0 + TypedData::data_offset - 1.
340 // Untag R0.
341 __ add(R1, R1, Operand(R0, LSR, 1));
342 __ ldr(R0, FieldAddress(R1, TypedData::data_offset()), kUnsignedByte);
343 __ SmiTag(R0);
344 __ ret();
345 __ Bind(&fall_through);
346 }
347
348
349 void Intrinsifier::ExternalUint8ArrayGetIndexed(Assembler* assembler) {
350 Label fall_through;
351
352 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
353 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
354 __ tsti(R0, kSmiTagMask);
355 __ b(&fall_through, NE); // Index is not a smi, fall through.
356
357 // Range check.
358 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
359 __ cmp(R0, Operand(R6));
360 __ b(&fall_through, CS);
361
362 __ ldr(R1, FieldAddress(R1, ExternalTypedData::data_offset()));
363
364 // Untag R0.
365 __ add(R1, R1, Operand(R0, LSR, 1));
366 __ ldr(R0, Address(R1, 0), kUnsignedByte);
367 __ SmiTag(R0);
368 __ ret();
369 __ Bind(&fall_through);
370 }
371
372
373 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) { 327 void Intrinsifier::Float64ArrayGetIndexed(Assembler* assembler) {
374 Label fall_through; 328 Label fall_through;
375 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index. 329 __ ldr(R0, Address(SP, + 0 * kWordSize)); // Index.
376 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array. 330 __ ldr(R1, Address(SP, + 1 * kWordSize)); // Array.
377 __ tsti(R0, kSmiTagMask); 331 __ tsti(R0, kSmiTagMask);
378 __ b(&fall_through, NE); // Index is not a smi, fall through. 332 __ b(&fall_through, NE); // Index is not a smi, fall through.
379 333
380 // Range check. 334 // Range check.
381 __ ldr(R6, FieldAddress(R1, TypedData::length_offset())); 335 __ ldr(R6, FieldAddress(R1, TypedData::length_offset()));
382 __ cmp(R0, Operand(R6)); 336 __ cmp(R0, Operand(R6));
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 Isolate* isolate = Isolate::Current(); 1636 Isolate* isolate = Isolate::Current();
1683 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); 1637 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP);
1684 // Set return value to Isolate::current_tag_. 1638 // Set return value to Isolate::current_tag_.
1685 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 1639 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
1686 __ ret(); 1640 __ ret();
1687 } 1641 }
1688 1642
1689 } // namespace dart 1643 } // namespace dart
1690 1644
1691 #endif // defined TARGET_ARCH_ARM64 1645 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698