Chromium Code Reviews| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 | 545 |
| 546 private: | 546 private: |
| 547 // Global (weak) handle to the deoptimizing code object. | 547 // Global (weak) handle to the deoptimizing code object. |
| 548 Handle<Code> code_; | 548 Handle<Code> code_; |
| 549 | 549 |
| 550 // Next pointer for linked list. | 550 // Next pointer for linked list. |
| 551 DeoptimizingCodeListNode* next_; | 551 DeoptimizingCodeListNode* next_; |
| 552 }; | 552 }; |
| 553 | 553 |
| 554 | 554 |
| 555 class SlotRef BASE_EMBEDDED { | |
| 556 public: | |
| 557 enum SlotRepresentation { | |
| 558 UNKNOWN, | |
| 559 TAGGED, | |
| 560 INT32, | |
| 561 DOUBLE, | |
| 562 LITERAL | |
| 563 }; | |
| 564 | |
| 565 SlotRef() | |
| 566 : addr_(NULL), representation_(UNKNOWN) { } | |
| 567 | |
| 568 SlotRef(Address addr, SlotRepresentation representation) | |
| 569 : addr_(addr), representation_(representation) { } | |
| 570 | |
| 571 explicit SlotRef(Object* literal) | |
| 572 : literal_(literal), representation_(LITERAL) { } | |
| 573 | |
| 574 Handle<Object> GetValue() { | |
| 575 switch (representation_) { | |
| 576 case TAGGED: | |
| 577 return Handle<Object>(Memory::Object_at(addr_)); | |
| 578 | |
| 579 case INT32: { | |
| 580 int value = Memory::int32_at(addr_); | |
| 581 if (Smi::IsValid(value)) { | |
| 582 return Handle<Object>(Smi::FromInt(value)); | |
| 583 } else { | |
| 584 return Isolate::Current()->factory()->NewNumberFromInt(value); | |
| 585 } | |
| 586 } | |
| 587 | |
| 588 case DOUBLE: { | |
| 589 double value = Memory::double_at(addr_); | |
| 590 return Isolate::Current()->factory()->NewNumber(value); | |
| 591 } | |
| 592 | |
| 593 case LITERAL: | |
| 594 return literal_; | |
| 595 | |
| 596 default: | |
| 597 UNREACHABLE(); | |
| 598 return Handle<Object>::null(); | |
| 599 } | |
| 600 } | |
| 601 | |
| 602 static void ComputeSlotMappingForArguments(JavaScriptFrame* frame, | |
| 603 int inlined_frame_index, | |
| 604 Vector<SlotRef>* args_slots); | |
| 605 | |
| 606 private: | |
| 607 Address addr_; | |
| 608 Handle<Object> literal_; | |
| 609 SlotRepresentation representation_; | |
| 610 | |
| 611 static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { | |
| 612 if (slot_index >= 0) { | |
| 613 const int offset = JavaScriptFrameConstants::kLocal0Offset; | |
| 614 return frame->fp() + offset - (slot_index * kPointerSize); | |
| 615 } else { | |
| 616 const int offset = JavaScriptFrameConstants::kSavedRegistersOffset; | |
|
Kevin Millikin (Chromium)
2011/04/01 08:53:16
kSavedRegistersOffset is an archaic name. Maybe i
| |
| 617 return frame->fp() + offset - ((slot_index + 1) * kPointerSize); | |
| 618 } | |
| 619 } | |
| 620 | |
| 621 static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, | |
| 622 DeoptimizationInputData* data, | |
| 623 JavaScriptFrame* frame); | |
| 624 }; | |
| 625 | |
| 626 | |
| 555 } } // namespace v8::internal | 627 } } // namespace v8::internal |
| 556 | 628 |
| 557 #endif // V8_DEOPTIMIZER_H_ | 629 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |