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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 const Class& random_class = Class::Handle( | 1527 const Class& random_class = Class::Handle( |
1528 math_lib.LookupClassAllowPrivate(Symbols::_Random())); | 1528 math_lib.LookupClassAllowPrivate(Symbols::_Random())); |
1529 ASSERT(!random_class.IsNull()); | 1529 ASSERT(!random_class.IsNull()); |
1530 const Field& state_field = Field::ZoneHandle( | 1530 const Field& state_field = Field::ZoneHandle( |
1531 random_class.LookupInstanceFieldAllowPrivate(Symbols::_state())); | 1531 random_class.LookupInstanceFieldAllowPrivate(Symbols::_state())); |
1532 ASSERT(!state_field.IsNull()); | 1532 ASSERT(!state_field.IsNull()); |
1533 const Field& random_A_field = Field::ZoneHandle( | 1533 const Field& random_A_field = Field::ZoneHandle( |
1534 random_class.LookupStaticFieldAllowPrivate(Symbols::_A())); | 1534 random_class.LookupStaticFieldAllowPrivate(Symbols::_A())); |
1535 ASSERT(!random_A_field.IsNull()); | 1535 ASSERT(!random_A_field.IsNull()); |
1536 ASSERT(random_A_field.is_const()); | 1536 ASSERT(random_A_field.is_const()); |
1537 const Instance& a_value = Instance::Handle(random_A_field.StaticValue()); | 1537 Instance& a_value = Instance::Handle(random_A_field.StaticValue()); |
| 1538 if (a_value.raw() == Object::sentinel().raw() || |
| 1539 a_value.raw() == Object::transition_sentinel().raw()) { |
| 1540 random_A_field.EvaluateInitializer(); |
| 1541 a_value = random_A_field.StaticValue(); |
| 1542 } |
1538 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); | 1543 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); |
1539 // Receiver. | 1544 // Receiver. |
1540 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 1545 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
1541 // Field '_state'. | 1546 // Field '_state'. |
1542 __ movq(RBX, FieldAddress(RAX, state_field.Offset())); | 1547 __ movq(RBX, FieldAddress(RAX, state_field.Offset())); |
1543 // Addresses of _state[0] and _state[1]. | 1548 // Addresses of _state[0] and _state[1]. |
1544 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid); | 1549 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid); |
1545 const intptr_t offset = Instance::DataOffsetFor(kTypedDataUint32ArrayCid); | 1550 const intptr_t offset = Instance::DataOffsetFor(kTypedDataUint32ArrayCid); |
1546 Address addr_0 = FieldAddress(RBX, 0 * scale + offset); | 1551 Address addr_0 = FieldAddress(RBX, 0 * scale + offset); |
1547 Address addr_1 = FieldAddress(RBX, 1 * scale + offset); | 1552 Address addr_1 = FieldAddress(RBX, 1 * scale + offset); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 __ Bind(&true_label); | 2300 __ Bind(&true_label); |
2296 __ LoadObject(RAX, Bool::True()); | 2301 __ LoadObject(RAX, Bool::True()); |
2297 __ ret(); | 2302 __ ret(); |
2298 } | 2303 } |
2299 | 2304 |
2300 #undef __ | 2305 #undef __ |
2301 | 2306 |
2302 } // namespace dart | 2307 } // namespace dart |
2303 | 2308 |
2304 #endif // defined TARGET_ARCH_X64 | 2309 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |