OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_X64_CODE_STUBS_X64_H_ | 28 #ifndef V8_X64_CODE_STUBS_X64_H_ |
29 #define V8_X64_CODE_STUBS_X64_H_ | 29 #define V8_X64_CODE_STUBS_X64_H_ |
30 | 30 |
31 #include "codegen-inl.h" | |
32 #include "ast.h" | |
33 #include "ic-inl.h" | 31 #include "ic-inl.h" |
| 32 #include "type-info.h" |
34 | 33 |
35 namespace v8 { | 34 namespace v8 { |
36 namespace internal { | 35 namespace internal { |
37 | 36 |
38 | 37 |
39 // Compute a transcendental math function natively, or call the | 38 // Compute a transcendental math function natively, or call the |
40 // TranscendentalCache runtime function. | 39 // TranscendentalCache runtime function. |
41 class TranscendentalCacheStub: public CodeStub { | 40 class TranscendentalCacheStub: public CodeStub { |
42 public: | 41 public: |
43 explicit TranscendentalCacheStub(TranscendentalCache::Type type) | 42 explicit TranscendentalCacheStub(TranscendentalCache::Type type) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 name_(NULL) { | 99 name_(NULL) { |
101 } | 100 } |
102 | 101 |
103 // Generate code to call the stub with the supplied arguments. This will add | 102 // Generate code to call the stub with the supplied arguments. This will add |
104 // code at the call site to prepare arguments either in registers or on the | 103 // code at the call site to prepare arguments either in registers or on the |
105 // stack together with the actual call. | 104 // stack together with the actual call. |
106 void GenerateCall(MacroAssembler* masm, Register left, Register right); | 105 void GenerateCall(MacroAssembler* masm, Register left, Register right); |
107 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); | 106 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); |
108 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); | 107 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); |
109 | 108 |
110 Result GenerateCall(MacroAssembler* masm, | |
111 VirtualFrame* frame, | |
112 Result* left, | |
113 Result* right); | |
114 | |
115 bool ArgsInRegistersSupported() { | 109 bool ArgsInRegistersSupported() { |
116 return (op_ == Token::ADD) || (op_ == Token::SUB) | 110 return (op_ == Token::ADD) || (op_ == Token::SUB) |
117 || (op_ == Token::MUL) || (op_ == Token::DIV); | 111 || (op_ == Token::MUL) || (op_ == Token::DIV); |
118 } | 112 } |
119 | 113 |
120 private: | 114 private: |
121 Token::Value op_; | 115 Token::Value op_; |
122 OverwriteMode mode_; | 116 OverwriteMode mode_; |
123 GenericBinaryFlags flags_; | 117 GenericBinaryFlags flags_; |
124 bool args_in_registers_; // Arguments passed in registers not on the stack. | 118 bool args_in_registers_; // Arguments passed in registers not on the stack. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 189 |
196 bool ShouldGenerateFPCode() { | 190 bool ShouldGenerateFPCode() { |
197 return runtime_operands_type_ != BinaryOpIC::STRINGS; | 191 return runtime_operands_type_ != BinaryOpIC::STRINGS; |
198 } | 192 } |
199 | 193 |
200 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } | 194 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } |
201 | 195 |
202 virtual InlineCacheState GetICState() { | 196 virtual InlineCacheState GetICState() { |
203 return BinaryOpIC::ToState(runtime_operands_type_); | 197 return BinaryOpIC::ToState(runtime_operands_type_); |
204 } | 198 } |
| 199 |
| 200 friend class CodeGenerator; |
205 }; | 201 }; |
206 | 202 |
207 class StringHelper : public AllStatic { | 203 class StringHelper : public AllStatic { |
208 public: | 204 public: |
209 // Generate code for copying characters using a simple loop. This should only | 205 // Generate code for copying characters using a simple loop. This should only |
210 // be used in places where the number of characters is small and the | 206 // be used in places where the number of characters is small and the |
211 // additional setup and checking in GenerateCopyCharactersREP adds too much | 207 // additional setup and checking in GenerateCopyCharactersREP adds too much |
212 // overhead. Copying of overlapping regions is not supported. | 208 // overhead. Copying of overlapping regions is not supported. |
213 static void GenerateCopyCharacters(MacroAssembler* masm, | 209 static void GenerateCopyCharacters(MacroAssembler* masm, |
214 Register dest, | 210 Register dest, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return ObjectBits::encode(object_.code()) | | 380 return ObjectBits::encode(object_.code()) | |
385 AddressBits::encode(addr_.code()) | | 381 AddressBits::encode(addr_.code()) | |
386 ScratchBits::encode(scratch_.code()); | 382 ScratchBits::encode(scratch_.code()); |
387 } | 383 } |
388 }; | 384 }; |
389 | 385 |
390 | 386 |
391 } } // namespace v8::internal | 387 } } // namespace v8::internal |
392 | 388 |
393 #endif // V8_X64_CODE_STUBS_X64_H_ | 389 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |