OLD | NEW |
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 void MacroAssembler::VmovLow(DwVfpRegister dst, Register src) { | 851 void MacroAssembler::VmovLow(DwVfpRegister dst, Register src) { |
852 if (dst.code() < 16) { | 852 if (dst.code() < 16) { |
853 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); | 853 const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code()); |
854 vmov(loc.low(), src); | 854 vmov(loc.low(), src); |
855 } else { | 855 } else { |
856 vmov(dst, VmovIndexLo, src); | 856 vmov(dst, VmovIndexLo, src); |
857 } | 857 } |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 void MacroAssembler::LoadNumber(Register object, | |
862 LowDwVfpRegister dst, | |
863 Register heap_number_map, | |
864 Register scratch, | |
865 Label* not_number) { | |
866 Label is_smi, done; | |
867 | |
868 UntagAndJumpIfSmi(scratch, object, &is_smi); | |
869 JumpIfNotHeapNumber(object, heap_number_map, scratch, not_number); | |
870 | |
871 vldr(dst, FieldMemOperand(object, HeapNumber::kValueOffset)); | |
872 b(&done); | |
873 | |
874 // Handle loading a double from a smi. | |
875 bind(&is_smi); | |
876 vmov(dst.high(), scratch); | |
877 vcvt_f64_s32(dst, dst.high()); | |
878 | |
879 bind(&done); | |
880 } | |
881 | |
882 | |
883 void MacroAssembler::LoadNumberAsInt32Double(Register object, | |
884 DwVfpRegister double_dst, | |
885 Register heap_number_map, | |
886 Register scratch, | |
887 LowDwVfpRegister double_scratch, | |
888 Label* not_int32) { | |
889 ASSERT(!scratch.is(object)); | |
890 ASSERT(!heap_number_map.is(object) && !heap_number_map.is(scratch)); | |
891 | |
892 Label done, obj_is_not_smi; | |
893 | |
894 UntagAndJumpIfNotSmi(scratch, object, &obj_is_not_smi); | |
895 vmov(double_scratch.low(), scratch); | |
896 vcvt_f64_s32(double_dst, double_scratch.low()); | |
897 b(&done); | |
898 | |
899 bind(&obj_is_not_smi); | |
900 JumpIfNotHeapNumber(object, heap_number_map, scratch, not_int32); | |
901 | |
902 // Load the number. | |
903 // Load the double value. | |
904 vldr(double_dst, FieldMemOperand(object, HeapNumber::kValueOffset)); | |
905 | |
906 TestDoubleIsInt32(double_dst, double_scratch); | |
907 // Jump to not_int32 if the operation did not succeed. | |
908 b(ne, not_int32); | |
909 | |
910 bind(&done); | |
911 } | |
912 | |
913 | |
914 void MacroAssembler::LoadNumberAsInt32(Register object, | |
915 Register dst, | |
916 Register heap_number_map, | |
917 Register scratch, | |
918 DwVfpRegister double_scratch0, | |
919 LowDwVfpRegister double_scratch1, | |
920 Label* not_int32) { | |
921 ASSERT(!dst.is(object)); | |
922 ASSERT(!scratch.is(object)); | |
923 | |
924 Label done, maybe_undefined; | |
925 | |
926 UntagAndJumpIfSmi(dst, object, &done); | |
927 | |
928 JumpIfNotHeapNumber(object, heap_number_map, scratch, &maybe_undefined); | |
929 | |
930 // Object is a heap number. | |
931 // Convert the floating point value to a 32-bit integer. | |
932 // Load the double value. | |
933 vldr(double_scratch0, FieldMemOperand(object, HeapNumber::kValueOffset)); | |
934 | |
935 TryDoubleToInt32Exact(dst, double_scratch0, double_scratch1); | |
936 // Jump to not_int32 if the operation did not succeed. | |
937 b(ne, not_int32); | |
938 b(&done); | |
939 | |
940 bind(&maybe_undefined); | |
941 CompareRoot(object, Heap::kUndefinedValueRootIndex); | |
942 b(ne, not_int32); | |
943 // |undefined| is truncated to 0. | |
944 mov(dst, Operand(Smi::FromInt(0))); | |
945 // Fall through. | |
946 | |
947 bind(&done); | |
948 } | |
949 | |
950 | |
951 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { | 861 void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { |
952 if (frame_mode == BUILD_STUB_FRAME) { | 862 if (frame_mode == BUILD_STUB_FRAME) { |
953 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 863 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
954 Push(Smi::FromInt(StackFrame::STUB)); | 864 Push(Smi::FromInt(StackFrame::STUB)); |
955 // Adjust FP to point to saved FP. | 865 // Adjust FP to point to saved FP. |
956 add(fp, sp, Operand(2 * kPointerSize)); | 866 add(fp, sp, Operand(2 * kPointerSize)); |
957 } else { | 867 } else { |
958 PredictableCodeSizeScope predictible_code_size_scope( | 868 PredictableCodeSizeScope predictible_code_size_scope( |
959 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); | 869 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
960 // The following three instructions must remain together and unmodified | 870 // The following three instructions must remain together and unmodified |
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 void CodePatcher::EmitCondition(Condition cond) { | 3960 void CodePatcher::EmitCondition(Condition cond) { |
4051 Instr instr = Assembler::instr_at(masm_.pc_); | 3961 Instr instr = Assembler::instr_at(masm_.pc_); |
4052 instr = (instr & ~kCondMask) | cond; | 3962 instr = (instr & ~kCondMask) | cond; |
4053 masm_.emit(instr); | 3963 masm_.emit(instr); |
4054 } | 3964 } |
4055 | 3965 |
4056 | 3966 |
4057 } } // namespace v8::internal | 3967 } } // namespace v8::internal |
4058 | 3968 |
4059 #endif // V8_TARGET_ARCH_ARM | 3969 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |