| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Change all patched stack guard checks in the unoptimized code | 185 // Change all patched stack guard checks in the unoptimized code |
| 186 // back to a normal stack guard check. | 186 // back to a normal stack guard check. |
| 187 static void RevertStackCheckCodeAt(Address pc_after, | 187 static void RevertStackCheckCodeAt(Address pc_after, |
| 188 Code* check_code, | 188 Code* check_code, |
| 189 Code* replacement_code); | 189 Code* replacement_code); |
| 190 | 190 |
| 191 ~Deoptimizer(); | 191 ~Deoptimizer(); |
| 192 | 192 |
| 193 void InsertHeapNumberValues(int index, JavaScriptFrame* frame); | 193 void InsertHeapNumberValues(int index, JavaScriptFrame* frame); |
| 194 | 194 |
| 195 static void ComputeOutputFrames(Deoptimizer* deoptimizer); | 195 static void ComputeOutputFrames(Deoptimizer* deoptimizer, Isolate* isolate); |
| 196 | 196 |
| 197 static Address GetDeoptimizationEntry(int id, BailoutType type); | 197 static Address GetDeoptimizationEntry(int id, BailoutType type); |
| 198 static int GetDeoptimizationId(Address addr, BailoutType type); | 198 static int GetDeoptimizationId(Address addr, BailoutType type); |
| 199 static int GetOutputInfo(DeoptimizationOutputData* data, | 199 static int GetOutputInfo(DeoptimizationOutputData* data, |
| 200 unsigned node_id, | 200 unsigned node_id, |
| 201 SharedFunctionInfo* shared); | 201 SharedFunctionInfo* shared); |
| 202 | 202 |
| 203 // Code generation support. | 203 // Code generation support. |
| 204 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } | 204 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } |
| 205 static int output_count_offset() { | 205 static int output_count_offset() { |
| (...skipping 339 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::kLastParameterOffset; | |
| 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 | |
| 627 } } // namespace v8::internal | 555 } } // namespace v8::internal |
| 628 | 556 |
| 629 #endif // V8_DEOPTIMIZER_H_ | 557 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |