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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SafepointTable::SafepointTable(Code* code) { | 61 SafepointTable::SafepointTable(Code* code) { |
62 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); | 62 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); |
63 code_ = code; | 63 code_ = code; |
64 Address header = code->instruction_start() + code->safepoint_table_offset(); | 64 Address header = code->instruction_start() + code->safepoint_table_offset(); |
65 length_ = Memory::uint32_at(header + kLengthOffset); | 65 length_ = Memory::uint32_at(header + kLengthOffset); |
66 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset); | 66 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset); |
67 pc_and_deoptimization_indexes_ = header + kHeaderSize; | 67 pc_and_deoptimization_indexes_ = header + kHeaderSize; |
68 entries_ = pc_and_deoptimization_indexes_ + | 68 entries_ = pc_and_deoptimization_indexes_ + |
69 (length_ * kPcAndDeoptimizationIndexSize); | 69 (length_ * kPcAndDeoptimizationIndexSize); |
70 ASSERT(entry_size_ > 0); | 70 ASSERT(entry_size_ > 0); |
71 ASSERT_EQ(SafepointEntry::DeoptimizationIndexField::max(), | 71 STATIC_ASSERT(SafepointEntry::DeoptimizationIndexField::kMax == |
72 Safepoint::kNoDeoptimizationIndex); | 72 Safepoint::kNoDeoptimizationIndex); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 SafepointEntry SafepointTable::FindEntry(Address pc) const { | 76 SafepointEntry SafepointTable::FindEntry(Address pc) const { |
77 unsigned pc_offset = static_cast<unsigned>(pc - code_->instruction_start()); | 77 unsigned pc_offset = static_cast<unsigned>(pc - code_->instruction_start()); |
78 for (unsigned i = 0; i < length(); i++) { | 78 for (unsigned i = 0; i < length(); i++) { |
79 // TODO(kasperl): Replace the linear search with binary search. | 79 // TODO(kasperl): Replace the linear search with binary search. |
80 if (GetPcOffset(i) == pc_offset) return GetEntry(i); | 80 if (GetPcOffset(i) == pc_offset) return GetEntry(i); |
81 } | 81 } |
82 return SafepointEntry(); | 82 return SafepointEntry(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 previous_gap_end = info.pc_after_gap; | 247 previous_gap_end = info.pc_after_gap; |
248 } | 248 } |
249 } | 249 } |
250 } | 250 } |
251 return result; | 251 return result; |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 | 255 |
256 } } // namespace v8::internal | 256 } } // namespace v8::internal |
OLD | NEW |