1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/x64/LIR-x64.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,127 @@ 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_x64_LIR_x64_h 1.11 +#define jit_x64_LIR_x64_h 1.12 + 1.13 +namespace js { 1.14 +namespace jit { 1.15 + 1.16 +// Given a typed input, returns an untyped box. 1.17 +class LBox : public LInstructionHelper<1, 1, 0> 1.18 +{ 1.19 + MIRType type_; 1.20 + 1.21 + public: 1.22 + LIR_HEADER(Box) 1.23 + 1.24 + LBox(MIRType type, const LAllocation &payload) 1.25 + : type_(type) 1.26 + { 1.27 + setOperand(0, payload); 1.28 + } 1.29 + 1.30 + MIRType type() const { 1.31 + return type_; 1.32 + } 1.33 + const char *extraName() const { 1.34 + return StringFromMIRType(type_); 1.35 + } 1.36 +}; 1.37 + 1.38 +// Given an untyped input, guards on whether it's a specific type and returns 1.39 +// the unboxed payload. 1.40 +class LUnboxBase : public LInstructionHelper<1, 1, 0> 1.41 +{ 1.42 + public: 1.43 + LUnboxBase(const LAllocation &input) { 1.44 + setOperand(0, input); 1.45 + } 1.46 + 1.47 + static const size_t Input = 0; 1.48 + 1.49 + MUnbox *mir() const { 1.50 + return mir_->toUnbox(); 1.51 + } 1.52 +}; 1.53 + 1.54 +class LUnbox : public LUnboxBase { 1.55 + public: 1.56 + LIR_HEADER(Unbox) 1.57 + 1.58 + LUnbox(const LAllocation &input) 1.59 + : LUnboxBase(input) 1.60 + { } 1.61 + 1.62 + const char *extraName() const { 1.63 + return StringFromMIRType(mir()->type()); 1.64 + } 1.65 +}; 1.66 + 1.67 +class LUnboxFloatingPoint : public LUnboxBase { 1.68 + MIRType type_; 1.69 + 1.70 + public: 1.71 + LIR_HEADER(UnboxFloatingPoint) 1.72 + 1.73 + LUnboxFloatingPoint(const LAllocation &input, MIRType type) 1.74 + : LUnboxBase(input), 1.75 + type_(type) 1.76 + { } 1.77 + 1.78 + MIRType type() const { 1.79 + return type_; 1.80 + } 1.81 + const char *extraName() const { 1.82 + return StringFromMIRType(type_); 1.83 + } 1.84 +}; 1.85 + 1.86 +// Convert a 32-bit unsigned integer to a double. 1.87 +class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 0> 1.88 +{ 1.89 + public: 1.90 + LIR_HEADER(AsmJSUInt32ToDouble) 1.91 + 1.92 + LAsmJSUInt32ToDouble(const LAllocation &input) { 1.93 + setOperand(0, input); 1.94 + } 1.95 +}; 1.96 + 1.97 +// Convert a 32-bit unsigned integer to a float32. 1.98 +class LAsmJSUInt32ToFloat32 : public LInstructionHelper<1, 1, 0> 1.99 +{ 1.100 + public: 1.101 + LIR_HEADER(AsmJSUInt32ToFloat32) 1.102 + 1.103 + LAsmJSUInt32ToFloat32(const LAllocation &input) { 1.104 + setOperand(0, input); 1.105 + } 1.106 +}; 1.107 + 1.108 +class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 1> 1.109 +{ 1.110 + public: 1.111 + LIR_HEADER(AsmJSLoadFuncPtr); 1.112 + LAsmJSLoadFuncPtr(const LAllocation &index, const LDefinition &temp) { 1.113 + setOperand(0, index); 1.114 + setTemp(0, temp); 1.115 + } 1.116 + MAsmJSLoadFuncPtr *mir() const { 1.117 + return mir_->toAsmJSLoadFuncPtr(); 1.118 + } 1.119 + const LAllocation *index() { 1.120 + return getOperand(0); 1.121 + } 1.122 + const LDefinition *temp() { 1.123 + return getTemp(0); 1.124 + } 1.125 +}; 1.126 + 1.127 +} // namespace jit 1.128 +} // namespace js 1.129 + 1.130 +#endif /* jit_x64_LIR_x64_h */