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

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

Issue 167683002: Simplify type argument instantiation cache lookup by introducing an array (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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) 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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 if (type_arguments().IsRawInstantiatedRaw(len)) { 2066 if (type_arguments().IsRawInstantiatedRaw(len)) {
2067 __ CompareObject(instantiator_reg, Object::null_object(), PP); 2067 __ CompareObject(instantiator_reg, Object::null_object(), PP);
2068 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); 2068 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
2069 } 2069 }
2070 2070
2071 // Lookup cache before calling runtime. 2071 // Lookup cache before calling runtime.
2072 // TODO(fschneider): Consider moving this into a shared stub to reduce 2072 // TODO(fschneider): Consider moving this into a shared stub to reduce
2073 // generated code size. 2073 // generated code size.
2074 __ LoadObject(RDI, type_arguments(), PP); 2074 __ LoadObject(RDI, type_arguments(), PP);
2075 __ movq(RDI, FieldAddress(RDI, TypeArguments::instantiations_offset())); 2075 __ movq(RDI, FieldAddress(RDI, TypeArguments::instantiations_offset()));
2076 __ movq(RBX, FieldAddress(RDI, Array::length_offset()));
2077 __ leaq(RDI, FieldAddress(RDI, Array::data_offset())); 2076 __ leaq(RDI, FieldAddress(RDI, Array::data_offset()));
2078 __ leaq(RBX, Address(RDI, RBX, TIMES_2, 0)); // RBX is smi. 2077 // The instantiations cache is initialized with Object::zero_array() and is
2078 // therefore guaranteed to contain kNoInstantiator. No length check needed.
2079 Label loop, found, slow_case; 2079 Label loop, found, slow_case;
2080 __ Bind(&loop); 2080 __ Bind(&loop);
2081 __ cmpq(RDI, RBX);
2082 __ j(ABOVE_EQUAL, &slow_case);
2083 __ movq(RDX, Address(RDI, 0 * kWordSize)); // Cached instantiator. 2081 __ movq(RDX, Address(RDI, 0 * kWordSize)); // Cached instantiator.
2084 __ cmpq(RDX, RAX); 2082 __ cmpq(RDX, RAX);
2085 __ j(EQUAL, &found, Assembler::kNearJump); 2083 __ j(EQUAL, &found, Assembler::kNearJump);
2086 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); 2084 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
2087 __ j(EQUAL, &slow_case); 2085 __ j(EQUAL, &slow_case);
2088 __ addq(RDI, Immediate(2 * kWordSize)); 2086 __ addq(RDI, Immediate(2 * kWordSize));
2089 __ jmp(&loop, Assembler::kNearJump); 2087 __ jmp(&loop, Assembler::kNearJump);
2090 __ Bind(&found); 2088 __ Bind(&found);
2091 __ movq(RAX, Address(RDI, 1 * kWordSize)); // Cached instantiated args. 2089 __ movq(RAX, Address(RDI, 1 * kWordSize)); // Cached instantiated args.
2092 __ jmp(&type_arguments_instantiated); 2090 __ jmp(&type_arguments_instantiated);
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after
4992 PcDescriptors::kOther, 4990 PcDescriptors::kOther,
4993 locs()); 4991 locs());
4994 __ Drop(2); // Discard type arguments and receiver. 4992 __ Drop(2); // Discard type arguments and receiver.
4995 } 4993 }
4996 4994
4997 } // namespace dart 4995 } // namespace dart
4998 4996
4999 #undef __ 4997 #undef __
5000 4998
5001 #endif // defined TARGET_ARCH_X64 4999 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698