| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 885 |
| 886 void MacroAssembler::Set(const Operand& dst, int64_t x) { | 886 void MacroAssembler::Set(const Operand& dst, int64_t x) { |
| 887 if (is_int32(x)) { | 887 if (is_int32(x)) { |
| 888 movq(dst, Immediate(static_cast<int32_t>(x))); | 888 movq(dst, Immediate(static_cast<int32_t>(x))); |
| 889 } else { | 889 } else { |
| 890 Set(kScratchRegister, x); | 890 Set(kScratchRegister, x); |
| 891 movq(dst, kScratchRegister); | 891 movq(dst, kScratchRegister); |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 |
| 896 bool MacroAssembler::IsUnsafeInt(const int x) { |
| 897 static const int kMaxBits = 17; |
| 898 return !is_intn(x, kMaxBits); |
| 899 } |
| 900 |
| 901 |
| 902 void MacroAssembler::SafeSet(Register dst, const int src) { |
| 903 ASSERT(!dst.is(kScratchRegister)); |
| 904 if (IsUnsafeInt(src) && jit_cookie() != 0) { |
| 905 Set(dst, src ^ jit_cookie()); |
| 906 Set(kScratchRegister, jit_cookie()); |
| 907 xor_(dst, kScratchRegister); |
| 908 } else { |
| 909 Set(dst, src); |
| 910 } |
| 911 } |
| 912 |
| 913 |
| 914 void MacroAssembler::SafeMove(Register dst, Smi* src) { |
| 915 ASSERT(!dst.is(kScratchRegister)); |
| 916 ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi. |
| 917 if (IsUnsafeInt(src->value()) && jit_cookie() != 0) { |
| 918 Move(dst, Smi::FromInt(src->value() ^ jit_cookie())); |
| 919 Move(kScratchRegister, Smi::FromInt(jit_cookie())); |
| 920 xor_(dst, kScratchRegister); |
| 921 } else { |
| 922 Move(dst, src); |
| 923 } |
| 924 } |
| 925 |
| 926 |
| 927 void MacroAssembler::SafePush(Smi* src) { |
| 928 ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi. |
| 929 if (IsUnsafeInt(src->value()) && jit_cookie() != 0) { |
| 930 Push(Smi::FromInt(src->value() ^ jit_cookie())); |
| 931 Move(kScratchRegister, Smi::FromInt(jit_cookie())); |
| 932 xor_(Operand(rsp, 0), kScratchRegister); |
| 933 } else { |
| 934 Push(src); |
| 935 } |
| 936 } |
| 937 |
| 938 |
| 895 // ---------------------------------------------------------------------------- | 939 // ---------------------------------------------------------------------------- |
| 896 // Smi tagging, untagging and tag detection. | 940 // Smi tagging, untagging and tag detection. |
| 897 | 941 |
| 898 Register MacroAssembler::GetSmiConstant(Smi* source) { | 942 Register MacroAssembler::GetSmiConstant(Smi* source) { |
| 899 int value = source->value(); | 943 int value = source->value(); |
| 900 if (value == 0) { | 944 if (value == 0) { |
| 901 xorl(kScratchRegister, kScratchRegister); | 945 xorl(kScratchRegister, kScratchRegister); |
| 902 return kScratchRegister; | 946 return kScratchRegister; |
| 903 } | 947 } |
| 904 if (value == 1) { | 948 if (value == 1) { |
| (...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4446 bind(&check_prototype); | 4490 bind(&check_prototype); |
| 4447 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4491 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
| 4448 cmpq(rcx, null_value); | 4492 cmpq(rcx, null_value); |
| 4449 j(not_equal, &next); | 4493 j(not_equal, &next); |
| 4450 } | 4494 } |
| 4451 | 4495 |
| 4452 | 4496 |
| 4453 } } // namespace v8::internal | 4497 } } // namespace v8::internal |
| 4454 | 4498 |
| 4455 #endif // V8_TARGET_ARCH_X64 | 4499 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |