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

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

Issue 11377132: Support all fast elements kinds in the major array operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); 2762 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue));
2763 j(above, fail, distance); 2763 j(above, fail, distance);
2764 } 2764 }
2765 2765
2766 2766
2767 void MacroAssembler::StoreNumberToDoubleElements( 2767 void MacroAssembler::StoreNumberToDoubleElements(
2768 Register maybe_number, 2768 Register maybe_number,
2769 Register elements, 2769 Register elements,
2770 Register index, 2770 Register index,
2771 XMMRegister xmm_scratch, 2771 XMMRegister xmm_scratch,
2772 Label* fail) { 2772 Label* fail,
2773 int elements_offset) {
2773 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done; 2774 Label smi_value, is_nan, maybe_nan, not_nan, have_double_value, done;
2774 2775
2775 JumpIfSmi(maybe_number, &smi_value, Label::kNear); 2776 JumpIfSmi(maybe_number, &smi_value, Label::kNear);
2776 2777
2777 CheckMap(maybe_number, 2778 CheckMap(maybe_number,
2778 isolate()->factory()->heap_number_map(), 2779 isolate()->factory()->heap_number_map(),
2779 fail, 2780 fail,
2780 DONT_DO_SMI_CHECK); 2781 DONT_DO_SMI_CHECK);
2781 2782
2782 // Double value, canonicalize NaN. 2783 // Double value, canonicalize NaN.
2783 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); 2784 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32);
2784 cmpl(FieldOperand(maybe_number, offset), 2785 cmpl(FieldOperand(maybe_number, offset),
2785 Immediate(kNaNOrInfinityLowerBoundUpper32)); 2786 Immediate(kNaNOrInfinityLowerBoundUpper32));
2786 j(greater_equal, &maybe_nan, Label::kNear); 2787 j(greater_equal, &maybe_nan, Label::kNear);
2787 2788
2788 bind(&not_nan); 2789 bind(&not_nan);
2789 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset)); 2790 movsd(xmm_scratch, FieldOperand(maybe_number, HeapNumber::kValueOffset));
2790 bind(&have_double_value); 2791 bind(&have_double_value);
2791 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), 2792 movsd(FieldOperand(elements, index, times_8,
2793 FixedDoubleArray::kHeaderSize - elements_offset),
2792 xmm_scratch); 2794 xmm_scratch);
2793 jmp(&done); 2795 jmp(&done);
2794 2796
2795 bind(&maybe_nan); 2797 bind(&maybe_nan);
2796 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise 2798 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
2797 // it's an Infinity, and the non-NaN code path applies. 2799 // it's an Infinity, and the non-NaN code path applies.
2798 j(greater, &is_nan, Label::kNear); 2800 j(greater, &is_nan, Label::kNear);
2799 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); 2801 cmpl(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0));
2800 j(zero, &not_nan); 2802 j(zero, &not_nan);
2801 bind(&is_nan); 2803 bind(&is_nan);
2802 // Convert all NaNs to the same canonical NaN value when they are stored in 2804 // Convert all NaNs to the same canonical NaN value when they are stored in
2803 // the double array. 2805 // the double array.
2804 Set(kScratchRegister, BitCast<uint64_t>( 2806 Set(kScratchRegister, BitCast<uint64_t>(
2805 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); 2807 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
2806 movq(xmm_scratch, kScratchRegister); 2808 movq(xmm_scratch, kScratchRegister);
2807 jmp(&have_double_value, Label::kNear); 2809 jmp(&have_double_value, Label::kNear);
2808 2810
2809 bind(&smi_value); 2811 bind(&smi_value);
2810 // Value is a smi. convert to a double and store. 2812 // Value is a smi. convert to a double and store.
2811 // Preserve original value. 2813 // Preserve original value.
2812 SmiToInteger32(kScratchRegister, maybe_number); 2814 SmiToInteger32(kScratchRegister, maybe_number);
2813 cvtlsi2sd(xmm_scratch, kScratchRegister); 2815 cvtlsi2sd(xmm_scratch, kScratchRegister);
2814 movsd(FieldOperand(elements, index, times_8, FixedDoubleArray::kHeaderSize), 2816 movsd(FieldOperand(elements, index, times_8,
2817 FixedDoubleArray::kHeaderSize - elements_offset),
2815 xmm_scratch); 2818 xmm_scratch);
2816 bind(&done); 2819 bind(&done);
2817 } 2820 }
2818 2821
2819 2822
2820 void MacroAssembler::CompareMap(Register obj, 2823 void MacroAssembler::CompareMap(Register obj,
2821 Handle<Map> map, 2824 Handle<Map> map,
2822 Label* early_success, 2825 Label* early_success,
2823 CompareMapMode mode) { 2826 CompareMapMode mode) {
2824 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 2827 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
4560 4563
4561 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 4564 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
4562 cmpq(rcx, null_value); 4565 cmpq(rcx, null_value);
4563 j(not_equal, &next); 4566 j(not_equal, &next);
4564 } 4567 }
4565 4568
4566 4569
4567 } } // namespace v8::internal 4570 } } // namespace v8::internal
4568 4571
4569 #endif // V8_TARGET_ARCH_X64 4572 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime.cc ('K') | « 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