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

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

Issue 255273003: For ARMv6, works around missing instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
11 #include "vm/cpu.h"
11 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
12 #include "vm/object.h" 13 #include "vm/object.h"
13 #include "vm/object_store.h" 14 #include "vm/object_store.h"
14 #include "vm/symbols.h" 15 #include "vm/symbols.h"
15 16
16 namespace dart { 17 namespace dart {
17 18
18 DECLARE_FLAG(bool, enable_type_checks); 19 DECLARE_FLAG(bool, enable_type_checks);
19 20
20 21
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 __ Bind(&fall_through); 617 __ Bind(&fall_through);
617 } 618 }
618 619
619 620
620 void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) { 621 void Intrinsifier::Integer_mulFromInteger(Assembler* assembler) {
621 Label fall_through; 622 Label fall_through;
622 623
623 TestBothArgumentsSmis(assembler, &fall_through); // checks two smis 624 TestBothArgumentsSmis(assembler, &fall_through); // checks two smis
624 __ SmiUntag(R0); // untags R6. only want result shifted by one 625 __ SmiUntag(R0); // untags R6. only want result shifted by one
625 626
626 __ smull(R0, IP, R0, R1); // IP:R0 <- R0 * R1. 627 if (TargetCPUFeatures::arm_version() == ARMv7) {
627 __ cmp(IP, ShifterOperand(R0, ASR, 31)); 628 __ smull(R0, IP, R0, R1); // IP:R0 <- R0 * R1.
628 __ bx(LR, EQ); 629 __ cmp(IP, ShifterOperand(R0, ASR, 31));
630 __ bx(LR, EQ);
631 } else {
632 __ CheckMultSignedOverflow(R0, R1, IP, D0, D1, &fall_through);
633 __ mul(R0, R0, R1);
634 __ Ret();
635 }
636
629 __ Bind(&fall_through); // Fall through on overflow. 637 __ Bind(&fall_through); // Fall through on overflow.
630 } 638 }
631 639
632 640
633 void Intrinsifier::Integer_mul(Assembler* assembler) { 641 void Intrinsifier::Integer_mul(Assembler* assembler) {
634 return Integer_mulFromInteger(assembler); 642 return Integer_mulFromInteger(assembler);
635 } 643 }
636 644
637 645
638 // Optimizations: 646 // Optimizations:
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 __ vcvtdi(D1, S0); 1307 __ vcvtdi(D1, S0);
1300 __ b(&double_op); 1308 __ b(&double_op);
1301 __ Bind(&fall_through); 1309 __ Bind(&fall_through);
1302 } 1310 }
1303 1311
1304 1312
1305 // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; 1313 // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64;
1306 // _state[kSTATE_LO] = state & _MASK_32; 1314 // _state[kSTATE_LO] = state & _MASK_32;
1307 // _state[kSTATE_HI] = state >> 32; 1315 // _state[kSTATE_HI] = state >> 32;
1308 void Intrinsifier::Random_nextState(Assembler* assembler) { 1316 void Intrinsifier::Random_nextState(Assembler* assembler) {
1309 const Library& math_lib = Library::Handle(Library::MathLibrary()); 1317 // No 32x32 -> 64 bit multiply/accumulate on ARMv5 or ARMv6.
1310 ASSERT(!math_lib.IsNull()); 1318 if (TargetCPUFeatures::arm_version() == ARMv7) {
1311 const Class& random_class = Class::Handle( 1319 const Library& math_lib = Library::Handle(Library::MathLibrary());
1312 math_lib.LookupClassAllowPrivate(Symbols::_Random())); 1320 ASSERT(!math_lib.IsNull());
1313 ASSERT(!random_class.IsNull()); 1321 const Class& random_class = Class::Handle(
1314 const Field& state_field = Field::ZoneHandle( 1322 math_lib.LookupClassAllowPrivate(Symbols::_Random()));
1315 random_class.LookupInstanceField(Symbols::_state())); 1323 ASSERT(!random_class.IsNull());
1316 ASSERT(!state_field.IsNull()); 1324 const Field& state_field = Field::ZoneHandle(
1317 const Field& random_A_field = Field::ZoneHandle( 1325 random_class.LookupInstanceField(Symbols::_state()));
1318 random_class.LookupStaticField(Symbols::_A())); 1326 ASSERT(!state_field.IsNull());
1319 ASSERT(!random_A_field.IsNull()); 1327 const Field& random_A_field = Field::ZoneHandle(
1320 ASSERT(random_A_field.is_const()); 1328 random_class.LookupStaticField(Symbols::_A()));
1321 const Instance& a_value = Instance::Handle(random_A_field.value()); 1329 ASSERT(!random_A_field.IsNull());
1322 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); 1330 ASSERT(random_A_field.is_const());
1323 // 'a_int_value' is a mask. 1331 const Instance& a_value = Instance::Handle(random_A_field.value());
1324 ASSERT(Utils::IsUint(32, a_int_value)); 1332 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value();
1325 int32_t a_int32_value = static_cast<int32_t>(a_int_value); 1333 // 'a_int_value' is a mask.
1334 ASSERT(Utils::IsUint(32, a_int_value));
1335 int32_t a_int32_value = static_cast<int32_t>(a_int_value);
1326 1336
1327 __ ldr(R0, Address(SP, 0 * kWordSize)); // Receiver. 1337 __ ldr(R0, Address(SP, 0 * kWordSize)); // Receiver.
1328 __ ldr(R1, FieldAddress(R0, state_field.Offset())); // Field '_state'. 1338 __ ldr(R1, FieldAddress(R0, state_field.Offset())); // Field '_state'.
1329 // Addresses of _state[0] and _state[1]. 1339 // Addresses of _state[0] and _state[1].
1330 1340
1331 const int64_t disp_0 = 1341 const int64_t disp_0 =
1332 FlowGraphCompiler::DataOffsetFor(kTypedDataUint32ArrayCid); 1342 FlowGraphCompiler::DataOffsetFor(kTypedDataUint32ArrayCid);
1333 1343
1334 const int64_t disp_1 = 1344 const int64_t disp_1 =
1335 FlowGraphCompiler::ElementSizeFor(kTypedDataUint32ArrayCid) + 1345 FlowGraphCompiler::ElementSizeFor(kTypedDataUint32ArrayCid) +
1336 FlowGraphCompiler::DataOffsetFor(kTypedDataUint32ArrayCid); 1346 FlowGraphCompiler::DataOffsetFor(kTypedDataUint32ArrayCid);
1337 1347
1338 __ LoadImmediate(R0, a_int32_value); 1348 __ LoadImmediate(R0, a_int32_value);
1339 __ LoadFromOffset(kWord, R2, R1, disp_0 - kHeapObjectTag); 1349 __ LoadFromOffset(kWord, R2, R1, disp_0 - kHeapObjectTag);
1340 __ LoadFromOffset(kWord, R3, R1, disp_1 - kHeapObjectTag); 1350 __ LoadFromOffset(kWord, R3, R1, disp_1 - kHeapObjectTag);
1341 __ mov(R6, ShifterOperand(0)); // Zero extend unsigned _state[kSTATE_HI]. 1351 __ mov(R6, ShifterOperand(0)); // Zero extend unsigned _state[kSTATE_HI].
1342 // Unsigned 32-bit multiply and 64-bit accumulate into R6:R3. 1352 // Unsigned 32-bit multiply and 64-bit accumulate into R6:R3.
1343 __ umlal(R3, R6, R0, R2); // R6:R3 <- R6:R3 + R0 * R2. 1353 __ umlal(R3, R6, R0, R2); // R6:R3 <- R6:R3 + R0 * R2.
1344 __ StoreToOffset(kWord, R3, R1, disp_0 - kHeapObjectTag); 1354 __ StoreToOffset(kWord, R3, R1, disp_0 - kHeapObjectTag);
1345 __ StoreToOffset(kWord, R6, R1, disp_1 - kHeapObjectTag); 1355 __ StoreToOffset(kWord, R6, R1, disp_1 - kHeapObjectTag);
1346 __ Ret(); 1356 __ Ret();
1357 }
1347 } 1358 }
1348 1359
1349 1360
1350 void Intrinsifier::Object_equal(Assembler* assembler) { 1361 void Intrinsifier::Object_equal(Assembler* assembler) {
1351 __ ldr(R0, Address(SP, 0 * kWordSize)); 1362 __ ldr(R0, Address(SP, 0 * kWordSize));
1352 __ ldr(R1, Address(SP, 1 * kWordSize)); 1363 __ ldr(R1, Address(SP, 1 * kWordSize));
1353 __ cmp(R0, ShifterOperand(R1)); 1364 __ cmp(R0, ShifterOperand(R1));
1354 __ LoadObject(R0, Bool::False(), NE); 1365 __ LoadObject(R0, Bool::False(), NE);
1355 __ LoadObject(R0, Bool::True(), EQ); 1366 __ LoadObject(R0, Bool::True(), EQ);
1356 __ Ret(); 1367 __ Ret();
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 __ str(R2, Address(R1, Isolate::current_tag_offset())); 1760 __ str(R2, Address(R1, Isolate::current_tag_offset()));
1750 // Clear Isolate::user_tag_. 1761 // Clear Isolate::user_tag_.
1751 __ eor(R2, R2, ShifterOperand(R2)); 1762 __ eor(R2, R2, ShifterOperand(R2));
1752 __ str(R2, Address(R1, Isolate::user_tag_offset())); 1763 __ str(R2, Address(R1, Isolate::user_tag_offset()));
1753 __ Ret(); 1764 __ Ret();
1754 } 1765 }
1755 1766
1756 } // namespace dart 1767 } // namespace dart
1757 1768
1758 #endif // defined TARGET_ARCH_ARM 1769 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698