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

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

Issue 169223005: 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
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/object.h » ('j') | 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_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);
2084 __ addq(RDI, Immediate(2 * kWordSize));
2086 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator))); 2085 __ cmpq(RDX, Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
2087 __ j(EQUAL, &slow_case); 2086 __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
2088 __ addq(RDI, Immediate(2 * kWordSize)); 2087 __ jmp(&slow_case, Assembler::kNearJump);
2089 __ 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, Assembler::kNearJump);
2093 2091
2094 __ Bind(&slow_case); 2092 __ Bind(&slow_case);
2095 // Instantiate non-null type arguments. 2093 // Instantiate non-null type arguments.
2096 // A runtime call to instantiate the type arguments is required. 2094 // A runtime call to instantiate the type arguments is required.
2097 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. 2095 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result.
2098 __ PushObject(type_arguments(), PP); 2096 __ PushObject(type_arguments(), PP);
2099 __ pushq(instantiator_reg); // Push instantiator type arguments. 2097 __ pushq(instantiator_reg); // Push instantiator type arguments.
2100 compiler->GenerateRuntimeCall(token_pos(), 2098 compiler->GenerateRuntimeCall(token_pos(),
2101 deopt_id(), 2099 deopt_id(),
2102 kInstantiateTypeArgumentsRuntimeEntry, 2100 kInstantiateTypeArgumentsRuntimeEntry,
(...skipping 2889 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
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698