OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 class TranslationIterator BASE_EMBEDDED { | 460 class TranslationIterator BASE_EMBEDDED { |
461 public: | 461 public: |
462 TranslationIterator(ByteArray* buffer, int index) | 462 TranslationIterator(ByteArray* buffer, int index) |
463 : buffer_(buffer), index_(index) { | 463 : buffer_(buffer), index_(index) { |
464 ASSERT(index >= 0 && index < buffer->length()); | 464 ASSERT(index >= 0 && index < buffer->length()); |
465 } | 465 } |
466 | 466 |
467 int32_t Next(); | 467 int32_t Next(); |
468 | 468 |
469 bool HasNext() const { return index_ >= 0; } | 469 bool HasNext() const { return index_ < buffer_->length(); } |
470 | 470 |
471 void Done() { index_ = -1; } | 471 void Done() { index_ = buffer_->length(); } |
472 | 472 |
473 void Skip(int n) { | 473 void Skip(int n) { |
474 for (int i = 0; i < n; i++) Next(); | 474 for (int i = 0; i < n; i++) Next(); |
475 } | 475 } |
476 | 476 |
| 477 void Undo() { |
| 478 ASSERT(index_ > 0); |
| 479 index_--; |
| 480 } |
| 481 |
477 private: | 482 private: |
478 ByteArray* buffer_; | 483 ByteArray* buffer_; |
479 int index_; | 484 int index_; |
480 }; | 485 }; |
481 | 486 |
482 | 487 |
483 class Translation BASE_EMBEDDED { | 488 class Translation BASE_EMBEDDED { |
484 public: | 489 public: |
485 enum Opcode { | 490 enum Opcode { |
486 BEGIN, | 491 BEGIN, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 void StoreLiteral(int literal_id); | 524 void StoreLiteral(int literal_id); |
520 void StoreArgumentsObject(); | 525 void StoreArgumentsObject(); |
521 void MarkDuplicate(); | 526 void MarkDuplicate(); |
522 | 527 |
523 static int NumberOfOperandsFor(Opcode opcode); | 528 static int NumberOfOperandsFor(Opcode opcode); |
524 | 529 |
525 #ifdef OBJECT_PRINT | 530 #ifdef OBJECT_PRINT |
526 static const char* StringFor(Opcode opcode); | 531 static const char* StringFor(Opcode opcode); |
527 #endif | 532 #endif |
528 | 533 |
| 534 // A literal id which refers to the JSFunction itself. |
| 535 static const int kSelfLiteralId = -239; |
| 536 |
529 private: | 537 private: |
530 TranslationBuffer* buffer_; | 538 TranslationBuffer* buffer_; |
531 int index_; | 539 int index_; |
532 }; | 540 }; |
533 | 541 |
534 | 542 |
535 // Linked list holding deoptimizing code objects. The deoptimizing code objects | 543 // Linked list holding deoptimizing code objects. The deoptimizing code objects |
536 // are kept as weak handles until they are no longer activated on the stack. | 544 // are kept as weak handles until they are no longer activated on the stack. |
537 class DeoptimizingCodeListNode : public Malloced { | 545 class DeoptimizingCodeListNode : public Malloced { |
538 public: | 546 public: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 628 |
621 static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, | 629 static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, |
622 DeoptimizationInputData* data, | 630 DeoptimizationInputData* data, |
623 JavaScriptFrame* frame); | 631 JavaScriptFrame* frame); |
624 }; | 632 }; |
625 | 633 |
626 | 634 |
627 } } // namespace v8::internal | 635 } } // namespace v8::internal |
628 | 636 |
629 #endif // V8_DEOPTIMIZER_H_ | 637 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |