Skip to content

Commit d8fa972

Browse files
Remove #include "isolate-inl.h" from v8.h.
Include it only in the .cc files where it's needed. [email protected] BUG= TEST= Review URL: http://codereview.chromium.org/8117001 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@9506 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent a2b63d8 commit d8fa972

16 files changed

+212
-132
lines changed

src/bootstrapper.cc

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "debug.h"
3535
#include "execution.h"
3636
#include "global-handles.h"
37+
#include "isolate-inl.h"
3738
#include "macro-assembler.h"
3839
#include "natives.h"
3940
#include "objects-visiting.h"

src/code-stubs.cc

+5
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ const char* CodeStub::MajorName(CodeStub::Major major_key,
195195
}
196196

197197

198+
void CodeStub::PrintName(StringStream* stream) {
199+
stream->Add("%s", MajorName(MajorKey(), false));
200+
}
201+
202+
198203
int ICCompareStub::MinorKey() {
199204
return OpField::encode(op_ - Token::EQ) | StateField::encode(state_);
200205
}

src/code-stubs.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ class CodeStub BASE_EMBEDDED {
202202

203203
// Returns a name for logging/debugging purposes.
204204
SmartArrayPointer<const char> GetName();
205-
virtual void PrintName(StringStream* stream) {
206-
stream->Add("%s", MajorName(MajorKey(), false));
207-
}
205+
virtual void PrintName(StringStream* stream);
208206

209207
// Returns whether the code generated for this stub needs to be allocated as
210208
// a fixed (non-moveable) code object.

src/compiler.cc

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "full-codegen.h"
3737
#include "gdb-jit.h"
3838
#include "hydrogen.h"
39+
#include "isolate-inl.h"
3940
#include "lithium.h"
4041
#include "liveedit.h"
4142
#include "parser.h"

src/debug.cc

+89
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "global-handles.h"
4141
#include "ic.h"
4242
#include "ic-inl.h"
43+
#include "isolate-inl.h"
4344
#include "list.h"
4445
#include "messages.h"
4546
#include "natives.h"
@@ -2937,6 +2938,94 @@ void Debugger::CallMessageDispatchHandler() {
29372938
}
29382939

29392940

2941+
EnterDebugger::EnterDebugger()
2942+
: isolate_(Isolate::Current()),
2943+
prev_(isolate_->debug()->debugger_entry()),
2944+
it_(isolate_),
2945+
has_js_frames_(!it_.done()),
2946+
save_(isolate_) {
2947+
Debug* debug = isolate_->debug();
2948+
ASSERT(prev_ != NULL || !debug->is_interrupt_pending(PREEMPT));
2949+
ASSERT(prev_ != NULL || !debug->is_interrupt_pending(DEBUGBREAK));
2950+
2951+
// Link recursive debugger entry.
2952+
debug->set_debugger_entry(this);
2953+
2954+
// Store the previous break id and frame id.
2955+
break_id_ = debug->break_id();
2956+
break_frame_id_ = debug->break_frame_id();
2957+
2958+
// Create the new break info. If there is no JavaScript frames there is no
2959+
// break frame id.
2960+
if (has_js_frames_) {
2961+
debug->NewBreak(it_.frame()->id());
2962+
} else {
2963+
debug->NewBreak(StackFrame::NO_ID);
2964+
}
2965+
2966+
// Make sure that debugger is loaded and enter the debugger context.
2967+
load_failed_ = !debug->Load();
2968+
if (!load_failed_) {
2969+
// NOTE the member variable save which saves the previous context before
2970+
// this change.
2971+
isolate_->set_context(*debug->debug_context());
2972+
}
2973+
}
2974+
2975+
2976+
EnterDebugger::~EnterDebugger() {
2977+
ASSERT(Isolate::Current() == isolate_);
2978+
Debug* debug = isolate_->debug();
2979+
2980+
// Restore to the previous break state.
2981+
debug->SetBreak(break_frame_id_, break_id_);
2982+
2983+
// Check for leaving the debugger.
2984+
if (prev_ == NULL) {
2985+
// Clear mirror cache when leaving the debugger. Skip this if there is a
2986+
// pending exception as clearing the mirror cache calls back into
2987+
// JavaScript. This can happen if the v8::Debug::Call is used in which
2988+
// case the exception should end up in the calling code.
2989+
if (!isolate_->has_pending_exception()) {
2990+
// Try to avoid any pending debug break breaking in the clear mirror
2991+
// cache JavaScript code.
2992+
if (isolate_->stack_guard()->IsDebugBreak()) {
2993+
debug->set_interrupts_pending(DEBUGBREAK);
2994+
isolate_->stack_guard()->Continue(DEBUGBREAK);
2995+
}
2996+
debug->ClearMirrorCache();
2997+
}
2998+
2999+
// Request preemption and debug break when leaving the last debugger entry
3000+
// if any of these where recorded while debugging.
3001+
if (debug->is_interrupt_pending(PREEMPT)) {
3002+
// This re-scheduling of preemption is to avoid starvation in some
3003+
// debugging scenarios.
3004+
debug->clear_interrupt_pending(PREEMPT);
3005+
isolate_->stack_guard()->Preempt();
3006+
}
3007+
if (debug->is_interrupt_pending(DEBUGBREAK)) {
3008+
debug->clear_interrupt_pending(DEBUGBREAK);
3009+
isolate_->stack_guard()->DebugBreak();
3010+
}
3011+
3012+
// If there are commands in the queue when leaving the debugger request
3013+
// that these commands are processed.
3014+
if (isolate_->debugger()->HasCommands()) {
3015+
isolate_->stack_guard()->DebugCommand();
3016+
}
3017+
3018+
// If leaving the debugger with the debugger no longer active unload it.
3019+
if (!isolate_->debugger()->IsDebuggerActive()) {
3020+
isolate_->debugger()->UnloadDebugger();
3021+
}
3022+
}
3023+
3024+
// Leaving this debugger entry.
3025+
debug->set_debugger_entry(prev_);
3026+
}
3027+
3028+
29403029
MessageImpl MessageImpl::NewEvent(DebugEvent event,
29413030
bool running,
29423031
Handle<JSObject> exec_state,

src/debug.h

+2-85
Original file line numberDiff line numberDiff line change
@@ -869,91 +869,8 @@ class Debugger {
869869
// some reason could not be entered FailedToEnter will return true.
870870
class EnterDebugger BASE_EMBEDDED {
871871
public:
872-
EnterDebugger()
873-
: isolate_(Isolate::Current()),
874-
prev_(isolate_->debug()->debugger_entry()),
875-
it_(isolate_),
876-
has_js_frames_(!it_.done()),
877-
save_(isolate_) {
878-
Debug* debug = isolate_->debug();
879-
ASSERT(prev_ != NULL || !debug->is_interrupt_pending(PREEMPT));
880-
ASSERT(prev_ != NULL || !debug->is_interrupt_pending(DEBUGBREAK));
881-
882-
// Link recursive debugger entry.
883-
debug->set_debugger_entry(this);
884-
885-
// Store the previous break id and frame id.
886-
break_id_ = debug->break_id();
887-
break_frame_id_ = debug->break_frame_id();
888-
889-
// Create the new break info. If there is no JavaScript frames there is no
890-
// break frame id.
891-
if (has_js_frames_) {
892-
debug->NewBreak(it_.frame()->id());
893-
} else {
894-
debug->NewBreak(StackFrame::NO_ID);
895-
}
896-
897-
// Make sure that debugger is loaded and enter the debugger context.
898-
load_failed_ = !debug->Load();
899-
if (!load_failed_) {
900-
// NOTE the member variable save which saves the previous context before
901-
// this change.
902-
isolate_->set_context(*debug->debug_context());
903-
}
904-
}
905-
906-
~EnterDebugger() {
907-
ASSERT(Isolate::Current() == isolate_);
908-
Debug* debug = isolate_->debug();
909-
910-
// Restore to the previous break state.
911-
debug->SetBreak(break_frame_id_, break_id_);
912-
913-
// Check for leaving the debugger.
914-
if (prev_ == NULL) {
915-
// Clear mirror cache when leaving the debugger. Skip this if there is a
916-
// pending exception as clearing the mirror cache calls back into
917-
// JavaScript. This can happen if the v8::Debug::Call is used in which
918-
// case the exception should end up in the calling code.
919-
if (!isolate_->has_pending_exception()) {
920-
// Try to avoid any pending debug break breaking in the clear mirror
921-
// cache JavaScript code.
922-
if (isolate_->stack_guard()->IsDebugBreak()) {
923-
debug->set_interrupts_pending(DEBUGBREAK);
924-
isolate_->stack_guard()->Continue(DEBUGBREAK);
925-
}
926-
debug->ClearMirrorCache();
927-
}
928-
929-
// Request preemption and debug break when leaving the last debugger entry
930-
// if any of these where recorded while debugging.
931-
if (debug->is_interrupt_pending(PREEMPT)) {
932-
// This re-scheduling of preemption is to avoid starvation in some
933-
// debugging scenarios.
934-
debug->clear_interrupt_pending(PREEMPT);
935-
isolate_->stack_guard()->Preempt();
936-
}
937-
if (debug->is_interrupt_pending(DEBUGBREAK)) {
938-
debug->clear_interrupt_pending(DEBUGBREAK);
939-
isolate_->stack_guard()->DebugBreak();
940-
}
941-
942-
// If there are commands in the queue when leaving the debugger request
943-
// that these commands are processed.
944-
if (isolate_->debugger()->HasCommands()) {
945-
isolate_->stack_guard()->DebugCommand();
946-
}
947-
948-
// If leaving the debugger with the debugger no longer active unload it.
949-
if (!isolate_->debugger()->IsDebuggerActive()) {
950-
isolate_->debugger()->UnloadDebugger();
951-
}
952-
}
953-
954-
// Leaving this debugger entry.
955-
debug->set_debugger_entry(prev_);
956-
}
872+
EnterDebugger();
873+
~EnterDebugger();
957874

958875
// Check whether the debugger could be entered.
959876
inline bool FailedToEnter() { return load_failed_; }

src/execution.cc

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "bootstrapper.h"
3434
#include "codegen.h"
3535
#include "debug.h"
36+
#include "isolate-inl.h"
3637
#include "runtime-profiler.h"
3738
#include "simulator.h"
3839
#include "v8threads.h"

src/frames-inl.h

+65
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ inline StackHandler* StackHandler::FromAddress(Address address) {
7777
}
7878

7979

80+
inline bool StackHandler::is_entry() const {
81+
return state() == ENTRY;
82+
}
83+
84+
85+
inline bool StackHandler::is_try_catch() const {
86+
return state() == TRY_CATCH;
87+
}
88+
89+
90+
inline bool StackHandler::is_try_finally() const {
91+
return state() == TRY_FINALLY;
92+
}
93+
94+
8095
inline StackHandler::State StackHandler::state() const {
8196
const int offset = StackHandlerConstants::kStateOffset;
8297
return static_cast<State>(Memory::int_at(address() + offset));
@@ -105,11 +120,36 @@ inline StackHandler* StackFrame::top_handler() const {
105120
}
106121

107122

123+
inline Code* StackFrame::LookupCode() const {
124+
return GetContainingCode(isolate(), pc());
125+
}
126+
127+
108128
inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) {
109129
return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
110130
}
111131

112132

133+
inline EntryFrame::EntryFrame(StackFrameIterator* iterator)
134+
: StackFrame(iterator) {
135+
}
136+
137+
138+
inline EntryConstructFrame::EntryConstructFrame(StackFrameIterator* iterator)
139+
: EntryFrame(iterator) {
140+
}
141+
142+
143+
inline ExitFrame::ExitFrame(StackFrameIterator* iterator)
144+
: StackFrame(iterator) {
145+
}
146+
147+
148+
inline StandardFrame::StandardFrame(StackFrameIterator* iterator)
149+
: StackFrame(iterator) {
150+
}
151+
152+
113153
inline Object* StandardFrame::GetExpression(int index) const {
114154
return Memory::Object_at(GetExpressionAddress(index));
115155
}
@@ -155,6 +195,11 @@ inline bool StandardFrame::IsConstructFrame(Address fp) {
155195
}
156196

157197

198+
inline JavaScriptFrame::JavaScriptFrame(StackFrameIterator* iterator)
199+
: StandardFrame(iterator) {
200+
}
201+
202+
158203
Address JavaScriptFrame::GetParameterSlot(int index) const {
159204
int param_count = ComputeParametersCount();
160205
ASSERT(-1 <= index && index < param_count);
@@ -190,6 +235,26 @@ inline Object* JavaScriptFrame::function() const {
190235
}
191236

192237

238+
inline OptimizedFrame::OptimizedFrame(StackFrameIterator* iterator)
239+
: JavaScriptFrame(iterator) {
240+
}
241+
242+
243+
inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame(
244+
StackFrameIterator* iterator) : JavaScriptFrame(iterator) {
245+
}
246+
247+
248+
inline InternalFrame::InternalFrame(StackFrameIterator* iterator)
249+
: StandardFrame(iterator) {
250+
}
251+
252+
253+
inline ConstructFrame::ConstructFrame(StackFrameIterator* iterator)
254+
: InternalFrame(iterator) {
255+
}
256+
257+
193258
template<typename Iterator>
194259
inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
195260
Isolate* isolate)

src/frames.cc

+5
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,11 @@ void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) {
888888
}
889889

890890

891+
int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
892+
return Smi::cast(GetExpression(0))->value();
893+
}
894+
895+
891896
Address ArgumentsAdaptorFrame::GetCallerStackPointer() const {
892897
return fp() + StandardFrameConstants::kCallerSPOffset;
893898
}

0 commit comments

Comments
 (0)