| OLD | NEW |
| (Empty) |
| 1 --- src/objects.cc (revision 757) | |
| 2 +++ src/objects.cc (working copy) | |
| 3 @@ -5377,19 +5377,26 @@ | |
| 4 Address header = code->instruction_start() + code->safepoint_table_start(); | |
| 5 length_ = Memory::uint32_at(header + kLengthOffset); | |
| 6 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset); | |
| 7 - pc_offsets_ = header + kHeaderSize; | |
| 8 - entries_ = pc_offsets_ + (length_ * kPcOffsetSize); | |
| 9 + fixed_entries_ = header + kHeaderSize; | |
| 10 + entries_ = fixed_entries_ + (length_ * kFixedEntrySize); | |
| 11 } | |
| 12 | |
| 13 - int size() const { return length_ * (entry_size_ + kPcOffsetSize); } | |
| 14 + int size() const { return length_ * (entry_size_ + kFixedEntrySize); } | |
| 15 unsigned length() const { return length_; } | |
| 16 unsigned entry_size() const { return entry_size_; } | |
| 17 | |
| 18 unsigned GetPcOffset(unsigned index) const { | |
| 19 ASSERT(index < length_); | |
| 20 - return Memory::uint32_at(pc_offsets_ + (index * kPcOffsetSize)); | |
| 21 + return Memory::uint32_at( | |
| 22 + fixed_entries_ + kPcOffsetOffset + (index * kFixedEntrySize)); | |
| 23 } | |
| 24 | |
| 25 + unsigned GetBailoutId(unsigned index) const { | |
| 26 + ASSERT(index < length_); | |
| 27 + return Memory::uint32_at( | |
| 28 + fixed_entries_ + kBailoutIdOffset + (index * kFixedEntrySize)); | |
| 29 + } | |
| 30 + | |
| 31 uint8_t* GetEntry(unsigned index) const { | |
| 32 ASSERT(index < length_); | |
| 33 return &Memory::uint8_at(entries_ + (index * entry_size_)); | |
| 34 @@ -5408,7 +5415,9 @@ | |
| 35 static const int kEntrySizeOffset = kLengthOffset + kIntSize; | |
| 36 static const int kHeaderSize = kEntrySizeOffset + kIntSize; | |
| 37 | |
| 38 - static const int kPcOffsetSize = kIntSize; | |
| 39 + static const int kPcOffsetOffset = 0; | |
| 40 + static const int kBailoutIdOffset = kPcOffsetOffset + kIntSize; | |
| 41 + static const int kFixedEntrySize = kBailoutIdOffset + kIntSize; | |
| 42 | |
| 43 static void PrintBits(uint8_t byte, int digits) { | |
| 44 ASSERT(digits >= 0 && digits <= kBitsPerByte); | |
| 45 @@ -5422,7 +5431,7 @@ | |
| 46 unsigned length_; | |
| 47 unsigned entry_size_; | |
| 48 | |
| 49 - Address pc_offsets_; | |
| 50 + Address fixed_entries_; | |
| 51 Address entries_; | |
| 52 }; | |
| 53 | |
| 54 @@ -5451,12 +5460,31 @@ | |
| 55 } | |
| 56 | |
| 57 | |
| 58 +void Code::DeoptimizeNow() { | |
| 59 + ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 60 + | |
| 61 + SafepointTable table(this); | |
| 62 + for (unsigned i = 0; i < table.length(); i++) { | |
| 63 + Address pc = entry() + table.GetPcOffset(i); | |
| 64 + unsigned id = table.GetBailoutId(i); | |
| 65 + USE(pc); | |
| 66 + USE(id); | |
| 67 + } | |
| 68 + | |
| 69 + // Done. Update the flags to change the code kind. | |
| 70 + Flags flags = static_cast<Flags>(this->flags() & (~kFlagsKindMask)); | |
| 71 + flags = static_cast<Flags>(flags | (DEOPTIMIZED_FUNCTION << kFlagsKindShift))
; | |
| 72 + ASSERT(kind() == DEOPTIMIZED_FUNCTION); | |
| 73 +} | |
| 74 + | |
| 75 + | |
| 76 #ifdef ENABLE_DISASSEMBLER | |
| 77 // Identify kind of code. | |
| 78 const char* Code::Kind2String(Kind kind) { | |
| 79 switch (kind) { | |
| 80 case FUNCTION: return "FUNCTION"; | |
| 81 case OPTIMIZED_FUNCTION: return "OPTIMIZED_FUNCTION"; | |
| 82 + case DEOPTIMIZED_FUNCTION: return "DEOPTIMIZED_FUNCTION"; | |
| 83 case STUB: return "STUB"; | |
| 84 case BUILTIN: return "BUILTIN"; | |
| 85 case LOAD_IC: return "LOAD_IC"; | |
| OLD | NEW |