Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects.cc

Issue 77035: Add ENABLE_DEBUGGER_SUPPORT macro.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4643 matching lines...) Expand 10 before | Expand all | Expand 10 after
4654 4654
4655 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); 4655 for (RelocIterator it(this, RelocInfo::kCodeTargetMask);
4656 !it.done(); it.next()) { 4656 !it.done(); it.next()) {
4657 Address ic_addr = it.rinfo()->target_address(); 4657 Address ic_addr = it.rinfo()->target_address();
4658 ASSERT(ic_addr != NULL); 4658 ASSERT(ic_addr != NULL);
4659 HeapObject* code = HeapObject::FromAddress(ic_addr - Code::kHeaderSize); 4659 HeapObject* code = HeapObject::FromAddress(ic_addr - Code::kHeaderSize);
4660 ASSERT(code->IsHeapObject()); 4660 ASSERT(code->IsHeapObject());
4661 it.rinfo()->set_target_object(code); 4661 it.rinfo()->set_target_object(code);
4662 } 4662 }
4663 4663
4664 #ifdef ENABLE_DEBUGGER_SUPPORT
4664 if (Debug::has_break_points()) { 4665 if (Debug::has_break_points()) {
4665 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); 4666 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
4666 !it.done(); 4667 !it.done();
4667 it.next()) { 4668 it.next()) {
4668 if (it.rinfo()->IsCallInstruction()) { 4669 if (it.rinfo()->IsCallInstruction()) {
4669 Address addr = it.rinfo()->call_address(); 4670 Address addr = it.rinfo()->call_address();
4670 ASSERT(addr != NULL); 4671 ASSERT(addr != NULL);
4671 HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize); 4672 HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize);
4672 ASSERT(code->IsHeapObject()); 4673 ASSERT(code->IsHeapObject());
4673 it.rinfo()->set_call_object(code); 4674 it.rinfo()->set_call_object(code);
4674 } 4675 }
4675 } 4676 }
4676 } 4677 }
4678 #endif
4677 set_ic_flag(IC_TARGET_IS_OBJECT); 4679 set_ic_flag(IC_TARGET_IS_OBJECT);
4678 } 4680 }
4679 4681
4680 4682
4681 void Code::CodeIterateBody(ObjectVisitor* v) { 4683 void Code::CodeIterateBody(ObjectVisitor* v) {
4682 v->BeginCodeIteration(this); 4684 v->BeginCodeIteration(this);
4683 4685
4684 int mode_mask = RelocInfo::kCodeTargetMask | 4686 int mode_mask = RelocInfo::kCodeTargetMask |
4685 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 4687 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
4686 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | 4688 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
4687 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | 4689 RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
4688 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); 4690 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
4689 4691
4690 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 4692 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
4691 RelocInfo::Mode rmode = it.rinfo()->rmode(); 4693 RelocInfo::Mode rmode = it.rinfo()->rmode();
4692 if (rmode == RelocInfo::EMBEDDED_OBJECT) { 4694 if (rmode == RelocInfo::EMBEDDED_OBJECT) {
4693 v->VisitPointer(it.rinfo()->target_object_address()); 4695 v->VisitPointer(it.rinfo()->target_object_address());
4694 } else if (RelocInfo::IsCodeTarget(rmode)) { 4696 } else if (RelocInfo::IsCodeTarget(rmode)) {
4695 v->VisitCodeTarget(it.rinfo()); 4697 v->VisitCodeTarget(it.rinfo());
4696 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) { 4698 } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
4697 v->VisitExternalReference(it.rinfo()->target_reference_address()); 4699 v->VisitExternalReference(it.rinfo()->target_reference_address());
4700 #ifdef ENABLE_DEBUGGER_SUPPORT
4698 } else if (Debug::has_break_points() && 4701 } else if (Debug::has_break_points() &&
4699 RelocInfo::IsJSReturn(rmode) && 4702 RelocInfo::IsJSReturn(rmode) &&
4700 it.rinfo()->IsCallInstruction()) { 4703 it.rinfo()->IsCallInstruction()) {
4701 v->VisitDebugTarget(it.rinfo()); 4704 v->VisitDebugTarget(it.rinfo());
4705 #endif
4702 } else if (rmode == RelocInfo::RUNTIME_ENTRY) { 4706 } else if (rmode == RelocInfo::RUNTIME_ENTRY) {
4703 v->VisitRuntimeEntry(it.rinfo()); 4707 v->VisitRuntimeEntry(it.rinfo());
4704 } 4708 }
4705 } 4709 }
4706 4710
4707 ScopeInfo<>::IterateScopeInfo(this, v); 4711 ScopeInfo<>::IterateScopeInfo(this, v);
4708 4712
4709 v->EndCodeIteration(this); 4713 v->EndCodeIteration(this);
4710 } 4714 }
4711 4715
4712 4716
4713 void Code::ConvertICTargetsFromObjectToAddress() { 4717 void Code::ConvertICTargetsFromObjectToAddress() {
4714 ASSERT(ic_flag() == IC_TARGET_IS_OBJECT); 4718 ASSERT(ic_flag() == IC_TARGET_IS_OBJECT);
4715 4719
4716 for (RelocIterator it(this, RelocInfo::kCodeTargetMask); 4720 for (RelocIterator it(this, RelocInfo::kCodeTargetMask);
4717 !it.done(); it.next()) { 4721 !it.done(); it.next()) {
4718 // We cannot use the safe cast (Code::cast) here, because we may be in 4722 // We cannot use the safe cast (Code::cast) here, because we may be in
4719 // the middle of relocating old objects during GC and the map pointer in 4723 // the middle of relocating old objects during GC and the map pointer in
4720 // the code object may be mangled 4724 // the code object may be mangled
4721 Code* code = reinterpret_cast<Code*>(it.rinfo()->target_object()); 4725 Code* code = reinterpret_cast<Code*>(it.rinfo()->target_object());
4722 ASSERT((code != NULL) && code->IsHeapObject()); 4726 ASSERT((code != NULL) && code->IsHeapObject());
4723 it.rinfo()->set_target_address(code->instruction_start()); 4727 it.rinfo()->set_target_address(code->instruction_start());
4724 } 4728 }
4725 4729
4730 #ifdef ENABLE_DEBUGGER_SUPPORT
4726 if (Debug::has_break_points()) { 4731 if (Debug::has_break_points()) {
4727 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN)); 4732 for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
4728 !it.done(); 4733 !it.done();
4729 it.next()) { 4734 it.next()) {
4730 if (it.rinfo()->IsCallInstruction()) { 4735 if (it.rinfo()->IsCallInstruction()) {
4731 Code* code = reinterpret_cast<Code*>(it.rinfo()->call_object()); 4736 Code* code = reinterpret_cast<Code*>(it.rinfo()->call_object());
4732 ASSERT((code != NULL) && code->IsHeapObject()); 4737 ASSERT((code != NULL) && code->IsHeapObject());
4733 it.rinfo()->set_call_address(code->instruction_start()); 4738 it.rinfo()->set_call_address(code->instruction_start());
4734 } 4739 }
4735 } 4740 }
4736 } 4741 }
4742 #endif
4737 set_ic_flag(IC_TARGET_IS_ADDRESS); 4743 set_ic_flag(IC_TARGET_IS_ADDRESS);
4738 } 4744 }
4739 4745
4740 4746
4741 void Code::Relocate(int delta) { 4747 void Code::Relocate(int delta) {
4742 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 4748 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
4743 it.rinfo()->apply(delta); 4749 it.rinfo()->apply(delta);
4744 } 4750 }
4745 CPU::FlushICache(instruction_start(), instruction_size()); 4751 CPU::FlushICache(instruction_start(), instruction_size());
4746 } 4752 }
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after
7155 ASSERT(obj->IsJSObject()); 7161 ASSERT(obj->IsJSObject());
7156 7162
7157 descriptors->SetNextEnumerationIndex(NextEnumerationIndex()); 7163 descriptors->SetNextEnumerationIndex(NextEnumerationIndex());
7158 // Check that it really works. 7164 // Check that it really works.
7159 ASSERT(obj->HasFastProperties()); 7165 ASSERT(obj->HasFastProperties());
7160 7166
7161 return obj; 7167 return obj;
7162 } 7168 }
7163 7169
7164 7170
7171 #ifdef ENABLE_DEBUGGER_SUPPORT
7165 // Check if there is a break point at this code position. 7172 // Check if there is a break point at this code position.
7166 bool DebugInfo::HasBreakPoint(int code_position) { 7173 bool DebugInfo::HasBreakPoint(int code_position) {
7167 // Get the break point info object for this code position. 7174 // Get the break point info object for this code position.
7168 Object* break_point_info = GetBreakPointInfo(code_position); 7175 Object* break_point_info = GetBreakPointInfo(code_position);
7169 7176
7170 // If there is no break point info object or no break points in the break 7177 // If there is no break point info object or no break points in the break
7171 // point info object there is no break point at this code position. 7178 // point info object there is no break point at this code position.
7172 if (break_point_info->IsUndefined()) return false; 7179 if (break_point_info->IsUndefined()) return false;
7173 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0; 7180 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0;
7174 } 7181 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
7398 7405
7399 // Get the number of break points. 7406 // Get the number of break points.
7400 int BreakPointInfo::GetBreakPointCount() { 7407 int BreakPointInfo::GetBreakPointCount() {
7401 // No break point. 7408 // No break point.
7402 if (break_point_objects()->IsUndefined()) return 0; 7409 if (break_point_objects()->IsUndefined()) return 0;
7403 // Single beak point. 7410 // Single beak point.
7404 if (!break_point_objects()->IsFixedArray()) return 1; 7411 if (!break_point_objects()->IsFixedArray()) return 1;
7405 // Multiple break points. 7412 // Multiple break points.
7406 return FixedArray::cast(break_point_objects())->length(); 7413 return FixedArray::cast(break_point_objects())->length();
7407 } 7414 }
7408 7415 #endif
7409 7416
7410 } } // namespace v8::internal 7417 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | src/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698