| 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), |
| 355 name_(NULL) { } |
| 351 | 356 |
| 352 void Generate(MacroAssembler* masm); | 357 void Generate(MacroAssembler* masm); |
| 353 | 358 |
| 354 private: | 359 private: |
| 355 Condition cc_; | 360 Condition cc_; |
| 356 bool strict_; | 361 bool strict_; |
| 357 // Only used for 'equal' comparisons. Tells the stub that we already know | 362 // 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 | 363 // 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 | 364 // 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 | 365 // generating the minor key for other comparisons to avoid creating more |
| 361 // stubs. | 366 // stubs. |
| 362 bool never_nan_nan_; | 367 bool never_nan_nan_; |
| 368 // Do generate the number comparison code in the stub. Stubs without number |
| 369 // comparison code is used when the number comparison has been inlined, and |
| 370 // the stub will be called if one of the operands is not a number. |
| 371 bool include_number_compare_; |
| 363 | 372 |
| 364 // Encoding of the minor key CCCCCCCCCCCCCCNS. | 373 // Encoding of the minor key CCCCCCCCCCCCCCNS. |
| 365 class StrictField: public BitField<bool, 0, 1> {}; | 374 class StrictField: public BitField<bool, 0, 1> {}; |
| 366 class NeverNanNanField: public BitField<bool, 1, 1> {}; | 375 class NeverNanNanField: public BitField<bool, 1, 1> {}; |
| 367 class ConditionField: public BitField<int, 2, 14> {}; | 376 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; |
| 377 class ConditionField: public BitField<int, 3, 13> {}; |
| 368 | 378 |
| 369 Major MajorKey() { return Compare; } | 379 Major MajorKey() { return Compare; } |
| 370 | 380 |
| 371 int MinorKey(); | 381 int MinorKey(); |
| 372 | 382 |
| 373 // Branch to the label if the given object isn't a symbol. | 383 // Branch to the label if the given object isn't a symbol. |
| 374 void BranchIfNonSymbol(MacroAssembler* masm, | 384 void BranchIfNonSymbol(MacroAssembler* masm, |
| 375 Label* label, | 385 Label* label, |
| 376 Register object, | 386 Register object, |
| 377 Register scratch); | 387 Register scratch); |
| 378 | 388 |
| 379 // Unfortunately you have to run without snapshots to see most of these | 389 // Unfortunately you have to run without snapshots to see most of these |
| 380 // names in the profile since most compare stubs end up in the snapshot. | 390 // names in the profile since most compare stubs end up in the snapshot. |
| 391 char* name_; |
| 381 const char* GetName(); | 392 const char* GetName(); |
| 382 #ifdef DEBUG | 393 #ifdef DEBUG |
| 383 void Print() { | 394 void Print() { |
| 384 PrintF("CompareStub (cc %d), (strict %s)\n", | 395 PrintF("CompareStub (cc %d), (strict %s), " |
| 396 "(never_nan_nan %s), (number_compare %s)\n", |
| 385 static_cast<int>(cc_), | 397 static_cast<int>(cc_), |
| 386 strict_ ? "true" : "false"); | 398 strict_ ? "true" : "false", |
| 399 never_nan_nan_ ? "true" : "false", |
| 400 include_number_compare_ ? "included" : "not included"); |
| 387 } | 401 } |
| 388 #endif | 402 #endif |
| 389 }; | 403 }; |
| 390 | 404 |
| 391 | 405 |
| 392 class CEntryStub : public CodeStub { | 406 class CEntryStub : public CodeStub { |
| 393 public: | 407 public: |
| 394 explicit CEntryStub(int result_size, | 408 explicit CEntryStub(int result_size, |
| 395 ExitFrame::Mode mode = ExitFrame::MODE_NORMAL) | 409 ExitFrame::Mode mode = ExitFrame::MODE_NORMAL) |
| 396 : result_size_(result_size), mode_(mode) { } | 410 : result_size_(result_size), mode_(mode) { } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 private: | 601 private: |
| 588 Major MajorKey() { return ToBoolean; } | 602 Major MajorKey() { return ToBoolean; } |
| 589 int MinorKey() { return 0; } | 603 int MinorKey() { return 0; } |
| 590 }; | 604 }; |
| 591 | 605 |
| 592 | 606 |
| 593 } // namespace internal | 607 } // namespace internal |
| 594 } // namespace v8 | 608 } // namespace v8 |
| 595 | 609 |
| 596 #endif // V8_CODEGEN_H_ | 610 #endif // V8_CODEGEN_H_ |
| OLD | NEW |