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

Side by Side Diff: runtime/vm/stub_code_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
« runtime/vm/object.cc ('K') | « runtime/vm/stub_code_mips.cc ('k') | no next file » | 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1106 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1107 ASSERT(!is_cls_parameterized || 1107 ASSERT(!is_cls_parameterized ||
1108 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1108 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1109 // kInlineInstanceSize is a constant used as a threshold for determining 1109 // kInlineInstanceSize is a constant used as a threshold for determining
1110 // when the object initialization should be done as a loop or as 1110 // when the object initialization should be done as a loop or as
1111 // straight line code. 1111 // straight line code.
1112 const int kInlineInstanceSize = 12; // In words. 1112 const int kInlineInstanceSize = 12; // In words.
1113 const intptr_t instance_size = cls.instance_size(); 1113 const intptr_t instance_size = cls.instance_size();
1114 ASSERT(instance_size > 0); 1114 ASSERT(instance_size > 0);
1115 __ LoadObject(R12, Object::null_object(), PP); 1115 __ LoadObject(R12, Object::null_object(), PP);
1116 Label slow_case_with_type_arguments; 1116 if (is_cls_parameterized) {
1117 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1118 // RDX: instantiated type arguments.
1119 }
1117 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) { 1120 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) {
1118 Label slow_case_reload_type_arguments; 1121 Label slow_case;
1119 if (is_cls_parameterized) {
1120 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1121 // RDX: instantiated type arguments.
1122 }
1123 // Allocate the object and update top to point to 1122 // Allocate the object and update top to point to
1124 // next object start and initialize the allocated object. 1123 // next object start and initialize the allocated object.
1125 // RDX: instantiated type arguments (if is_cls_parameterized). 1124 // RDX: instantiated type arguments (if is_cls_parameterized).
1126 Heap* heap = Isolate::Current()->heap(); 1125 Heap* heap = Isolate::Current()->heap();
1127 __ movq(RCX, Immediate(heap->TopAddress())); 1126 __ movq(RCX, Immediate(heap->TopAddress()));
1128 __ movq(RAX, Address(RCX, 0)); 1127 __ movq(RAX, Address(RCX, 0));
1129 __ leaq(RBX, Address(RAX, instance_size)); 1128 __ leaq(RBX, Address(RAX, instance_size));
1130 // Check if the allocation fits into the remaining space. 1129 // Check if the allocation fits into the remaining space.
1131 // RAX: potential new object start. 1130 // RAX: potential new object start.
1132 // RBX: potential next object start. 1131 // RBX: potential next object start.
1133 // RCX: heap top address. 1132 // RCX: heap top address.
1134 __ movq(R13, Immediate(heap->EndAddress())); 1133 __ movq(R13, Immediate(heap->EndAddress()));
1135 __ cmpq(RBX, Address(R13, 0)); 1134 __ cmpq(RBX, Address(R13, 0));
1136 if (FLAG_use_slow_path) { 1135 if (FLAG_use_slow_path) {
1137 __ jmp(&slow_case_with_type_arguments); 1136 __ jmp(&slow_case);
1138 } else { 1137 } else {
1139 __ j(ABOVE_EQUAL, &slow_case_with_type_arguments); 1138 __ j(ABOVE_EQUAL, &slow_case);
1140 } 1139 }
1141 __ movq(Address(RCX, 0), RBX); 1140 __ movq(Address(RCX, 0), RBX);
1142 __ UpdateAllocationStats(cls.id()); 1141 __ UpdateAllocationStats(cls.id());
1143 1142
1144 // RAX: new object start. 1143 // RAX: new object start.
1145 // RBX: next object start. 1144 // RBX: next object start.
1146 // RDX: new object type arguments (if is_cls_parameterized). 1145 // RDX: new object type arguments (if is_cls_parameterized).
1147 // Set the tags. 1146 // Set the tags.
1148 uword tags = 0; 1147 uword tags = 0;
1149 tags = RawObject::SizeTag::update(instance_size, tags); 1148 tags = RawObject::SizeTag::update(instance_size, tags);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 if (is_cls_parameterized) { 1184 if (is_cls_parameterized) {
1186 // RDX: new object type arguments. 1185 // RDX: new object type arguments.
1187 // Set the type arguments in the new object. 1186 // Set the type arguments in the new object.
1188 __ movq(Address(RAX, cls.type_arguments_field_offset()), RDX); 1187 __ movq(Address(RAX, cls.type_arguments_field_offset()), RDX);
1189 } 1188 }
1190 // Done allocating and initializing the instance. 1189 // Done allocating and initializing the instance.
1191 // RAX: new object. 1190 // RAX: new object.
1192 __ addq(RAX, Immediate(kHeapObjectTag)); 1191 __ addq(RAX, Immediate(kHeapObjectTag));
1193 __ ret(); 1192 __ ret();
1194 1193
1195 __ Bind(&slow_case_reload_type_arguments); 1194 __ Bind(&slow_case);
1196 } 1195 }
1197 if (is_cls_parameterized) {
1198 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1199 }
1200 __ Bind(&slow_case_with_type_arguments);
1201 // If is_cls_parameterized: 1196 // If is_cls_parameterized:
1202 // RDX: new object type arguments. 1197 // RDX: new object type arguments.
1203 // Create a stub frame. 1198 // Create a stub frame.
1204 __ EnterStubFrame(true); // Uses PP to access class object. 1199 __ EnterStubFrame(true); // Uses PP to access class object.
1205 __ pushq(R12); // Setup space on stack for return value. 1200 __ pushq(R12); // Setup space on stack for return value.
1206 __ PushObject(cls, PP); // Push class of object to be allocated. 1201 __ PushObject(cls, PP); // Push class of object to be allocated.
1207 if (is_cls_parameterized) { 1202 if (is_cls_parameterized) {
1208 __ pushq(RDX); // Push type arguments of object to be allocated. 1203 __ pushq(RDX); // Push type arguments of object to be allocated.
1209 } else { 1204 } else {
1210 __ pushq(R12); // Push null type arguments. 1205 __ pushq(R12); // Push null type arguments.
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 2095
2101 __ movq(left, Address(RSP, 2 * kWordSize)); 2096 __ movq(left, Address(RSP, 2 * kWordSize));
2102 __ movq(right, Address(RSP, 1 * kWordSize)); 2097 __ movq(right, Address(RSP, 1 * kWordSize));
2103 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2098 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2104 __ ret(); 2099 __ ret();
2105 } 2100 }
2106 2101
2107 } // namespace dart 2102 } // namespace dart
2108 2103
2109 #endif // defined TARGET_ARCH_X64 2104 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698