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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 8403035: Tiny improvements on fast element conversion loops in ia32 and x64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « no previous file | src/x64/codegen-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // Call into runtime if GC is required. 348 // Call into runtime if GC is required.
349 __ bind(&gc_required); 349 __ bind(&gc_required);
350 // Restore registers before jumping into runtime. 350 // Restore registers before jumping into runtime.
351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
352 __ pop(ebx); 352 __ pop(ebx);
353 __ pop(eax); 353 __ pop(eax);
354 __ jmp(fail); 354 __ jmp(fail);
355 355
356 // Convert and copy elements 356 // Convert and copy elements
357 // esi: source FixedArray 357 // esi: source FixedArray
358 // edi: number of elements to convert/copy 358 // edi: number of elements to convert/copy
Michael Starzinger 2011/10/27 13:33:07 At this point %edi is actually the index of the la
359 __ bind(&loop); 359 __ bind(&loop);
360 __ sub(edi, Immediate(Smi::FromInt(1)));
361 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); 360 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize));
362 // ebx: current element from source 361 // ebx: current element from source
363 // edi: index of current element 362 // edi: index of current element
364 __ JumpIfNotSmi(ebx, &convert_hole); 363 __ JumpIfNotSmi(ebx, &convert_hole);
365 364
366 // Normal smi, convert it to double and store. 365 // Normal smi, convert it to double and store.
367 __ SmiUntag(ebx); 366 __ SmiUntag(ebx);
368 if (CpuFeatures::IsSupported(SSE2)) { 367 if (CpuFeatures::IsSupported(SSE2)) {
369 CpuFeatures::Scope fscope(SSE2); 368 CpuFeatures::Scope fscope(SSE2);
370 __ cvtsi2sd(xmm0, ebx); 369 __ cvtsi2sd(xmm0, ebx);
(...skipping 12 matching lines...) Expand all
383 if (CpuFeatures::IsSupported(SSE2)) { 382 if (CpuFeatures::IsSupported(SSE2)) {
384 CpuFeatures::Scope use_sse2(SSE2); 383 CpuFeatures::Scope use_sse2(SSE2);
385 __ movdbl(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize), 384 __ movdbl(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize),
386 the_hole_nan); 385 the_hole_nan);
387 } else { 386 } else {
388 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); 387 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference));
389 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); 388 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize));
390 } 389 }
391 390
392 __ bind(&entry); 391 __ bind(&entry);
393 __ test(edi, edi); 392 __ sub(edi, Immediate(Smi::FromInt(1)));
394 __ j(not_zero, &loop); 393 __ j(not_sign, &loop);
395 394
396 __ pop(ebx); 395 __ pop(ebx);
397 __ pop(eax); 396 __ pop(eax);
398 // eax: value 397 // eax: value
399 // ebx: target map 398 // ebx: target map
400 // Set transitioned map. 399 // Set transitioned map.
401 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); 400 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx);
402 __ RecordWriteField(edx, 401 __ RecordWriteField(edx,
403 HeapObject::kMapOffset, 402 HeapObject::kMapOffset,
404 ebx, 403 ebx,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 446 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
448 __ pop(ebx); 447 __ pop(ebx);
449 __ pop(edx); 448 __ pop(edx);
450 __ pop(eax); 449 __ pop(eax);
451 __ jmp(fail); 450 __ jmp(fail);
452 451
453 // Box doubles into heap numbers. 452 // Box doubles into heap numbers.
454 // edi: source FixedDoubleArray 453 // edi: source FixedDoubleArray
455 // eax: destination FixedArray 454 // eax: destination FixedArray
456 __ bind(&loop); 455 __ bind(&loop);
457 __ sub(ebx, Immediate(Smi::FromInt(1)));
458 // ebx: index of current element (smi-tagged) 456 // ebx: index of current element (smi-tagged)
459 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); 457 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
460 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); 458 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32));
461 __ j(equal, &convert_hole); 459 __ j(equal, &convert_hole);
462 460
463 // Non-hole double, copy value into a heap number. 461 // Non-hole double, copy value into a heap number.
464 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); 462 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required);
465 // edx: new heap number 463 // edx: new heap number
466 if (CpuFeatures::IsSupported(SSE2)) { 464 if (CpuFeatures::IsSupported(SSE2)) {
467 CpuFeatures::Scope fscope(SSE2); 465 CpuFeatures::Scope fscope(SSE2);
(...skipping 15 matching lines...) Expand all
483 EMIT_REMEMBERED_SET, 481 EMIT_REMEMBERED_SET,
484 OMIT_SMI_CHECK); 482 OMIT_SMI_CHECK);
485 __ jmp(&entry, Label::kNear); 483 __ jmp(&entry, Label::kNear);
486 484
487 // Replace the-hole NaN with the-hole pointer. 485 // Replace the-hole NaN with the-hole pointer.
488 __ bind(&convert_hole); 486 __ bind(&convert_hole);
489 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), 487 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize),
490 masm->isolate()->factory()->the_hole_value()); 488 masm->isolate()->factory()->the_hole_value());
491 489
492 __ bind(&entry); 490 __ bind(&entry);
493 __ test(ebx, ebx); 491 __ sub(ebx, Immediate(Smi::FromInt(1)));
494 __ j(not_zero, &loop); 492 __ j(not_sign, &loop);
495 493
496 __ pop(ebx); 494 __ pop(ebx);
497 __ pop(edx); 495 __ pop(edx);
498 // ebx: target map 496 // ebx: target map
499 // edx: receiver 497 // edx: receiver
500 // Set transitioned map. 498 // Set transitioned map.
501 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); 499 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx);
502 __ RecordWriteField(edx, 500 __ RecordWriteField(edx,
503 HeapObject::kMapOffset, 501 HeapObject::kMapOffset,
504 ebx, 502 ebx,
(...skipping 14 matching lines...) Expand all
519 // Restore registers. 517 // Restore registers.
520 __ pop(eax); 518 __ pop(eax);
521 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 519 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
522 } 520 }
523 521
524 #undef __ 522 #undef __
525 523
526 } } // namespace v8::internal 524 } } // namespace v8::internal
527 525
528 #endif // V8_TARGET_ARCH_IA32 526 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698