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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 8054043: Porting r9456 to x64 (Optimize KeyedStoreGeneric for Smi arrays). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: minor change. Created 9 years, 2 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 | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-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 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 void MacroAssembler::CheckFastSmiOnlyElements(Register map, 2673 void MacroAssembler::CheckFastSmiOnlyElements(Register map,
2674 Label* fail, 2674 Label* fail,
2675 Label::Distance distance) { 2675 Label::Distance distance) {
2676 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); 2676 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
2677 cmpb(FieldOperand(map, Map::kBitField2Offset), 2677 cmpb(FieldOperand(map, Map::kBitField2Offset),
2678 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue)); 2678 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue));
2679 j(above, fail, distance); 2679 j(above, fail, distance);
2680 } 2680 }
2681 2681
2682 2682
2683 void MacroAssembler::StoreNumberToDoubleElements(
2684 Register maybe_number,
2685 Register elements,
2686 Register key,
2687 XMMRegister xmm_scratch,
2688 Label* fail) {
2689 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done;
2690
2691 JumpIfSmi(maybe_number, &smi_value, Label::kNear);
2692
2693 CheckMap(maybe_number,
2694 isolate()->factory()->heap_number_map(),
2695 fail,
2696 DONT_DO_SMI_CHECK);
2697
2698 // Double value, canonicalize NaN.
2699 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32);
2700 cmpl(FieldOperand(maybe_number, offset),
2701 Immediate(kNaNOrInfinityLowerBoundUpper32));
2702 j(greater_equal, &maybe_nan, Label::kNear);
2703
2704 bind(&not_nan);
2705 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset));
2706 bind(&have_double_value);
2707 movsd(FieldOperand(elements, key, times_8, FixedDoubleArray::kHeaderSize),
2708 xmm_scratch);
2709 jmp(&done);
2710
2711 bind(&maybe_nan);
2712 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
2713 // it's an Infinity, and the non-NaN code path applies.
2714 j(greater, &is_nan, Label::kNear);
2715 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0));
2716 j(zero, &not_nan);
2717 bind(&is_nan);
2718 // Convert all NaNs to the same canonical NaN value when they are stored in
2719 // the double array.
2720 Set(kScratchRegister, BitCast<uint64_t>(
2721 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
2722 movq(xmm_scratch, kScratchRegister);
2723 jmp(&have_double_value, Label::kNear);
2724
2725 bind(&smi_value);
2726 // Value is a smi. convert to a double and store.
2727 // Preserve original value.
2728 SmiToInteger32(kScratchRegister, maybe_number);
2729 cvtlsi2sd(xmm_scratch, kScratchRegister);
2730 movsd(FieldOperand(elements, key, times_8, FixedDoubleArray::kHeaderSize),
2731 xmm_scratch);
2732 bind(&done);
2733 }
2734
2735
2683 void MacroAssembler::CheckMap(Register obj, 2736 void MacroAssembler::CheckMap(Register obj,
2684 Handle<Map> map, 2737 Handle<Map> map,
2685 Label* fail, 2738 Label* fail,
2686 SmiCheckType smi_check_type) { 2739 SmiCheckType smi_check_type) {
2687 if (smi_check_type == DO_SMI_CHECK) { 2740 if (smi_check_type == DO_SMI_CHECK) {
2688 JumpIfSmi(obj, fail); 2741 JumpIfSmi(obj, fail);
2689 } 2742 }
2690 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 2743 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
2691 j(not_equal, fail); 2744 j(not_equal, fail);
2692 } 2745 }
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4221 4274
4222 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); 4275 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask));
4223 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); 4276 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length);
4224 4277
4225 bind(&done); 4278 bind(&done);
4226 } 4279 }
4227 4280
4228 } } // namespace v8::internal 4281 } } // namespace v8::internal
4229 4282
4230 #endif // V8_TARGET_ARCH_X64 4283 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698