|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jit_x86_CodeGenerator_x86_h |
|
8 #define jit_x86_CodeGenerator_x86_h |
|
9 |
|
10 #include "jit/shared/CodeGenerator-x86-shared.h" |
|
11 #include "jit/x86/Assembler-x86.h" |
|
12 |
|
13 namespace js { |
|
14 namespace jit { |
|
15 |
|
16 class OutOfLineLoadTypedArrayOutOfBounds; |
|
17 class OutOfLineTruncate; |
|
18 class OutOfLineTruncateFloat32; |
|
19 |
|
20 class CodeGeneratorX86 : public CodeGeneratorX86Shared |
|
21 { |
|
22 private: |
|
23 CodeGeneratorX86 *thisFromCtor() { |
|
24 return this; |
|
25 } |
|
26 |
|
27 protected: |
|
28 ValueOperand ToValue(LInstruction *ins, size_t pos); |
|
29 ValueOperand ToOutValue(LInstruction *ins); |
|
30 ValueOperand ToTempValue(LInstruction *ins, size_t pos); |
|
31 |
|
32 template<typename T> |
|
33 bool loadAndNoteViewTypeElement(ArrayBufferView::ViewType vt, const T &srcAddr, |
|
34 const LDefinition *out); |
|
35 template<typename T> |
|
36 void loadViewTypeElement(ArrayBufferView::ViewType vt, const T &srcAddr, |
|
37 const LDefinition *out); |
|
38 template<typename T> |
|
39 bool storeAndNoteViewTypeElement(ArrayBufferView::ViewType vt, const LAllocation *value, |
|
40 const T &dstAddr); |
|
41 template<typename T> |
|
42 void storeViewTypeElement(ArrayBufferView::ViewType vt, const LAllocation *value, |
|
43 const T &dstAddr); |
|
44 void storeElementTyped(const LAllocation *value, MIRType valueType, MIRType elementType, |
|
45 const Register &elements, const LAllocation *index); |
|
46 |
|
47 public: |
|
48 CodeGeneratorX86(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm); |
|
49 |
|
50 public: |
|
51 bool visitBox(LBox *box); |
|
52 bool visitBoxFloatingPoint(LBoxFloatingPoint *box); |
|
53 bool visitUnbox(LUnbox *unbox); |
|
54 bool visitValue(LValue *value); |
|
55 bool visitLoadSlotV(LLoadSlotV *load); |
|
56 bool visitLoadSlotT(LLoadSlotT *load); |
|
57 bool visitStoreSlotT(LStoreSlotT *store); |
|
58 bool visitLoadElementT(LLoadElementT *load); |
|
59 bool visitImplicitThis(LImplicitThis *lir); |
|
60 bool visitInterruptCheck(LInterruptCheck *lir); |
|
61 bool visitCompareB(LCompareB *lir); |
|
62 bool visitCompareBAndBranch(LCompareBAndBranch *lir); |
|
63 bool visitCompareV(LCompareV *lir); |
|
64 bool visitCompareVAndBranch(LCompareVAndBranch *lir); |
|
65 bool visitAsmJSUInt32ToDouble(LAsmJSUInt32ToDouble *lir); |
|
66 bool visitAsmJSUInt32ToFloat32(LAsmJSUInt32ToFloat32 *lir); |
|
67 bool visitTruncateDToInt32(LTruncateDToInt32 *ins); |
|
68 bool visitTruncateFToInt32(LTruncateFToInt32 *ins); |
|
69 bool visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic *ins); |
|
70 bool visitStoreTypedArrayElementStatic(LStoreTypedArrayElementStatic *ins); |
|
71 bool visitAsmJSLoadHeap(LAsmJSLoadHeap *ins); |
|
72 bool visitAsmJSStoreHeap(LAsmJSStoreHeap *ins); |
|
73 bool visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins); |
|
74 bool visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins); |
|
75 bool visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins); |
|
76 bool visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins); |
|
77 |
|
78 bool visitOutOfLineLoadTypedArrayOutOfBounds(OutOfLineLoadTypedArrayOutOfBounds *ool); |
|
79 bool visitOutOfLineTruncate(OutOfLineTruncate *ool); |
|
80 bool visitOutOfLineTruncateFloat32(OutOfLineTruncateFloat32 *ool); |
|
81 |
|
82 void postAsmJSCall(LAsmJSCall *lir); |
|
83 }; |
|
84 |
|
85 typedef CodeGeneratorX86 CodeGeneratorSpecific; |
|
86 |
|
87 } // namespace jit |
|
88 } // namespace js |
|
89 |
|
90 #endif /* jit_x86_CodeGenerator_x86_h */ |