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

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

Issue 1868803002: Use symbols when looking up fields in a class (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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_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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64; 1486 // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64;
1487 // _state[kSTATE_LO] = state & _MASK_32; 1487 // _state[kSTATE_LO] = state & _MASK_32;
1488 // _state[kSTATE_HI] = state >> 32; 1488 // _state[kSTATE_HI] = state >> 32;
1489 void Intrinsifier::Random_nextState(Assembler* assembler) { 1489 void Intrinsifier::Random_nextState(Assembler* assembler) {
1490 const Library& math_lib = Library::Handle(Library::MathLibrary()); 1490 const Library& math_lib = Library::Handle(Library::MathLibrary());
1491 ASSERT(!math_lib.IsNull()); 1491 ASSERT(!math_lib.IsNull());
1492 const Class& random_class = Class::Handle( 1492 const Class& random_class = Class::Handle(
1493 math_lib.LookupClassAllowPrivate(Symbols::_Random())); 1493 math_lib.LookupClassAllowPrivate(Symbols::_Random()));
1494 ASSERT(!random_class.IsNull()); 1494 ASSERT(!random_class.IsNull());
1495 const Field& state_field = Field::ZoneHandle( 1495 const Field& state_field = Field::ZoneHandle(
1496 random_class.LookupInstanceField(Symbols::_state())); 1496 random_class.LookupInstanceFieldAllowPrivate(Symbols::_state()));
1497 ASSERT(!state_field.IsNull()); 1497 ASSERT(!state_field.IsNull());
1498 const Field& random_A_field = Field::ZoneHandle( 1498 const Field& random_A_field = Field::ZoneHandle(
1499 random_class.LookupStaticField(Symbols::_A())); 1499 random_class.LookupStaticFieldAllowPrivate(Symbols::_A()));
1500 ASSERT(!random_A_field.IsNull()); 1500 ASSERT(!random_A_field.IsNull());
1501 ASSERT(random_A_field.is_const()); 1501 ASSERT(random_A_field.is_const());
1502 const Instance& a_value = Instance::Handle(random_A_field.StaticValue()); 1502 const Instance& a_value = Instance::Handle(random_A_field.StaticValue());
1503 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value(); 1503 const int64_t a_int_value = Integer::Cast(a_value).AsInt64Value();
1504 // Receiver. 1504 // Receiver.
1505 __ movq(RAX, Address(RSP, + 1 * kWordSize)); 1505 __ movq(RAX, Address(RSP, + 1 * kWordSize));
1506 // Field '_state'. 1506 // Field '_state'.
1507 __ movq(RBX, FieldAddress(RAX, state_field.Offset())); 1507 __ movq(RBX, FieldAddress(RAX, state_field.Offset()));
1508 // Addresses of _state[0] and _state[1]. 1508 // Addresses of _state[0] and _state[1].
1509 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid); 1509 const intptr_t scale = Instance::ElementSizeFor(kTypedDataUint32ArrayCid);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 __ LoadIsolate(RAX); 2117 __ LoadIsolate(RAX);
2118 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); 2118 __ movq(RAX, Address(RAX, Isolate::current_tag_offset()));
2119 __ ret(); 2119 __ ret();
2120 } 2120 }
2121 2121
2122 #undef __ 2122 #undef __
2123 2123
2124 } // namespace dart 2124 } // namespace dart
2125 2125
2126 #endif // defined TARGET_ARCH_X64 2126 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698