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

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

Issue 13588005: Fix issue 9644: object stores become large pieces of code if heap tracing is turned on; jumps aroun… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intrinsifier_ia32.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" // 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 bool Intrinsifier::Array_setIndexed(Assembler* assembler) { 175 bool Intrinsifier::Array_setIndexed(Assembler* assembler) {
176 if (FLAG_enable_type_checks) { 176 if (FLAG_enable_type_checks) {
177 return false; 177 return false;
178 } 178 }
179 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. 179 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
180 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. 180 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index.
181 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array. 181 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // Array.
182 Label fall_through; 182 Label fall_through;
183 __ testq(RCX, Immediate(kSmiTagMask)); 183 __ testq(RCX, Immediate(kSmiTagMask));
184 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 184 __ j(NOT_ZERO, &fall_through);
185 // Range check. 185 // Range check.
186 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset())); 186 __ cmpq(RCX, FieldAddress(RAX, Array::length_offset()));
187 // Runtime throws exception. 187 // Runtime throws exception.
188 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 188 __ j(ABOVE_EQUAL, &fall_through);
189 // Note that RBX is Smi, i.e, times 2. 189 // Note that RBX is Smi, i.e, times 2.
190 ASSERT(kSmiTagShift == 1); 190 ASSERT(kSmiTagShift == 1);
191 // Destroy RCX as we will not continue in the function. 191 // Destroy RCX as we will not continue in the function.
192 __ StoreIntoObject(RAX, 192 __ StoreIntoObject(RAX,
193 FieldAddress(RAX, RCX, TIMES_4, Array::data_offset()), 193 FieldAddress(RAX, RCX, TIMES_4, Array::data_offset()),
194 RDX); 194 RDX);
195 // Caller is responsible of preserving the value if necessary. 195 // Caller is responsible of preserving the value if necessary.
196 __ ret(); 196 __ ret();
197 __ Bind(&fall_through); 197 __ Bind(&fall_through);
198 return false; 198 return false;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // On stack: growable array (+3), index (+2), value (+1), return-address (+0). 314 // On stack: growable array (+3), index (+2), value (+1), return-address (+0).
315 bool Intrinsifier::GrowableArray_setIndexed(Assembler* assembler) { 315 bool Intrinsifier::GrowableArray_setIndexed(Assembler* assembler) {
316 if (FLAG_enable_type_checks) { 316 if (FLAG_enable_type_checks) {
317 return false; 317 return false;
318 } 318 }
319 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value. 319 __ movq(RDX, Address(RSP, + 1 * kWordSize)); // Value.
320 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index. 320 __ movq(RCX, Address(RSP, + 2 * kWordSize)); // Index.
321 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // GrowableArray. 321 __ movq(RAX, Address(RSP, + 3 * kWordSize)); // GrowableArray.
322 Label fall_through; 322 Label fall_through;
323 __ testq(RCX, Immediate(kSmiTagMask)); 323 __ testq(RCX, Immediate(kSmiTagMask));
324 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. 324 __ j(NOT_ZERO, &fall_through); // Non-smi index.
325 // Range check using _length field. 325 // Range check using _length field.
326 __ cmpq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); 326 __ cmpq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset()));
327 // Runtime throws exception. 327 // Runtime throws exception.
328 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 328 __ j(ABOVE_EQUAL, &fall_through);
329 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset())); // data. 329 __ movq(RAX, FieldAddress(RAX, GrowableObjectArray::data_offset())); // data.
330 // Note that RCX is Smi, i.e, times 4. 330 // Note that RCX is Smi, i.e, times 4.
331 ASSERT(kSmiTagShift == 1); 331 ASSERT(kSmiTagShift == 1);
332 __ StoreIntoObject(RAX, 332 __ StoreIntoObject(RAX,
333 FieldAddress(RAX, RCX, TIMES_4, Array::data_offset()), 333 FieldAddress(RAX, RCX, TIMES_4, Array::data_offset()),
334 RDX); 334 RDX);
335 __ ret(); 335 __ ret();
336 __ Bind(&fall_through); 336 __ Bind(&fall_through);
337 return false; 337 return false;
338 } 338 }
(...skipping 19 matching lines...) Expand all
358 358
359 // Set data of growable object array. 359 // Set data of growable object array.
360 // On stack: growable array (+2), data (+1), return-address (+0). 360 // On stack: growable array (+2), data (+1), return-address (+0).
361 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) { 361 bool Intrinsifier::GrowableArray_setData(Assembler* assembler) {
362 if (FLAG_enable_type_checks) { 362 if (FLAG_enable_type_checks) {
363 return false; 363 return false;
364 } 364 }
365 Label fall_through; 365 Label fall_through;
366 __ movq(RBX, Address(RSP, + 1 * kWordSize)); /// Data. 366 __ movq(RBX, Address(RSP, + 1 * kWordSize)); /// Data.
367 __ testq(RBX, Immediate(kSmiTagMask)); 367 __ testq(RBX, Immediate(kSmiTagMask));
368 __ j(ZERO, &fall_through, Assembler::kNearJump); // Data is Smi. 368 __ j(ZERO, &fall_through); // Data is Smi.
369 __ CompareClassId(RBX, kArrayCid); 369 __ CompareClassId(RBX, kArrayCid);
370 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 370 __ j(NOT_EQUAL, &fall_through);
371 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array. 371 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Growable array.
372 __ StoreIntoObject(RAX, 372 __ StoreIntoObject(RAX,
373 FieldAddress(RAX, GrowableObjectArray::data_offset()), 373 FieldAddress(RAX, GrowableObjectArray::data_offset()),
374 RBX); 374 RBX);
375 __ ret(); 375 __ ret();
376 __ Bind(&fall_through); 376 __ Bind(&fall_through);
377 return false; 377 return false;
378 } 378 }
379 379
380 380
381 // Add an element to growable array if it doesn't need to grow, otherwise 381 // Add an element to growable array if it doesn't need to grow, otherwise
382 // call into regular code. 382 // call into regular code.
383 // On stack: growable array (+2), value (+1), return-address (+0). 383 // On stack: growable array (+2), value (+1), return-address (+0).
384 bool Intrinsifier::GrowableArray_add(Assembler* assembler) { 384 bool Intrinsifier::GrowableArray_add(Assembler* assembler) {
385 // In checked mode we need to check the incoming argument. 385 // In checked mode we need to check the incoming argument.
386 if (FLAG_enable_type_checks) return false; 386 if (FLAG_enable_type_checks) return false;
387 Label fall_through; 387 Label fall_through;
388 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array. 388 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Array.
389 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset())); 389 __ movq(RCX, FieldAddress(RAX, GrowableObjectArray::length_offset()));
390 // RCX: length. 390 // RCX: length.
391 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset())); 391 __ movq(RDX, FieldAddress(RAX, GrowableObjectArray::data_offset()));
392 // RDX: data. 392 // RDX: data.
393 // Compare length with capacity. 393 // Compare length with capacity.
394 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset())); 394 __ cmpq(RCX, FieldAddress(RDX, Array::length_offset()));
395 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Must grow data. 395 __ j(EQUAL, &fall_through); // Must grow data.
396 const Immediate& value_one = 396 const Immediate& value_one =
397 Immediate(reinterpret_cast<int64_t>(Smi::New(1))); 397 Immediate(reinterpret_cast<int64_t>(Smi::New(1)));
398 // len = len + 1; 398 // len = len + 1;
399 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one); 399 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one);
400 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value 400 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value
401 ASSERT(kSmiTagShift == 1); 401 ASSERT(kSmiTagShift == 1);
402 __ StoreIntoObject(RDX, 402 __ StoreIntoObject(RDX,
403 FieldAddress(RDX, RCX, TIMES_4, Array::data_offset()), 403 FieldAddress(RDX, RCX, TIMES_4, Array::data_offset()),
404 RAX); 404 RAX);
405 const Immediate& raw_null = 405 const Immediate& raw_null =
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 __ ret(); 1418 __ ret();
1419 return true; 1419 return true;
1420 } 1420 }
1421 1421
1422 1422
1423 #undef __ 1423 #undef __
1424 1424
1425 } // namespace dart 1425 } // namespace dart
1426 1426
1427 #endif // defined TARGET_ARCH_X64 1427 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698