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

Side by Side Diff: Source/core/inspector/JavaScriptCallFrame.cpp

Issue 466243002: Support merged Dart-JS callstacks (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: ptal Created 6 years, 3 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 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 { 67 {
68 v8::HandleScope handleScope(m_isolate); 68 v8::HandleScope handleScope(m_isolate);
69 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); 69 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
70 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, name))); 70 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, name)));
71 v8::Handle<v8::Value> result = func->Call(callFrame, 0, 0); 71 v8::Handle<v8::Value> result = func->Call(callFrame, 0, 0);
72 if (result->IsInt32()) 72 if (result->IsInt32())
73 return result->Int32Value(); 73 return result->Int32Value();
74 return 0; 74 return 0;
75 } 75 }
76 76
77 double JavaScriptCallFrame::callV8FunctionReturnDouble(const char* name) const
78 {
79 v8::HandleScope handleScope(m_isolate);
80 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
81 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, name)));
82 v8::Handle<v8::Value> result = func->Call(callFrame, 0, 0);
83 if (result->IsNumber())
84 return result->NumberValue();
85 return 0;
86 }
87
77 String JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const 88 String JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const
78 { 89 {
79 v8::HandleScope handleScope(m_isolate); 90 v8::HandleScope handleScope(m_isolate);
80 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); 91 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
81 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, name))); 92 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, name)));
82 v8::Handle<v8::Value> result = func->Call(callFrame, 0, 0); 93 v8::Handle<v8::Value> result = func->Call(callFrame, 0, 0);
83 return toCoreStringWithUndefinedOrNullCheck(result); 94 return toCoreStringWithUndefinedOrNullCheck(result);
84 } 95 }
85 96
86 int JavaScriptCallFrame::sourceID() const 97 int JavaScriptCallFrame::sourceID() const
87 { 98 {
88 return callV8FunctionReturnInt("sourceID"); 99 return callV8FunctionReturnInt("sourceID");
89 } 100 }
90 101
91 int JavaScriptCallFrame::line() const 102 int JavaScriptCallFrame::line() const
92 { 103 {
93 return callV8FunctionReturnInt("line"); 104 return callV8FunctionReturnInt("line");
94 } 105 }
95 106
96 int JavaScriptCallFrame::column() const 107 int JavaScriptCallFrame::column() const
97 { 108 {
98 return callV8FunctionReturnInt("column"); 109 return callV8FunctionReturnInt("column");
99 } 110 }
100 111
112 double JavaScriptCallFrame::framePointer() const
113 {
114 return callV8FunctionReturnDouble("framePointer");
115 }
116
101 String JavaScriptCallFrame::functionName() const 117 String JavaScriptCallFrame::functionName() const
102 { 118 {
103 return callV8FunctionReturnString("functionName"); 119 return callV8FunctionReturnString("functionName");
104 } 120 }
105 121
106 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const 122 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const
107 { 123 {
108 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); 124 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
109 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, "scopeChain"))); 125 v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(callFrame->Ge t(v8AtomicString(m_isolate, "scopeChain")));
110 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(func->Call(ca llFrame, 0, 0)); 126 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(func->Call(ca llFrame, 0, 0));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 }; 192 };
177 return ScriptValue(v8ScriptState, setVariableValueFunction->Call(callFrame, WTF_ARRAY_LENGTH(argv), argv)); 193 return ScriptValue(v8ScriptState, setVariableValueFunction->Call(callFrame, WTF_ARRAY_LENGTH(argv), argv));
178 } 194 }
179 195
180 void JavaScriptCallFrame::trace(Visitor* visitor) 196 void JavaScriptCallFrame::trace(Visitor* visitor)
181 { 197 {
182 visitor->trace(m_caller); 198 visitor->trace(m_caller);
183 } 199 }
184 200
185 } // namespace WebCore 201 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698