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

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

Issue 56033002: Compute next field offset correctly. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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/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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); 1180 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags));
1181 1181
1182 // Initialize the remaining words of the object. 1182 // Initialize the remaining words of the object.
1183 // RAX: new object start. 1183 // RAX: new object start.
1184 // RBX: next object start. 1184 // RBX: next object start.
1185 // RDI: new object type arguments (if is_cls_parameterized). 1185 // RDI: new object type arguments (if is_cls_parameterized).
1186 // First try inlining the initialization without a loop. 1186 // First try inlining the initialization without a loop.
1187 if (instance_size < (kInlineInstanceSize * kWordSize)) { 1187 if (instance_size < (kInlineInstanceSize * kWordSize)) {
1188 // Check if the object contains any non-header fields. 1188 // Check if the object contains any non-header fields.
1189 // Small objects are initialized using a consecutive set of writes. 1189 // Small objects are initialized using a consecutive set of writes.
1190 for (intptr_t current_offset = sizeof(RawObject); 1190 for (intptr_t current_offset = Instance::NextFieldOffset();
1191 current_offset < instance_size; 1191 current_offset < instance_size;
1192 current_offset += kWordSize) { 1192 current_offset += kWordSize) {
1193 __ movq(Address(RAX, current_offset), R12); 1193 __ movq(Address(RAX, current_offset), R12);
1194 } 1194 }
1195 } else { 1195 } else {
1196 __ leaq(RCX, Address(RAX, sizeof(RawObject))); 1196 __ leaq(RCX, Address(RAX, Instance::NextFieldOffset()));
1197 // Loop until the whole object is initialized. 1197 // Loop until the whole object is initialized.
1198 // RAX: new object. 1198 // RAX: new object.
1199 // RBX: next object start. 1199 // RBX: next object start.
1200 // RCX: next word to be initialized. 1200 // RCX: next word to be initialized.
1201 // RDI: new object type arguments (if is_cls_parameterized). 1201 // RDI: new object type arguments (if is_cls_parameterized).
1202 Label init_loop; 1202 Label init_loop;
1203 Label done; 1203 Label done;
1204 __ Bind(&init_loop); 1204 __ Bind(&init_loop);
1205 __ cmpq(RCX, RBX); 1205 __ cmpq(RCX, RBX);
1206 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); 1206 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump);
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 __ movq(right, Address(RSP, 3 * kWordSize)); 2169 __ movq(right, Address(RSP, 3 * kWordSize));
2170 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2170 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2171 __ popq(right); 2171 __ popq(right);
2172 __ popq(left); 2172 __ popq(left);
2173 __ ret(); 2173 __ ret();
2174 } 2174 }
2175 2175
2176 } // namespace dart 2176 } // namespace dart
2177 2177
2178 #endif // defined TARGET_ARCH_X64 2178 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698