| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 #endif | 4968 #endif |
| 4969 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { | 4969 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { |
| 4970 v->VisitRuntimeEntry(it.rinfo()); | 4970 v->VisitRuntimeEntry(it.rinfo()); |
| 4971 } | 4971 } |
| 4972 } | 4972 } |
| 4973 | 4973 |
| 4974 ScopeInfo<>::IterateScopeInfo(this, v); | 4974 ScopeInfo<>::IterateScopeInfo(this, v); |
| 4975 } | 4975 } |
| 4976 | 4976 |
| 4977 | 4977 |
| 4978 void Code::Relocate(int delta) { | 4978 void Code::Relocate(intptr_t delta) { |
| 4979 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 4979 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 4980 it.rinfo()->apply(delta); | 4980 it.rinfo()->apply(delta); |
| 4981 } | 4981 } |
| 4982 CPU::FlushICache(instruction_start(), instruction_size()); | 4982 CPU::FlushICache(instruction_start(), instruction_size()); |
| 4983 } | 4983 } |
| 4984 | 4984 |
| 4985 | 4985 |
| 4986 void Code::CopyFrom(const CodeDesc& desc) { | 4986 void Code::CopyFrom(const CodeDesc& desc) { |
| 4987 // copy code | 4987 // copy code |
| 4988 memmove(instruction_start(), desc.buffer, desc.instr_size); | 4988 memmove(instruction_start(), desc.buffer, desc.instr_size); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 int position = RelocInfo::kNoPosition; // Initially no position found. | 5034 int position = RelocInfo::kNoPosition; // Initially no position found. |
| 5035 // Run through all the relocation info to find the best matching source | 5035 // Run through all the relocation info to find the best matching source |
| 5036 // position. All the code needs to be considered as the sequence of the | 5036 // position. All the code needs to be considered as the sequence of the |
| 5037 // instructions in the code does not necessarily follow the same order as the | 5037 // instructions in the code does not necessarily follow the same order as the |
| 5038 // source. | 5038 // source. |
| 5039 RelocIterator it(this, RelocInfo::kPositionMask); | 5039 RelocIterator it(this, RelocInfo::kPositionMask); |
| 5040 while (!it.done()) { | 5040 while (!it.done()) { |
| 5041 // Only look at positions after the current pc. | 5041 // Only look at positions after the current pc. |
| 5042 if (it.rinfo()->pc() < pc) { | 5042 if (it.rinfo()->pc() < pc) { |
| 5043 // Get position and distance. | 5043 // Get position and distance. |
| 5044 int dist = pc - it.rinfo()->pc(); | 5044 |
| 5045 int pos = it.rinfo()->data(); | 5045 int dist = static_cast<int>(pc - it.rinfo()->pc()); |
| 5046 int pos = static_cast<int>(it.rinfo()->data()); |
| 5046 // If this position is closer than the current candidate or if it has the | 5047 // If this position is closer than the current candidate or if it has the |
| 5047 // same distance as the current candidate and the position is higher then | 5048 // same distance as the current candidate and the position is higher then |
| 5048 // this position is the new candidate. | 5049 // this position is the new candidate. |
| 5049 if ((dist < distance) || | 5050 if ((dist < distance) || |
| 5050 (dist == distance && pos > position)) { | 5051 (dist == distance && pos > position)) { |
| 5051 position = pos; | 5052 position = pos; |
| 5052 distance = dist; | 5053 distance = dist; |
| 5053 } | 5054 } |
| 5054 } | 5055 } |
| 5055 it.next(); | 5056 it.next(); |
| 5056 } | 5057 } |
| 5057 return position; | 5058 return position; |
| 5058 } | 5059 } |
| 5059 | 5060 |
| 5060 | 5061 |
| 5061 // Same as Code::SourcePosition above except it only looks for statement | 5062 // Same as Code::SourcePosition above except it only looks for statement |
| 5062 // positions. | 5063 // positions. |
| 5063 int Code::SourceStatementPosition(Address pc) { | 5064 int Code::SourceStatementPosition(Address pc) { |
| 5064 // First find the position as close as possible using all position | 5065 // First find the position as close as possible using all position |
| 5065 // information. | 5066 // information. |
| 5066 int position = SourcePosition(pc); | 5067 int position = SourcePosition(pc); |
| 5067 // Now find the closest statement position before the position. | 5068 // Now find the closest statement position before the position. |
| 5068 int statement_position = 0; | 5069 int statement_position = 0; |
| 5069 RelocIterator it(this, RelocInfo::kPositionMask); | 5070 RelocIterator it(this, RelocInfo::kPositionMask); |
| 5070 while (!it.done()) { | 5071 while (!it.done()) { |
| 5071 if (RelocInfo::IsStatementPosition(it.rinfo()->rmode())) { | 5072 if (RelocInfo::IsStatementPosition(it.rinfo()->rmode())) { |
| 5072 int p = it.rinfo()->data(); | 5073 int p = static_cast<int>(it.rinfo()->data()); |
| 5073 if (statement_position < p && p <= position) { | 5074 if (statement_position < p && p <= position) { |
| 5074 statement_position = p; | 5075 statement_position = p; |
| 5075 } | 5076 } |
| 5076 } | 5077 } |
| 5077 it.next(); | 5078 it.next(); |
| 5078 } | 5079 } |
| 5079 return statement_position; | 5080 return statement_position; |
| 5080 } | 5081 } |
| 5081 | 5082 |
| 5082 | 5083 |
| (...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8199 if (break_point_objects()->IsUndefined()) return 0; | 8200 if (break_point_objects()->IsUndefined()) return 0; |
| 8200 // Single beak point. | 8201 // Single beak point. |
| 8201 if (!break_point_objects()->IsFixedArray()) return 1; | 8202 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8202 // Multiple break points. | 8203 // Multiple break points. |
| 8203 return FixedArray::cast(break_point_objects())->length(); | 8204 return FixedArray::cast(break_point_objects())->length(); |
| 8204 } | 8205 } |
| 8205 #endif | 8206 #endif |
| 8206 | 8207 |
| 8207 | 8208 |
| 8208 } } // namespace v8::internal | 8209 } } // namespace v8::internal |
| OLD | NEW |