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 4965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4976 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { | 4976 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { |
4977 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 4977 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
4978 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 4978 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
4979 Object* old_target = target; | 4979 Object* old_target = target; |
4980 VisitPointer(&target); | 4980 VisitPointer(&target); |
4981 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 4981 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. |
4982 } | 4982 } |
4983 | 4983 |
4984 | 4984 |
4985 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { | 4985 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { |
4986 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && rinfo->IsCallInstruction()); | 4986 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && |
| 4987 rinfo->IsPatchedReturnSequence()); |
4987 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 4988 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
4988 Object* old_target = target; | 4989 Object* old_target = target; |
4989 VisitPointer(&target); | 4990 VisitPointer(&target); |
4990 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 4991 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. |
4991 } | 4992 } |
4992 | 4993 |
4993 | 4994 |
4994 void Code::CodeIterateBody(ObjectVisitor* v) { | 4995 void Code::CodeIterateBody(ObjectVisitor* v) { |
4995 int mode_mask = RelocInfo::kCodeTargetMask | | 4996 int mode_mask = RelocInfo::kCodeTargetMask | |
4996 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 4997 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
4997 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 4998 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
4998 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 4999 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
4999 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 5000 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
5000 | 5001 |
5001 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 5002 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
5002 RelocInfo::Mode rmode = it.rinfo()->rmode(); | 5003 RelocInfo::Mode rmode = it.rinfo()->rmode(); |
5003 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 5004 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
5004 v->VisitPointer(it.rinfo()->target_object_address()); | 5005 v->VisitPointer(it.rinfo()->target_object_address()); |
5005 } else if (RelocInfo::IsCodeTarget(rmode)) { | 5006 } else if (RelocInfo::IsCodeTarget(rmode)) { |
5006 v->VisitCodeTarget(it.rinfo()); | 5007 v->VisitCodeTarget(it.rinfo()); |
5007 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { | 5008 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
5008 v->VisitExternalReference(it.rinfo()->target_reference_address()); | 5009 v->VisitExternalReference(it.rinfo()->target_reference_address()); |
5009 #ifdef ENABLE_DEBUGGER_SUPPORT | 5010 #ifdef ENABLE_DEBUGGER_SUPPORT |
5010 } else if (Debug::has_break_points() && | 5011 } else if (Debug::has_break_points() && |
5011 RelocInfo::IsJSReturn(rmode) && | 5012 RelocInfo::IsJSReturn(rmode) && |
5012 it.rinfo()->IsCallInstruction()) { | 5013 it.rinfo()->IsPatchedReturnSequence()) { |
5013 v->VisitDebugTarget(it.rinfo()); | 5014 v->VisitDebugTarget(it.rinfo()); |
5014 #endif | 5015 #endif |
5015 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { | 5016 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { |
5016 v->VisitRuntimeEntry(it.rinfo()); | 5017 v->VisitRuntimeEntry(it.rinfo()); |
5017 } | 5018 } |
5018 } | 5019 } |
5019 | 5020 |
5020 ScopeInfo<>::IterateScopeInfo(this, v); | 5021 ScopeInfo<>::IterateScopeInfo(this, v); |
5021 } | 5022 } |
5022 | 5023 |
(...skipping 17 matching lines...) Expand all Loading... |
5040 *p++ = 0; | 5041 *p++ = 0; |
5041 } | 5042 } |
5042 } | 5043 } |
5043 | 5044 |
5044 // copy reloc info | 5045 // copy reloc info |
5045 memmove(relocation_start(), | 5046 memmove(relocation_start(), |
5046 desc.buffer + desc.buffer_size - desc.reloc_size, | 5047 desc.buffer + desc.buffer_size - desc.reloc_size, |
5047 desc.reloc_size); | 5048 desc.reloc_size); |
5048 | 5049 |
5049 // unbox handles and relocate | 5050 // unbox handles and relocate |
5050 int delta = instruction_start() - desc.buffer; | 5051 intptr_t delta = instruction_start() - desc.buffer; |
5051 int mode_mask = RelocInfo::kCodeTargetMask | | 5052 int mode_mask = RelocInfo::kCodeTargetMask | |
5052 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 5053 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
5053 RelocInfo::kApplyMask; | 5054 RelocInfo::kApplyMask; |
5054 Assembler* origin = desc.origin; // Needed to find target_object on X64. | 5055 Assembler* origin = desc.origin; // Needed to find target_object on X64. |
5055 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 5056 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
5056 RelocInfo::Mode mode = it.rinfo()->rmode(); | 5057 RelocInfo::Mode mode = it.rinfo()->rmode(); |
5057 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 5058 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
5058 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 5059 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
5059 it.rinfo()->set_target_object(*p); | 5060 it.rinfo()->set_target_object(*p); |
5060 } else if (RelocInfo::IsCodeTarget(mode)) { | 5061 } else if (RelocInfo::IsCodeTarget(mode)) { |
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7980 if (break_point_objects()->IsUndefined()) return 0; | 7981 if (break_point_objects()->IsUndefined()) return 0; |
7981 // Single beak point. | 7982 // Single beak point. |
7982 if (!break_point_objects()->IsFixedArray()) return 1; | 7983 if (!break_point_objects()->IsFixedArray()) return 1; |
7983 // Multiple break points. | 7984 // Multiple break points. |
7984 return FixedArray::cast(break_point_objects())->length(); | 7985 return FixedArray::cast(break_point_objects())->length(); |
7985 } | 7986 } |
7986 #endif | 7987 #endif |
7987 | 7988 |
7988 | 7989 |
7989 } } // namespace v8::internal | 7990 } } // namespace v8::internal |
OLD | NEW |