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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 int MinorKey() { | 310 int MinorKey() { |
311 return OpField::encode(op_) | OverwriteField::encode(overwrite_); | 311 return OpField::encode(op_) | OverwriteField::encode(overwrite_); |
312 } | 312 } |
313 | 313 |
314 void Generate(MacroAssembler* masm); | 314 void Generate(MacroAssembler* masm); |
315 | 315 |
316 const char* GetName(); | 316 const char* GetName(); |
317 }; | 317 }; |
318 | 318 |
319 | 319 |
| 320 enum NaNInformation { BothCouldBeNaN, CantBothBeNaN }; |
| 321 |
| 322 |
320 class CompareStub: public CodeStub { | 323 class CompareStub: public CodeStub { |
321 public: | 324 public: |
322 CompareStub(Condition cc, bool strict) : cc_(cc), strict_(strict) { } | 325 CompareStub(Condition cc, |
| 326 bool strict, |
| 327 NaNInformation nan_info = BothCouldBeNaN) : |
| 328 cc_(cc), strict_(strict), never_nan_nan_(nan_info == CantBothBeNaN) { } |
323 | 329 |
324 void Generate(MacroAssembler* masm); | 330 void Generate(MacroAssembler* masm); |
325 | 331 |
326 private: | 332 private: |
327 Condition cc_; | 333 Condition cc_; |
328 bool strict_; | 334 bool strict_; |
| 335 // Only used for 'equal' comparisons. Tells the stub that we already know |
| 336 // that at least one side of the comparison is not NaN. This allows the |
| 337 // stub to use object identity in the positive case. We ignore it when |
| 338 // generating the minor key for other comparisons to avoid creating more |
| 339 // stubs. |
| 340 bool never_nan_nan_; |
329 | 341 |
330 Major MajorKey() { return Compare; } | 342 Major MajorKey() { return Compare; } |
331 | 343 |
332 int MinorKey(); | 344 int MinorKey(); |
333 | 345 |
334 // Branch to the label if the given object isn't a symbol. | 346 // Branch to the label if the given object isn't a symbol. |
335 void BranchIfNonSymbol(MacroAssembler* masm, | 347 void BranchIfNonSymbol(MacroAssembler* masm, |
336 Label* label, | 348 Label* label, |
337 Register object, | 349 Register object, |
338 Register scratch); | 350 Register scratch); |
339 | 351 |
| 352 // Unfortunately you have to run without snapshots to see most of these |
| 353 // names in the profile since most compare stubs end up in the snapshot. |
| 354 const char* GetName(); |
340 #ifdef DEBUG | 355 #ifdef DEBUG |
341 void Print() { | 356 void Print() { |
342 PrintF("CompareStub (cc %d), (strict %s)\n", | 357 PrintF("CompareStub (cc %d), (strict %s)\n", |
343 static_cast<int>(cc_), | 358 static_cast<int>(cc_), |
344 strict_ ? "true" : "false"); | 359 strict_ ? "true" : "false"); |
345 } | 360 } |
346 #endif | 361 #endif |
347 }; | 362 }; |
348 | 363 |
349 | 364 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 PrintF("RegExpExecStub\n"); | 510 PrintF("RegExpExecStub\n"); |
496 } | 511 } |
497 #endif | 512 #endif |
498 }; | 513 }; |
499 | 514 |
500 | 515 |
501 } // namespace internal | 516 } // namespace internal |
502 } // namespace v8 | 517 } // namespace v8 |
503 | 518 |
504 #endif // V8_CODEGEN_H_ | 519 #endif // V8_CODEGEN_H_ |
OLD | NEW |