Title: [118966] trunk/Source/_javascript_Core
- Revision
- 118966
- Author
- [email protected]
- Date
- 2012-05-30 14:04:23 -0700 (Wed, 30 May 2012)
Log Message
ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
https://bugs.webkit.org/show_bug.cgi?id=87887
Reviewed by Darin Adler.
Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
* parser/Nodes.h:
(JSC::ScopeNode::sourceID):
* parser/SourceCode.h:
(JSC::SourceCode::providerID):
(SourceCode):
* parser/SourceProvider.h:
(SourceProvider):
(JSC::SourceProvider::asID):
* runtime/Executable.h:
(JSC::ScriptExecutable::sourceID):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (118965 => 118966)
--- trunk/Source/_javascript_Core/ChangeLog 2012-05-30 21:01:25 UTC (rev 118965)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-05-30 21:04:23 UTC (rev 118966)
@@ -3,6 +3,26 @@
ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
https://bugs.webkit.org/show_bug.cgi?id=87887
+ Reviewed by Darin Adler.
+
+ Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
+
+ * parser/Nodes.h:
+ (JSC::ScopeNode::sourceID):
+ * parser/SourceCode.h:
+ (JSC::SourceCode::providerID):
+ (SourceCode):
+ * parser/SourceProvider.h:
+ (SourceProvider):
+ (JSC::SourceProvider::asID):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::sourceID):
+
+2012-05-30 Filip Pizlo <[email protected]>
+
+ ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
+ https://bugs.webkit.org/show_bug.cgi?id=87887
+
Reviewed by Geoffrey Garen.
* parser/SourceProvider.h:
Modified: trunk/Source/_javascript_Core/parser/Nodes.h (118965 => 118966)
--- trunk/Source/_javascript_Core/parser/Nodes.h 2012-05-30 21:01:25 UTC (rev 118965)
+++ trunk/Source/_javascript_Core/parser/Nodes.h 2012-05-30 21:04:23 UTC (rev 118966)
@@ -1399,7 +1399,7 @@
const SourceCode& source() const { return m_source; }
const UString& sourceURL() const { return m_source.provider()->url(); }
- intptr_t sourceID() const { return m_source.provider()->asID(); }
+ intptr_t sourceID() const { return m_source.providerID(); }
void setFeatures(CodeFeatures features) { m_features = features; }
CodeFeatures features() { return m_features; }
Modified: trunk/Source/_javascript_Core/parser/SourceCode.h (118965 => 118966)
--- trunk/Source/_javascript_Core/parser/SourceCode.h 2012-05-30 21:01:25 UTC (rev 118965)
+++ trunk/Source/_javascript_Core/parser/SourceCode.h 2012-05-30 21:04:23 UTC (rev 118966)
@@ -67,6 +67,13 @@
return m_provider->getRange(m_startChar, m_endChar);
}
+ intptr_t providerID() const
+ {
+ if (!m_provider)
+ return SourceProvider::nullID;
+ return m_provider->asID();
+ }
+
bool isNull() const { return !m_provider; }
SourceProvider* provider() const { return m_provider.get(); }
int firstLine() const { return m_firstLine; }
Modified: trunk/Source/_javascript_Core/parser/SourceProvider.h (118965 => 118966)
--- trunk/Source/_javascript_Core/parser/SourceProvider.h 2012-05-30 21:01:25 UTC (rev 118965)
+++ trunk/Source/_javascript_Core/parser/SourceProvider.h 2012-05-30 21:04:23 UTC (rev 118966)
@@ -40,6 +40,8 @@
class SourceProvider : public RefCounted<SourceProvider> {
public:
+ static const intptr_t nullID = 1;
+
SourceProvider(const UString& url, const TextPosition& startPosition, SourceProviderCache* cache = 0)
: m_url(url)
, m_startPosition(startPosition)
@@ -63,8 +65,9 @@
TextPosition startPosition() const { return m_startPosition; }
intptr_t asID()
{
- if (!this)
- return 1;
+ ASSERT(this);
+ if (!this) // Be defensive in release mode.
+ return nullID;
return reinterpret_cast<intptr_t>(this);
}
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (118965 => 118966)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2012-05-30 21:01:25 UTC (rev 118965)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2012-05-30 21:04:23 UTC (rev 118966)
@@ -285,7 +285,7 @@
#endif
const SourceCode& source() { return m_source; }
- intptr_t sourceID() const { return m_source.provider()->asID(); }
+ intptr_t sourceID() const { return m_source.providerID(); }
const UString& sourceURL() const { return m_source.provider()->url(); }
int lineNo() const { return m_firstLine; }
int lastLine() const { return m_lastLine; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes