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_IA32_CODE_STUBS_IA32_H_ | 28 #ifndef V8_IA32_CODE_STUBS_IA32_H_ |
29 #define V8_IA32_CODE_STUBS_IA32_H_ | 29 #define V8_IA32_CODE_STUBS_IA32_H_ |
30 | 30 |
31 #include "codegen-inl.h" | 31 #include "macro-assembler.h" |
32 #include "ast.h" | 32 #include "code-stubs.h" |
33 #include "ic-inl.h" | 33 #include "ic-inl.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 | 38 |
39 // Compute a transcendental math function natively, or call the | 39 // Compute a transcendental math function natively, or call the |
40 // TranscendentalCache runtime function. | 40 // TranscendentalCache runtime function. |
41 class TranscendentalCacheStub: public CodeStub { | 41 class TranscendentalCacheStub: public CodeStub { |
42 public: | 42 public: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 name_(NULL) { | 105 name_(NULL) { |
106 } | 106 } |
107 | 107 |
108 // Generate code to call the stub with the supplied arguments. This will add | 108 // Generate code to call the stub with the supplied arguments. This will add |
109 // code at the call site to prepare arguments either in registers or on the | 109 // code at the call site to prepare arguments either in registers or on the |
110 // stack together with the actual call. | 110 // stack together with the actual call. |
111 void GenerateCall(MacroAssembler* masm, Register left, Register right); | 111 void GenerateCall(MacroAssembler* masm, Register left, Register right); |
112 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); | 112 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); |
113 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); | 113 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); |
114 | 114 |
115 Result GenerateCall(MacroAssembler* masm, | |
116 VirtualFrame* frame, | |
117 Result* left, | |
118 Result* right); | |
119 | |
120 bool ArgsInRegistersSupported() { | 115 bool ArgsInRegistersSupported() { |
121 return op_ == Token::ADD || op_ == Token::SUB | 116 return op_ == Token::ADD || op_ == Token::SUB |
122 || op_ == Token::MUL || op_ == Token::DIV; | 117 || op_ == Token::MUL || op_ == Token::DIV; |
123 } | 118 } |
124 | 119 |
125 private: | 120 private: |
126 Token::Value op_; | 121 Token::Value op_; |
127 OverwriteMode mode_; | 122 OverwriteMode mode_; |
128 GenericBinaryFlags flags_; | 123 GenericBinaryFlags flags_; |
129 bool args_in_registers_; // Arguments passed in registers not on the stack. | 124 bool args_in_registers_; // Arguments passed in registers not on the stack. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 199 |
205 bool ShouldGenerateFPCode() { | 200 bool ShouldGenerateFPCode() { |
206 return runtime_operands_type_ != BinaryOpIC::STRINGS; | 201 return runtime_operands_type_ != BinaryOpIC::STRINGS; |
207 } | 202 } |
208 | 203 |
209 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } | 204 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } |
210 | 205 |
211 virtual InlineCacheState GetICState() { | 206 virtual InlineCacheState GetICState() { |
212 return BinaryOpIC::ToState(runtime_operands_type_); | 207 return BinaryOpIC::ToState(runtime_operands_type_); |
213 } | 208 } |
| 209 |
| 210 friend class CodeGenerator; |
214 }; | 211 }; |
215 | 212 |
216 | 213 |
217 class StringHelper : public AllStatic { | 214 class StringHelper : public AllStatic { |
218 public: | 215 public: |
219 // Generate code for copying characters using a simple loop. This should only | 216 // Generate code for copying characters using a simple loop. This should only |
220 // be used in places where the number of characters is small and the | 217 // be used in places where the number of characters is small and the |
221 // additional setup and checking in GenerateCopyCharactersREP adds too much | 218 // additional setup and checking in GenerateCopyCharactersREP adds too much |
222 // overhead. Copying of overlapping regions is not supported. | 219 // overhead. Copying of overlapping regions is not supported. |
223 static void GenerateCopyCharacters(MacroAssembler* masm, | 220 static void GenerateCopyCharacters(MacroAssembler* masm, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void Print() { | 351 void Print() { |
355 PrintF("NumberToStringStub\n"); | 352 PrintF("NumberToStringStub\n"); |
356 } | 353 } |
357 #endif | 354 #endif |
358 }; | 355 }; |
359 | 356 |
360 | 357 |
361 } } // namespace v8::internal | 358 } } // namespace v8::internal |
362 | 359 |
363 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 360 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |