1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/x86/LIR-x86.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,149 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_x86_LIR_x86_h 1.11 +#define jit_x86_LIR_x86_h 1.12 + 1.13 +namespace js { 1.14 +namespace jit { 1.15 + 1.16 +class LBox : public LInstructionHelper<2, 1, 0> 1.17 +{ 1.18 + MIRType type_; 1.19 + 1.20 + public: 1.21 + LIR_HEADER(Box); 1.22 + 1.23 + LBox(const LAllocation &in_payload, MIRType type) 1.24 + : type_(type) 1.25 + { 1.26 + setOperand(0, in_payload); 1.27 + } 1.28 + 1.29 + MIRType type() const { 1.30 + return type_; 1.31 + } 1.32 + const char *extraName() const { 1.33 + return StringFromMIRType(type_); 1.34 + } 1.35 +}; 1.36 + 1.37 +class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> 1.38 +{ 1.39 + MIRType type_; 1.40 + 1.41 + public: 1.42 + LIR_HEADER(BoxFloatingPoint); 1.43 + 1.44 + LBoxFloatingPoint(const LAllocation &in, const LDefinition &temp, MIRType type) 1.45 + : type_(type) 1.46 + { 1.47 + JS_ASSERT(IsFloatingPointType(type)); 1.48 + setOperand(0, in); 1.49 + setTemp(0, temp); 1.50 + } 1.51 + 1.52 + MIRType type() const { 1.53 + return type_; 1.54 + } 1.55 + const char *extraName() const { 1.56 + return StringFromMIRType(type_); 1.57 + } 1.58 +}; 1.59 + 1.60 +class LUnbox : public LInstructionHelper<1, 2, 0> 1.61 +{ 1.62 + public: 1.63 + LIR_HEADER(Unbox); 1.64 + 1.65 + MUnbox *mir() const { 1.66 + return mir_->toUnbox(); 1.67 + } 1.68 + const LAllocation *payload() { 1.69 + return getOperand(0); 1.70 + } 1.71 + const LAllocation *type() { 1.72 + return getOperand(1); 1.73 + } 1.74 + const char *extraName() const { 1.75 + return StringFromMIRType(mir()->type()); 1.76 + } 1.77 +}; 1.78 + 1.79 +class LUnboxFloatingPoint : public LInstructionHelper<1, 2, 0> 1.80 +{ 1.81 + MIRType type_; 1.82 + 1.83 + public: 1.84 + LIR_HEADER(UnboxFloatingPoint); 1.85 + 1.86 + static const size_t Input = 0; 1.87 + 1.88 + LUnboxFloatingPoint(MIRType type) 1.89 + : type_(type) 1.90 + { } 1.91 + 1.92 + MUnbox *mir() const { 1.93 + return mir_->toUnbox(); 1.94 + } 1.95 + 1.96 + MIRType type() const { 1.97 + return type_; 1.98 + } 1.99 + const char *extraName() const { 1.100 + return StringFromMIRType(type_); 1.101 + } 1.102 +}; 1.103 + 1.104 +// Convert a 32-bit unsigned integer to a double. 1.105 +class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 1> 1.106 +{ 1.107 + public: 1.108 + LIR_HEADER(AsmJSUInt32ToDouble) 1.109 + 1.110 + LAsmJSUInt32ToDouble(const LAllocation &input, const LDefinition &temp) { 1.111 + setOperand(0, input); 1.112 + setTemp(0, temp); 1.113 + } 1.114 + const LDefinition *temp() { 1.115 + return getTemp(0); 1.116 + } 1.117 +}; 1.118 + 1.119 +// Convert a 32-bit unsigned integer to a float32. 1.120 +class LAsmJSUInt32ToFloat32: public LInstructionHelper<1, 1, 1> 1.121 +{ 1.122 + public: 1.123 + LIR_HEADER(AsmJSUInt32ToFloat32) 1.124 + 1.125 + LAsmJSUInt32ToFloat32(const LAllocation &input, const LDefinition &temp) { 1.126 + setOperand(0, input); 1.127 + setTemp(0, temp); 1.128 + } 1.129 + const LDefinition *temp() { 1.130 + return getTemp(0); 1.131 + } 1.132 +}; 1.133 + 1.134 +class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 0> 1.135 +{ 1.136 + public: 1.137 + LIR_HEADER(AsmJSLoadFuncPtr); 1.138 + LAsmJSLoadFuncPtr(const LAllocation &index) { 1.139 + setOperand(0, index); 1.140 + } 1.141 + MAsmJSLoadFuncPtr *mir() const { 1.142 + return mir_->toAsmJSLoadFuncPtr(); 1.143 + } 1.144 + const LAllocation *index() { 1.145 + return getOperand(0); 1.146 + } 1.147 +}; 1.148 + 1.149 +} // namespace jit 1.150 +} // namespace js 1.151 + 1.152 +#endif /* jit_x86_LIR_x86_h */