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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 | 449 |
450 class GenericBinaryOpStub : public CodeStub { | 450 class GenericBinaryOpStub : public CodeStub { |
451 public: | 451 public: |
452 GenericBinaryOpStub(Token::Value op, | 452 GenericBinaryOpStub(Token::Value op, |
453 OverwriteMode mode, | 453 OverwriteMode mode, |
454 int constant_rhs = CodeGenerator::kUnknownIntValue) | 454 int constant_rhs = CodeGenerator::kUnknownIntValue) |
455 : op_(op), | 455 : op_(op), |
456 mode_(mode), | 456 mode_(mode), |
457 constant_rhs_(constant_rhs), | 457 constant_rhs_(constant_rhs), |
458 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)) { } | 458 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)), |
| 459 name_(NULL) { } |
459 | 460 |
460 private: | 461 private: |
461 Token::Value op_; | 462 Token::Value op_; |
462 OverwriteMode mode_; | 463 OverwriteMode mode_; |
463 int constant_rhs_; | 464 int constant_rhs_; |
464 bool specialized_on_rhs_; | 465 bool specialized_on_rhs_; |
| 466 char* name_; |
465 | 467 |
466 static const int kMaxKnownRhs = 0x40000000; | 468 static const int kMaxKnownRhs = 0x40000000; |
467 | 469 |
468 // Minor key encoding in 16 bits. | 470 // Minor key encoding in 16 bits. |
469 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | 471 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
470 class OpBits: public BitField<Token::Value, 2, 6> {}; | 472 class OpBits: public BitField<Token::Value, 2, 6> {}; |
471 class KnownIntBits: public BitField<int, 8, 8> {}; | 473 class KnownIntBits: public BitField<int, 8, 8> {}; |
472 | 474 |
473 Major MajorKey() { return GenericBinaryOp; } | 475 Major MajorKey() { return GenericBinaryOp; } |
474 int MinorKey() { | 476 int MinorKey() { |
(...skipping 24 matching lines...) Expand all Loading... |
499 ASSERT(IsPowerOf2(constant_rhs_)); | 501 ASSERT(IsPowerOf2(constant_rhs_)); |
500 int key = 12; | 502 int key = 12; |
501 int d = constant_rhs_; | 503 int d = constant_rhs_; |
502 while ((d & 1) == 0) { | 504 while ((d & 1) == 0) { |
503 key++; | 505 key++; |
504 d >>= 1; | 506 d >>= 1; |
505 } | 507 } |
506 return key; | 508 return key; |
507 } | 509 } |
508 | 510 |
509 const char* GetName() { | 511 const char* GetName(); |
510 switch (op_) { | |
511 case Token::ADD: return "GenericBinaryOpStub_ADD"; | |
512 case Token::SUB: return "GenericBinaryOpStub_SUB"; | |
513 case Token::MUL: return "GenericBinaryOpStub_MUL"; | |
514 case Token::DIV: return "GenericBinaryOpStub_DIV"; | |
515 case Token::MOD: return "GenericBinaryOpStub_MOD"; | |
516 case Token::BIT_OR: return "GenericBinaryOpStub_BIT_OR"; | |
517 case Token::BIT_AND: return "GenericBinaryOpStub_BIT_AND"; | |
518 case Token::BIT_XOR: return "GenericBinaryOpStub_BIT_XOR"; | |
519 case Token::SAR: return "GenericBinaryOpStub_SAR"; | |
520 case Token::SHL: return "GenericBinaryOpStub_SHL"; | |
521 case Token::SHR: return "GenericBinaryOpStub_SHR"; | |
522 default: return "GenericBinaryOpStub"; | |
523 } | |
524 } | |
525 | 512 |
526 #ifdef DEBUG | 513 #ifdef DEBUG |
527 void Print() { | 514 void Print() { |
528 if (!specialized_on_rhs_) { | 515 if (!specialized_on_rhs_) { |
529 PrintF("GenericBinaryOpStub (%s)\n", Token::String(op_)); | 516 PrintF("GenericBinaryOpStub (%s)\n", Token::String(op_)); |
530 } else { | 517 } else { |
531 PrintF("GenericBinaryOpStub (%s by %d)\n", | 518 PrintF("GenericBinaryOpStub (%s by %d)\n", |
532 Token::String(op_), | 519 Token::String(op_), |
533 constant_rhs_); | 520 constant_rhs_); |
534 } | 521 } |
535 } | 522 } |
536 #endif | 523 #endif |
537 }; | 524 }; |
538 | 525 |
539 | 526 |
540 } } // namespace v8::internal | 527 } } // namespace v8::internal |
541 | 528 |
542 #endif // V8_ARM_CODEGEN_ARM_H_ | 529 #endif // V8_ARM_CODEGEN_ARM_H_ |
OLD | NEW |