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 #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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 const Class& random_class = | 1526 const Class& random_class = |
1527 Class::Handle(math_lib.LookupClassAllowPrivate(Symbols::_Random())); | 1527 Class::Handle(math_lib.LookupClassAllowPrivate(Symbols::_Random())); |
1528 ASSERT(!random_class.IsNull()); | 1528 ASSERT(!random_class.IsNull()); |
1529 const Field& state_field = Field::ZoneHandle( | 1529 const Field& state_field = Field::ZoneHandle( |
1530 random_class.LookupInstanceFieldAllowPrivate(Symbols::_state())); | 1530 random_class.LookupInstanceFieldAllowPrivate(Symbols::_state())); |
1531 ASSERT(!state_field.IsNull()); | 1531 ASSERT(!state_field.IsNull()); |
1532 const Field& random_A_field = Field::ZoneHandle( | 1532 const Field& random_A_field = Field::ZoneHandle( |
1533 random_class.LookupStaticFieldAllowPrivate(Symbols::_A())); | 1533 random_class.LookupStaticFieldAllowPrivate(Symbols::_A())); |
1534 ASSERT(!random_A_field.IsNull()); | 1534 ASSERT(!random_A_field.IsNull()); |
1535 ASSERT(random_A_field.is_const()); | 1535 ASSERT(random_A_field.is_const()); |
1536 const Instance& a_value = Instance::Handle(random_A_field.StaticValue()); | 1536 Instance& a_value = Instance::Handle(random_A_field.StaticValue()); |
| 1537 if (a_value.raw() == Object::sentinel().raw() || |
| 1538 a_value.raw() == Object::transition_sentinel().raw()) { |
| 1539 random_A_field.EvaluateInitializer(); |
| 1540 a_value = random_A_field.StaticValue(); |
| 1541 } |
1537 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); | 1542 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); |
1538 // Receiver. | 1543 // Receiver. |
1539 __ movq(RAX, Address(RSP, +1 * kWordSize)); | 1544 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
1540 // Field '_state'. | 1545 // Field '_state'. |
1541 __ movq(RBX, FieldAddress(RAX, state_field.Offset())); | 1546 __ movq(RBX, FieldAddress(RAX, state_field.Offset())); |
1542 // Addresses of _state[0] and _state[1]. | 1547 // Addresses of _state[0] and _state[1]. |
1543 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid); | 1548 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid); |
1544 const intptr_t offset = Instance::DataOffsetFor(kTypedDataUint32ArrayCid); | 1549 const intptr_t offset = Instance::DataOffsetFor(kTypedDataUint32ArrayCid); |
1545 Address addr_0 = FieldAddress(RBX, 0 * scale + offset); | 1550 Address addr_0 = FieldAddress(RBX, 0 * scale + offset); |
1546 Address addr_1 = FieldAddress(RBX, 1 * scale + offset); | 1551 Address addr_1 = FieldAddress(RBX, 1 * scale + offset); |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 __ Bind(&true_label); | 2276 __ Bind(&true_label); |
2272 __ LoadObject(RAX, Bool::True()); | 2277 __ LoadObject(RAX, Bool::True()); |
2273 __ ret(); | 2278 __ ret(); |
2274 } | 2279 } |
2275 | 2280 |
2276 #undef __ | 2281 #undef __ |
2277 | 2282 |
2278 } // namespace dart | 2283 } // namespace dart |
2279 | 2284 |
2280 #endif // defined TARGET_ARCH_X64 | 2285 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |