Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef jit_x64_LIR_x64_h |
michael@0 | 8 | #define jit_x64_LIR_x64_h |
michael@0 | 9 | |
michael@0 | 10 | namespace js { |
michael@0 | 11 | namespace jit { |
michael@0 | 12 | |
michael@0 | 13 | // Given a typed input, returns an untyped box. |
michael@0 | 14 | class LBox : public LInstructionHelper<1, 1, 0> |
michael@0 | 15 | { |
michael@0 | 16 | MIRType type_; |
michael@0 | 17 | |
michael@0 | 18 | public: |
michael@0 | 19 | LIR_HEADER(Box) |
michael@0 | 20 | |
michael@0 | 21 | LBox(MIRType type, const LAllocation &payload) |
michael@0 | 22 | : type_(type) |
michael@0 | 23 | { |
michael@0 | 24 | setOperand(0, payload); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | MIRType type() const { |
michael@0 | 28 | return type_; |
michael@0 | 29 | } |
michael@0 | 30 | const char *extraName() const { |
michael@0 | 31 | return StringFromMIRType(type_); |
michael@0 | 32 | } |
michael@0 | 33 | }; |
michael@0 | 34 | |
michael@0 | 35 | // Given an untyped input, guards on whether it's a specific type and returns |
michael@0 | 36 | // the unboxed payload. |
michael@0 | 37 | class LUnboxBase : public LInstructionHelper<1, 1, 0> |
michael@0 | 38 | { |
michael@0 | 39 | public: |
michael@0 | 40 | LUnboxBase(const LAllocation &input) { |
michael@0 | 41 | setOperand(0, input); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | static const size_t Input = 0; |
michael@0 | 45 | |
michael@0 | 46 | MUnbox *mir() const { |
michael@0 | 47 | return mir_->toUnbox(); |
michael@0 | 48 | } |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | class LUnbox : public LUnboxBase { |
michael@0 | 52 | public: |
michael@0 | 53 | LIR_HEADER(Unbox) |
michael@0 | 54 | |
michael@0 | 55 | LUnbox(const LAllocation &input) |
michael@0 | 56 | : LUnboxBase(input) |
michael@0 | 57 | { } |
michael@0 | 58 | |
michael@0 | 59 | const char *extraName() const { |
michael@0 | 60 | return StringFromMIRType(mir()->type()); |
michael@0 | 61 | } |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | class LUnboxFloatingPoint : public LUnboxBase { |
michael@0 | 65 | MIRType type_; |
michael@0 | 66 | |
michael@0 | 67 | public: |
michael@0 | 68 | LIR_HEADER(UnboxFloatingPoint) |
michael@0 | 69 | |
michael@0 | 70 | LUnboxFloatingPoint(const LAllocation &input, MIRType type) |
michael@0 | 71 | : LUnboxBase(input), |
michael@0 | 72 | type_(type) |
michael@0 | 73 | { } |
michael@0 | 74 | |
michael@0 | 75 | MIRType type() const { |
michael@0 | 76 | return type_; |
michael@0 | 77 | } |
michael@0 | 78 | const char *extraName() const { |
michael@0 | 79 | return StringFromMIRType(type_); |
michael@0 | 80 | } |
michael@0 | 81 | }; |
michael@0 | 82 | |
michael@0 | 83 | // Convert a 32-bit unsigned integer to a double. |
michael@0 | 84 | class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 0> |
michael@0 | 85 | { |
michael@0 | 86 | public: |
michael@0 | 87 | LIR_HEADER(AsmJSUInt32ToDouble) |
michael@0 | 88 | |
michael@0 | 89 | LAsmJSUInt32ToDouble(const LAllocation &input) { |
michael@0 | 90 | setOperand(0, input); |
michael@0 | 91 | } |
michael@0 | 92 | }; |
michael@0 | 93 | |
michael@0 | 94 | // Convert a 32-bit unsigned integer to a float32. |
michael@0 | 95 | class LAsmJSUInt32ToFloat32 : public LInstructionHelper<1, 1, 0> |
michael@0 | 96 | { |
michael@0 | 97 | public: |
michael@0 | 98 | LIR_HEADER(AsmJSUInt32ToFloat32) |
michael@0 | 99 | |
michael@0 | 100 | LAsmJSUInt32ToFloat32(const LAllocation &input) { |
michael@0 | 101 | setOperand(0, input); |
michael@0 | 102 | } |
michael@0 | 103 | }; |
michael@0 | 104 | |
michael@0 | 105 | class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 1> |
michael@0 | 106 | { |
michael@0 | 107 | public: |
michael@0 | 108 | LIR_HEADER(AsmJSLoadFuncPtr); |
michael@0 | 109 | LAsmJSLoadFuncPtr(const LAllocation &index, const LDefinition &temp) { |
michael@0 | 110 | setOperand(0, index); |
michael@0 | 111 | setTemp(0, temp); |
michael@0 | 112 | } |
michael@0 | 113 | MAsmJSLoadFuncPtr *mir() const { |
michael@0 | 114 | return mir_->toAsmJSLoadFuncPtr(); |
michael@0 | 115 | } |
michael@0 | 116 | const LAllocation *index() { |
michael@0 | 117 | return getOperand(0); |
michael@0 | 118 | } |
michael@0 | 119 | const LDefinition *temp() { |
michael@0 | 120 | return getTemp(0); |
michael@0 | 121 | } |
michael@0 | 122 | }; |
michael@0 | 123 | |
michael@0 | 124 | } // namespace jit |
michael@0 | 125 | } // namespace js |
michael@0 | 126 | |
michael@0 | 127 | #endif /* jit_x64_LIR_x64_h */ |