OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 enum NaNInformation { | 339 enum NaNInformation { |
340 kBothCouldBeNaN, | 340 kBothCouldBeNaN, |
341 kCantBothBeNaN | 341 kCantBothBeNaN |
342 }; | 342 }; |
343 | 343 |
344 | 344 |
345 class CompareStub: public CodeStub { | 345 class CompareStub: public CodeStub { |
346 public: | 346 public: |
347 CompareStub(Condition cc, | 347 CompareStub(Condition cc, |
348 bool strict, | 348 bool strict, |
349 NaNInformation nan_info = kBothCouldBeNaN) : | 349 NaNInformation nan_info = kBothCouldBeNaN, |
350 cc_(cc), strict_(strict), never_nan_nan_(nan_info == kCantBothBeNaN) { } | 350 bool include_number_compare = true) : |
| 351 cc_(cc), |
| 352 strict_(strict), |
| 353 never_nan_nan_(nan_info == kCantBothBeNaN), |
| 354 include_number_compare_(include_number_compare) { } |
351 | 355 |
352 void Generate(MacroAssembler* masm); | 356 void Generate(MacroAssembler* masm); |
353 | 357 |
354 private: | 358 private: |
355 Condition cc_; | 359 Condition cc_; |
356 bool strict_; | 360 bool strict_; |
357 // Only used for 'equal' comparisons. Tells the stub that we already know | 361 // Only used for 'equal' comparisons. Tells the stub that we already know |
358 // that at least one side of the comparison is not NaN. This allows the | 362 // that at least one side of the comparison is not NaN. This allows the |
359 // stub to use object identity in the positive case. We ignore it when | 363 // stub to use object identity in the positive case. We ignore it when |
360 // generating the minor key for other comparisons to avoid creating more | 364 // generating the minor key for other comparisons to avoid creating more |
361 // stubs. | 365 // stubs. |
362 bool never_nan_nan_; | 366 bool never_nan_nan_; |
| 367 // Do generate the number comparison code in the stub. Stubs without number |
| 368 // comparison code is used when the number comparison has been inlined, and |
| 369 // the stub will be called if one of the operands is not a number. |
| 370 bool include_number_compare_; |
363 | 371 |
364 // Encoding of the minor key CCCCCCCCCCCCCCNS. | 372 // Encoding of the minor key CCCCCCCCCCCCCCNS. |
365 class StrictField: public BitField<bool, 0, 1> {}; | 373 class StrictField: public BitField<bool, 0, 1> {}; |
366 class NeverNanNanField: public BitField<bool, 1, 1> {}; | 374 class NeverNanNanField: public BitField<bool, 1, 1> {}; |
367 class ConditionField: public BitField<int, 2, 14> {}; | 375 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; |
| 376 class ConditionField: public BitField<int, 3, 13> {}; |
368 | 377 |
369 Major MajorKey() { return Compare; } | 378 Major MajorKey() { return Compare; } |
370 | 379 |
371 int MinorKey(); | 380 int MinorKey(); |
372 | 381 |
373 // Branch to the label if the given object isn't a symbol. | 382 // Branch to the label if the given object isn't a symbol. |
374 void BranchIfNonSymbol(MacroAssembler* masm, | 383 void BranchIfNonSymbol(MacroAssembler* masm, |
375 Label* label, | 384 Label* label, |
376 Register object, | 385 Register object, |
377 Register scratch); | 386 Register scratch); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 private: | 596 private: |
588 Major MajorKey() { return ToBoolean; } | 597 Major MajorKey() { return ToBoolean; } |
589 int MinorKey() { return 0; } | 598 int MinorKey() { return 0; } |
590 }; | 599 }; |
591 | 600 |
592 | 601 |
593 } // namespace internal | 602 } // namespace internal |
594 } // namespace v8 | 603 } // namespace v8 |
595 | 604 |
596 #endif // V8_CODEGEN_H_ | 605 #endif // V8_CODEGEN_H_ |
OLD | NEW |