OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 4462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4473 } | 4473 } |
4474 | 4474 |
4475 | 4475 |
4476 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { | 4476 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { |
4477 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 4477 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
4478 VisitPointer(rinfo->target_object_address()); | 4478 VisitPointer(rinfo->target_object_address()); |
4479 } | 4479 } |
4480 | 4480 |
4481 | 4481 |
4482 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { | 4482 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { |
4483 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && rinfo->is_call_instruction()); | 4483 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && rinfo->IsCallInstruction()); |
4484 VisitPointer(rinfo->call_object_address()); | 4484 VisitPointer(rinfo->call_object_address()); |
4485 } | 4485 } |
4486 | 4486 |
4487 | 4487 |
4488 // Convert relocatable targets from address to code object address. This is | 4488 // Convert relocatable targets from address to code object address. This is |
4489 // mainly IC call targets but for debugging straight-line code can be replaced | 4489 // mainly IC call targets but for debugging straight-line code can be replaced |
4490 // with a call instruction which also has to be relocated. | 4490 // with a call instruction which also has to be relocated. |
4491 void Code::ConvertICTargetsFromAddressToObject() { | 4491 void Code::ConvertICTargetsFromAddressToObject() { |
4492 ASSERT(ic_flag() == IC_TARGET_IS_ADDRESS); | 4492 ASSERT(ic_flag() == IC_TARGET_IS_ADDRESS); |
4493 | 4493 |
4494 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); | 4494 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); |
4495 !it.done(); it.next()) { | 4495 !it.done(); it.next()) { |
4496 Address ic_addr = it.rinfo()->target_address(); | 4496 Address ic_addr = it.rinfo()->target_address(); |
4497 ASSERT(ic_addr != NULL); | 4497 ASSERT(ic_addr != NULL); |
4498 HeapObject* code = HeapObject::FromAddress(ic_addr - Code::kHeaderSize); | 4498 HeapObject* code = HeapObject::FromAddress(ic_addr - Code::kHeaderSize); |
4499 ASSERT(code->IsHeapObject()); | 4499 ASSERT(code->IsHeapObject()); |
4500 it.rinfo()->set_target_object(code); | 4500 it.rinfo()->set_target_object(code); |
4501 } | 4501 } |
4502 | 4502 |
4503 if (Debug::has_break_points()) { | 4503 if (Debug::has_break_points()) { |
4504 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); | 4504 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); |
4505 !it.done(); | 4505 !it.done(); |
4506 it.next()) { | 4506 it.next()) { |
4507 if (it.rinfo()->is_call_instruction()) { | 4507 if (it.rinfo()->IsCallInstruction()) { |
4508 Address addr = it.rinfo()->call_address(); | 4508 Address addr = it.rinfo()->call_address(); |
4509 ASSERT(addr != NULL); | 4509 ASSERT(addr != NULL); |
4510 HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize); | 4510 HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize); |
4511 ASSERT(code->IsHeapObject()); | 4511 ASSERT(code->IsHeapObject()); |
4512 it.rinfo()->set_call_object(code); | 4512 it.rinfo()->set_call_object(code); |
4513 } | 4513 } |
4514 } | 4514 } |
4515 } | 4515 } |
4516 set_ic_flag(IC_TARGET_IS_OBJECT); | 4516 set_ic_flag(IC_TARGET_IS_OBJECT); |
4517 } | 4517 } |
(...skipping 11 matching lines...) Expand all Loading... |
4529 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 4529 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
4530 RelocInfo::Mode rmode = it.rinfo()->rmode(); | 4530 RelocInfo::Mode rmode = it.rinfo()->rmode(); |
4531 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 4531 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
4532 v->VisitPointer(it.rinfo()->target_object_address()); | 4532 v->VisitPointer(it.rinfo()->target_object_address()); |
4533 } else if (RelocInfo::IsCodeTarget(rmode)) { | 4533 } else if (RelocInfo::IsCodeTarget(rmode)) { |
4534 v->VisitCodeTarget(it.rinfo()); | 4534 v->VisitCodeTarget(it.rinfo()); |
4535 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { | 4535 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
4536 v->VisitExternalReference(it.rinfo()->target_reference_address()); | 4536 v->VisitExternalReference(it.rinfo()->target_reference_address()); |
4537 } else if (Debug::has_break_points() && | 4537 } else if (Debug::has_break_points() && |
4538 RelocInfo::IsJSReturn(rmode) && | 4538 RelocInfo::IsJSReturn(rmode) && |
4539 it.rinfo()->is_call_instruction()) { | 4539 it.rinfo()->IsCallInstruction()) { |
4540 v->VisitDebugTarget(it.rinfo()); | 4540 v->VisitDebugTarget(it.rinfo()); |
4541 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { | 4541 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { |
4542 v->VisitRuntimeEntry(it.rinfo()); | 4542 v->VisitRuntimeEntry(it.rinfo()); |
4543 } | 4543 } |
4544 } | 4544 } |
4545 | 4545 |
4546 ScopeInfo<>::IterateScopeInfo(this, v); | 4546 ScopeInfo<>::IterateScopeInfo(this, v); |
4547 | 4547 |
4548 v->EndCodeIteration(this); | 4548 v->EndCodeIteration(this); |
4549 } | 4549 } |
4550 | 4550 |
4551 | 4551 |
4552 void Code::ConvertICTargetsFromObjectToAddress() { | 4552 void Code::ConvertICTargetsFromObjectToAddress() { |
4553 ASSERT(ic_flag() == IC_TARGET_IS_OBJECT); | 4553 ASSERT(ic_flag() == IC_TARGET_IS_OBJECT); |
4554 | 4554 |
4555 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); | 4555 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); |
4556 !it.done(); it.next()) { | 4556 !it.done(); it.next()) { |
4557 // We cannot use the safe cast (Code::cast) here, because we may be in | 4557 // We cannot use the safe cast (Code::cast) here, because we may be in |
4558 // the middle of relocating old objects during GC and the map pointer in | 4558 // the middle of relocating old objects during GC and the map pointer in |
4559 // the code object may be mangled | 4559 // the code object may be mangled |
4560 Code* code = reinterpret_cast<Code*>(it.rinfo()->target_object()); | 4560 Code* code = reinterpret_cast<Code*>(it.rinfo()->target_object()); |
4561 ASSERT((code != NULL) && code->IsHeapObject()); | 4561 ASSERT((code != NULL) && code->IsHeapObject()); |
4562 it.rinfo()->set_target_address(code->instruction_start()); | 4562 it.rinfo()->set_target_address(code->instruction_start()); |
4563 } | 4563 } |
4564 | 4564 |
4565 if (Debug::has_break_points()) { | 4565 if (Debug::has_break_points()) { |
4566 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); | 4566 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); |
4567 !it.done(); | 4567 !it.done(); |
4568 it.next()) { | 4568 it.next()) { |
4569 if (it.rinfo()->is_call_instruction()) { | 4569 if (it.rinfo()->IsCallInstruction()) { |
4570 Code* code = reinterpret_cast<Code*>(it.rinfo()->call_object()); | 4570 Code* code = reinterpret_cast<Code*>(it.rinfo()->call_object()); |
4571 ASSERT((code != NULL) && code->IsHeapObject()); | 4571 ASSERT((code != NULL) && code->IsHeapObject()); |
4572 it.rinfo()->set_call_address(code->instruction_start()); | 4572 it.rinfo()->set_call_address(code->instruction_start()); |
4573 } | 4573 } |
4574 } | 4574 } |
4575 } | 4575 } |
4576 set_ic_flag(IC_TARGET_IS_ADDRESS); | 4576 set_ic_flag(IC_TARGET_IS_ADDRESS); |
4577 } | 4577 } |
4578 | 4578 |
4579 | 4579 |
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7077 // No break point. | 7077 // No break point. |
7078 if (break_point_objects()->IsUndefined()) return 0; | 7078 if (break_point_objects()->IsUndefined()) return 0; |
7079 // Single beak point. | 7079 // Single beak point. |
7080 if (!break_point_objects()->IsFixedArray()) return 1; | 7080 if (!break_point_objects()->IsFixedArray()) return 1; |
7081 // Multiple break points. | 7081 // Multiple break points. |
7082 return FixedArray::cast(break_point_objects())->length(); | 7082 return FixedArray::cast(break_point_objects())->length(); |
7083 } | 7083 } |
7084 | 7084 |
7085 | 7085 |
7086 } } // namespace v8::internal | 7086 } } // namespace v8::internal |
OLD | NEW |