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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 Register scratch); | 265 Register scratch); |
266 | 266 |
267 private: | 267 private: |
268 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 268 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
269 }; | 269 }; |
270 | 270 |
271 | 271 |
272 // Flag that indicates how to generate code for the stub StringAddStub. | 272 // Flag that indicates how to generate code for the stub StringAddStub. |
273 enum StringAddFlags { | 273 enum StringAddFlags { |
274 NO_STRING_ADD_FLAGS = 0, | 274 NO_STRING_ADD_FLAGS = 0, |
275 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. | 275 // Omit left string check in stub (left is definitely a string). |
| 276 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0, |
| 277 // Omit right string check in stub (right is definitely a string). |
| 278 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1, |
| 279 // Omit both string checks in stub. |
| 280 NO_STRING_CHECK_IN_STUB = |
| 281 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB |
276 }; | 282 }; |
277 | 283 |
278 | 284 |
279 class StringAddStub: public CodeStub { | 285 class StringAddStub: public CodeStub { |
280 public: | 286 public: |
281 explicit StringAddStub(StringAddFlags flags) { | 287 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {} |
282 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); | |
283 } | |
284 | 288 |
285 private: | 289 private: |
286 Major MajorKey() { return StringAdd; } | 290 Major MajorKey() { return StringAdd; } |
287 int MinorKey() { return string_check_ ? 0 : 1; } | 291 int MinorKey() { return flags_; } |
288 | 292 |
289 void Generate(MacroAssembler* masm); | 293 void Generate(MacroAssembler* masm); |
290 | 294 |
291 // Should the stub check whether arguments are strings? | 295 void GenerateConvertArgument(MacroAssembler* masm, |
292 bool string_check_; | 296 int stack_offset, |
| 297 Register arg, |
| 298 Register scratch1, |
| 299 Register scratch2, |
| 300 Register scratch3, |
| 301 Label* slow); |
| 302 |
| 303 const StringAddFlags flags_; |
293 }; | 304 }; |
294 | 305 |
295 | 306 |
296 class SubStringStub: public CodeStub { | 307 class SubStringStub: public CodeStub { |
297 public: | 308 public: |
298 SubStringStub() {} | 309 SubStringStub() {} |
299 | 310 |
300 private: | 311 private: |
301 Major MajorKey() { return SubString; } | 312 Major MajorKey() { return SubString; } |
302 int MinorKey() { return 0; } | 313 int MinorKey() { return 0; } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 void Print() { | 367 void Print() { |
357 PrintF("NumberToStringStub\n"); | 368 PrintF("NumberToStringStub\n"); |
358 } | 369 } |
359 #endif | 370 #endif |
360 }; | 371 }; |
361 | 372 |
362 | 373 |
363 } } // namespace v8::internal | 374 } } // namespace v8::internal |
364 | 375 |
365 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 376 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |