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::SafeMove(Register dst, Smi* src) { |
| 903 ASSERT(!dst.is(kScratchRegister)); |
| 904 ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi. |
| 905 if (IsUnsafeInt(src->value()) && jit_cookie() != 0) { |
| 906 Move(dst, Smi::FromInt(src->value() ^ jit_cookie())); |
| 907 Move(kScratchRegister, Smi::FromInt(jit_cookie())); |
| 908 xor_(dst, kScratchRegister); |
| 909 } else { |
| 910 Move(dst, src); |
| 911 } |
| 912 } |
| 913 |
| 914 |
| 915 void MacroAssembler::SafePush(Smi* src) { |
| 916 ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi. |
| 917 if (IsUnsafeInt(src->value()) && jit_cookie() != 0) { |
| 918 Push(Smi::FromInt(src->value() ^ jit_cookie())); |
| 919 Move(kScratchRegister, Smi::FromInt(jit_cookie())); |
| 920 xor_(Operand(rsp, 0), kScratchRegister); |
| 921 } else { |
| 922 Push(src); |
| 923 } |
| 924 } |
| 925 |
| 926 |
895 // ---------------------------------------------------------------------------- | 927 // ---------------------------------------------------------------------------- |
896 // Smi tagging, untagging and tag detection. | 928 // Smi tagging, untagging and tag detection. |
897 | 929 |
898 Register MacroAssembler::GetSmiConstant(Smi* source) { | 930 Register MacroAssembler::GetSmiConstant(Smi* source) { |
899 int value = source->value(); | 931 int value = source->value(); |
900 if (value == 0) { | 932 if (value == 0) { |
901 xorl(kScratchRegister, kScratchRegister); | 933 xorl(kScratchRegister, kScratchRegister); |
902 return kScratchRegister; | 934 return kScratchRegister; |
903 } | 935 } |
904 if (value == 1) { | 936 if (value == 1) { |
(...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4446 bind(&check_prototype); | 4478 bind(&check_prototype); |
4447 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4479 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4448 cmpq(rcx, null_value); | 4480 cmpq(rcx, null_value); |
4449 j(not_equal, &next); | 4481 j(not_equal, &next); |
4450 } | 4482 } |
4451 | 4483 |
4452 | 4484 |
4453 } } // namespace v8::internal | 4485 } } // namespace v8::internal |
4454 | 4486 |
4455 #endif // V8_TARGET_ARCH_X64 | 4487 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |