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