зеркало из https://github.com/mozilla/gecko-dev.git
Merging cedar with mozilla-central.
This commit is contained in:
Коммит
f74ab87984
|
@ -313,8 +313,8 @@ AccHideEvent::
|
|||
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
|
||||
{
|
||||
mParent = mAccessible->GetParent();
|
||||
mNextSibling = mAccessible->GetCachedNextSibling();
|
||||
mPrevSibling = mAccessible->GetCachedPrevSibling();
|
||||
mNextSibling = mAccessible->NextSibling();
|
||||
mPrevSibling = mAccessible->PrevSibling();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
|||
return;
|
||||
}
|
||||
|
||||
nsAccessible* parentPrevSibling = parent->GetSiblingAtOffset(-1);
|
||||
nsAccessible* parentPrevSibling = parent->PrevSibling();
|
||||
if (!parentPrevSibling)
|
||||
return;
|
||||
|
||||
|
@ -162,7 +162,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
|
|||
// although the text does not appear to be rendered, GetRenderedText()
|
||||
// says that it is so we need to skip past it to find the true
|
||||
// previous sibling.
|
||||
parentPrevSibling = parentPrevSibling->GetSiblingAtOffset(-1);
|
||||
parentPrevSibling = parentPrevSibling->PrevSibling();
|
||||
if (parentPrevSibling)
|
||||
parentPrevSiblingRole = parentPrevSibling->Role();
|
||||
}
|
||||
|
|
|
@ -450,6 +450,10 @@ NS_IMETHODIMP
|
|||
nsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNextSibling);
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_IF_ADDREF(*aNextSibling = GetSiblingAtOffset(1, &rv));
|
||||
|
@ -461,6 +465,10 @@ NS_IMETHODIMP
|
|||
nsAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPreviousSibling);
|
||||
*aPreviousSibling = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_IF_ADDREF(*aPreviousSibling = GetSiblingAtOffset(-1, &rv));
|
||||
|
@ -603,7 +611,7 @@ nsresult nsAccessible::GetFullKeyName(const nsAString& aModifierName, const nsAS
|
|||
if (!gKeyStringBundle ||
|
||||
NS_FAILED(gKeyStringBundle->GetStringFromName(PromiseFlatString(aModifierName).get(),
|
||||
getter_Copies(modifierName))) ||
|
||||
NS_FAILED(gKeyStringBundle->GetStringFromName(PromiseFlatString(NS_LITERAL_STRING("MODIFIER_SEPARATOR")).get(),
|
||||
NS_FAILED(gKeyStringBundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(),
|
||||
getter_Copies(separator)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -3166,39 +3174,21 @@ nsAccessible::EnsureChildren()
|
|||
}
|
||||
|
||||
nsAccessible*
|
||||
nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
|
||||
nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError) const
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsAccessible *parent = GetParent();
|
||||
if (!parent) {
|
||||
if (!mParent || mIndexInParent == -1) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (mIndexInParent == -1) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (aError && mIndexInParent + aOffset >= mParent->GetChildCount()) {
|
||||
*aError = NS_OK; // fail peacefully
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError) {
|
||||
PRInt32 childCount = parent->GetChildCount();
|
||||
if (mIndexInParent + aOffset >= childCount) {
|
||||
*aError = NS_OK; // fail peacefully
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsAccessible* child = parent->GetChildAt(mIndexInParent + aOffset);
|
||||
nsAccessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
|
||||
if (aError && !child)
|
||||
*aError = NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
|
|
@ -304,6 +304,14 @@ public:
|
|||
*/
|
||||
PRBool HasChildren() { return !!GetChildAt(0); }
|
||||
|
||||
/**
|
||||
* Return next/previous sibling of the accessible.
|
||||
*/
|
||||
inline nsAccessible* NextSibling() const
|
||||
{ return GetSiblingAtOffset(1); }
|
||||
inline nsAccessible* PrevSibling() const
|
||||
{ return GetSiblingAtOffset(-1); }
|
||||
|
||||
/**
|
||||
* Return embedded accessible children count.
|
||||
*/
|
||||
|
@ -320,22 +328,23 @@ public:
|
|||
PRInt32 GetIndexOfEmbeddedChild(nsAccessible* aChild);
|
||||
|
||||
/**
|
||||
* Return cached accessible of parent-child relatives.
|
||||
* Return number of content children/content child at index. The content
|
||||
* child is created from markup in contrast to it's never constructed by its
|
||||
* parent accessible (like treeitem accessibles for XUL trees).
|
||||
*/
|
||||
PRUint32 ContentChildCount() const { return mChildren.Length(); }
|
||||
nsAccessible* ContentChildAt(PRUint32 aIndex) const
|
||||
{ return mChildren.ElementAt(aIndex); }
|
||||
|
||||
/**
|
||||
* Return true if children were initialized.
|
||||
*/
|
||||
nsAccessible* GetCachedNextSibling() const
|
||||
{
|
||||
return mParent ?
|
||||
mParent->mChildren.SafeElementAt(mIndexInParent + 1, nsnull).get() : nsnull;
|
||||
}
|
||||
nsAccessible* GetCachedPrevSibling() const
|
||||
{
|
||||
return mParent ?
|
||||
mParent->mChildren.SafeElementAt(mIndexInParent - 1, nsnull).get() : nsnull;
|
||||
}
|
||||
PRUint32 GetCachedChildCount() const { return mChildren.Length(); }
|
||||
nsAccessible* GetCachedChildAt(PRUint32 aIndex) const { return mChildren.ElementAt(aIndex); }
|
||||
inline bool AreChildrenCached() const
|
||||
{ return !IsChildrenFlag(eChildrenUninitialized); }
|
||||
|
||||
/**
|
||||
* Return true if the accessible is attached to tree.
|
||||
*/
|
||||
bool IsBoundToParent() const { return !!mParent; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -503,7 +512,7 @@ protected:
|
|||
* Return sibling accessible at the given offset.
|
||||
*/
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
nsresult *aError = nsnull) const;
|
||||
|
||||
/**
|
||||
* Flags used to describe the state and type of children.
|
||||
|
|
|
@ -428,15 +428,9 @@ nsApplicationAccessible::CacheChildren()
|
|||
}
|
||||
|
||||
nsAccessible*
|
||||
nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
|
||||
nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError) const
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ protected:
|
|||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
nsresult *aError = nsnull) const;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIXULAppInfo> mAppInfo;
|
||||
|
|
|
@ -1919,9 +1919,12 @@ nsDocAccessible::CacheChildrenInSubtree(nsAccessible* aRoot)
|
|||
{
|
||||
aRoot->EnsureChildren();
|
||||
|
||||
PRUint32 count = aRoot->GetChildCount();
|
||||
for (PRUint32 idx = 0; idx < count; idx++) {
|
||||
nsAccessible* child = aRoot->GetChildAt(idx);
|
||||
// Make sure we create accessible tree defined in DOM only, i.e. if accessible
|
||||
// provides specific tree (like XUL trees) then tree creation is handled by
|
||||
// this accessible.
|
||||
PRUint32 count = aRoot->ContentChildCount();
|
||||
for (PRUint32 idx = 0; idx < count; idx++) {
|
||||
nsAccessible* child = aRoot->ContentChildAt(idx);
|
||||
NS_ASSERTION(child, "Illicit tree change while tree is created!");
|
||||
// Don't cross document boundaries.
|
||||
if (child && child->IsContent())
|
||||
|
@ -1935,9 +1938,9 @@ nsDocAccessible::UncacheChildrenInSubtree(nsAccessible* aRoot)
|
|||
if (aRoot->IsElement())
|
||||
RemoveDependentIDsFor(aRoot);
|
||||
|
||||
PRUint32 count = aRoot->GetCachedChildCount();
|
||||
PRUint32 count = aRoot->ContentChildCount();
|
||||
for (PRUint32 idx = 0; idx < count; idx++)
|
||||
UncacheChildrenInSubtree(aRoot->GetCachedChildAt(idx));
|
||||
UncacheChildrenInSubtree(aRoot->ContentChildAt(idx));
|
||||
|
||||
if (aRoot->IsPrimaryForNode() &&
|
||||
mNodeToAccessibleMap.Get(aRoot->GetNode()) == aRoot)
|
||||
|
@ -1951,9 +1954,9 @@ nsDocAccessible::ShutdownChildrenInSubtree(nsAccessible* aAccessible)
|
|||
// child gets shutdown then it removes itself from children array of its
|
||||
//parent. Use jdx index to process the cases if child is not attached to the
|
||||
// parent and as result doesn't remove itself from its children.
|
||||
PRUint32 count = aAccessible->GetCachedChildCount();
|
||||
PRUint32 count = aAccessible->ContentChildCount();
|
||||
for (PRUint32 idx = 0, jdx = 0; idx < count; idx++) {
|
||||
nsAccessible* child = aAccessible->GetCachedChildAt(jdx);
|
||||
nsAccessible* child = aAccessible->ContentChildAt(jdx);
|
||||
if (!child->IsBoundToParent()) {
|
||||
NS_ERROR("Parent refers to a child, child doesn't refer to parent!");
|
||||
jdx++;
|
||||
|
|
|
@ -971,7 +971,7 @@ nsXULTreeItemAccessibleBase::NativeState()
|
|||
PRInt32
|
||||
nsXULTreeItemAccessibleBase::GetIndexInParent() const
|
||||
{
|
||||
return mParent ? mParent->GetCachedChildCount() + mRow : -1;
|
||||
return mParent ? mParent->ContentChildCount() + mRow : -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1008,15 +1008,8 @@ nsXULTreeItemAccessibleBase::DispatchClickEvent(nsIContent *aContent,
|
|||
|
||||
nsAccessible*
|
||||
nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
nsresult* aError) const
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
|
@ -1172,20 +1165,13 @@ nsXULTreeColumnsAccessible::
|
|||
|
||||
nsAccessible*
|
||||
nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
nsresult* aError) const
|
||||
{
|
||||
if (aOffset < 0)
|
||||
return nsXULColumnsAccessible::GetSiblingAtOffset(aOffset, aError);
|
||||
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
nsCOMPtr<nsITreeBoxObject> tree = nsCoreUtils::GetTreeBoxObject(mContent);
|
||||
if (tree) {
|
||||
|
@ -1195,7 +1181,7 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
|||
PRInt32 rowCount = 0;
|
||||
treeView->GetRowCount(&rowCount);
|
||||
if (rowCount > 0 && aOffset <= rowCount) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(GetParent());
|
||||
|
||||
if (treeAcc)
|
||||
return treeAcc->GetTreeItemAccessible(aOffset - 1);
|
||||
|
|
|
@ -235,7 +235,7 @@ protected:
|
|||
// nsAccessible
|
||||
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
nsresult *aError = nsnull) const;
|
||||
|
||||
// nsXULTreeItemAccessibleBase
|
||||
|
||||
|
@ -299,7 +299,7 @@ protected:
|
|||
|
||||
// nsAccessible
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
nsresult *aError = nsnull) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1244,17 +1244,10 @@ nsXULTreeGridCellAccessible::CellInvalidated()
|
|||
|
||||
nsAccessible*
|
||||
nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult* aError)
|
||||
nsresult* aError) const
|
||||
{
|
||||
if (IsDefunct()) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK; // fail peacefully
|
||||
*aError = NS_OK; // fail peacefully
|
||||
|
||||
nsCOMPtr<nsITreeColumn> columnAtOffset(mColumn), column;
|
||||
if (aOffset < 0) {
|
||||
|
@ -1272,8 +1265,7 @@ nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
|||
if (!columnAtOffset)
|
||||
return nsnull;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(mParent);
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(GetParent());
|
||||
return rowAcc->GetCellAccessible(columnAtOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
protected:
|
||||
// nsAccessible
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
nsresult *aError = nsnull) const;
|
||||
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
|
||||
|
||||
// nsXULTreeGridCellAccessible
|
||||
|
|
|
@ -1334,9 +1334,9 @@
|
|||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
|
||||
try {
|
||||
b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData);
|
||||
|
||||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
catch (ex) { }
|
||||
}
|
||||
|
||||
// We start our browsers out as inactive, and then maintain
|
||||
|
|
|
@ -18,12 +18,27 @@ function test() {
|
|||
waitForExplicitFinish();
|
||||
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
|
||||
run_test_1();
|
||||
nextTest();
|
||||
}
|
||||
|
||||
function run_test_1() {
|
||||
load("about:config", function() {
|
||||
let urls = [
|
||||
"about:config",
|
||||
"about:addons",
|
||||
"about:permissions"
|
||||
];
|
||||
|
||||
function nextTest() {
|
||||
let url = urls.shift();
|
||||
if (url) {
|
||||
testFindDisabled(url, nextTest);
|
||||
} else {
|
||||
// Make sure the find bar is re-enabled after disabled page is closed.
|
||||
testFindEnabled("about:blank", finish);
|
||||
}
|
||||
}
|
||||
|
||||
function testFindDisabled(url, cb) {
|
||||
load(url, function() {
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
|
@ -33,31 +48,16 @@ function run_test_1() {
|
|||
"Find command should be disabled");
|
||||
|
||||
gBrowser.removeTab(gTab);
|
||||
run_test_2();
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
function run_test_2() {
|
||||
load("about:addons", function() {
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
EventUtils.synthesizeKey("f", { accelKey: true });
|
||||
ok(gFindBar.hidden, "Find bar should not be visible");
|
||||
ok(document.getElementById("cmd_find").getAttribute("disabled"),
|
||||
"Find command should be disabled");
|
||||
|
||||
gBrowser.removeTab(gTab);
|
||||
run_test_3();
|
||||
});
|
||||
}
|
||||
|
||||
function run_test_3() {
|
||||
load("about:blank", function() {
|
||||
function testFindEnabled(url, cb) {
|
||||
load(url, function() {
|
||||
ok(!document.getElementById("cmd_find").getAttribute("disabled"),
|
||||
"Find command should not be disabled");
|
||||
|
||||
gBrowser.removeTab(gTab);
|
||||
finish();
|
||||
cb();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -690,13 +690,8 @@ let AboutPermissions = {
|
|||
*/
|
||||
updatePermission: function(aType) {
|
||||
let allowItem = document.getElementById(aType + "-" + PermissionDefaults.ALLOW);
|
||||
if (!this._selectedSite &&
|
||||
this._noGlobalAllow.indexOf(aType) != -1) {
|
||||
allowItem.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
allowItem.hidden = false;
|
||||
allowItem.hidden = !this._selectedSite &&
|
||||
this._noGlobalAllow.indexOf(aType) != -1;
|
||||
|
||||
let permissionMenulist = document.getElementById(aType + "-menulist");
|
||||
let permissionValue;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
id="permissions-page" title="&permissionsManager.title;"
|
||||
onload="AboutPermissions.init();"
|
||||
onunload="AboutPermissions.cleanUp();"
|
||||
disablefastfind="true"
|
||||
role="application">
|
||||
|
||||
<script type="application/javascript"
|
||||
|
@ -163,7 +164,7 @@
|
|||
</menupopup>
|
||||
</menulist>
|
||||
<button id="cookies-clear-all-button"
|
||||
label="&cookie.clearAll;"
|
||||
label="&cookie.removeAll;"
|
||||
oncommand="Services.cookies.removeAll();"/>
|
||||
<button id="cookies-manage-all-button"
|
||||
label="&cookie.manage;"
|
||||
|
@ -172,7 +173,7 @@
|
|||
<hbox id="cookies-count" align="center">
|
||||
<label id="cookies-label"/>
|
||||
<button id="cookies-clear-button"
|
||||
label="&cookie.clear;"
|
||||
label="&cookie.remove;"
|
||||
oncommand="AboutPermissions.clearCookies();"/>
|
||||
<button id="cookies-manage-button"
|
||||
label="&cookie.manage;"
|
||||
|
|
|
@ -25,6 +25,11 @@ const TEST_PERMS = {
|
|||
"popup": PERM_DENY
|
||||
};
|
||||
|
||||
const NO_GLOBAL_ALLOW = [
|
||||
"geo",
|
||||
"indexedDB"
|
||||
];
|
||||
|
||||
// number of managed permissions in the interface
|
||||
const TEST_PERMS_COUNT = 5;
|
||||
|
||||
|
@ -143,6 +148,12 @@ var tests = [
|
|||
ok(gBrowser.contentDocument.getElementById("cookies-count").hidden,
|
||||
"cookies count is hidden");
|
||||
|
||||
// Test to make sure "Allow" items hidden for certain permission types
|
||||
NO_GLOBAL_ALLOW.forEach(function(aType) {
|
||||
let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
|
||||
ok(menuitem.hidden, aType + " allow menuitem hidden for all sites");
|
||||
});
|
||||
|
||||
runNextTest();
|
||||
},
|
||||
|
||||
|
@ -195,6 +206,12 @@ var tests = [
|
|||
ok(!gBrowser.contentDocument.getElementById("cookies-count").hidden,
|
||||
"cookies count is not hidden");
|
||||
|
||||
// Test to make sure "Allow" items are *not* hidden for certain permission types
|
||||
NO_GLOBAL_ALLOW.forEach(function(aType) {
|
||||
let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
|
||||
ok(!menuitem.hidden, aType + " allow menuitem not hidden for single site");
|
||||
});
|
||||
|
||||
runNextTest();
|
||||
},
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
<!ENTITY password.manage "Manage Passwords…">
|
||||
|
||||
<!ENTITY cookie.label "Set Cookies">
|
||||
<!ENTITY cookie.clear "Clear Cookies">
|
||||
<!ENTITY cookie.remove "Remove Cookies">
|
||||
<!ENTITY cookie.manage "Manage Cookies…">
|
||||
<!ENTITY cookie.clearAll "Clear All Cookies">
|
||||
<!ENTITY cookie.removeAll "Remove All Cookies">
|
||||
|
||||
<!ENTITY geo.label "Share Location">
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ void ParseSize(PRInt64 aSize, PRInt64& aStart, PRInt64& aEnd);
|
|||
|
||||
class nsDOMFile : public nsIDOMFile,
|
||||
public nsIXHRSendable,
|
||||
public nsICharsetDetectionObserver,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
|
@ -100,9 +99,6 @@ public:
|
|||
|
||||
virtual ~nsDOMFile() {}
|
||||
|
||||
// from nsICharsetDetectionObserver
|
||||
NS_IMETHOD Notify(const char *aCharset, nsDetectionConfident aConf);
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(nsISupports* aOwner,
|
||||
JSContext* aCx,
|
||||
|
@ -124,13 +120,6 @@ protected:
|
|||
nsString mContentType;
|
||||
|
||||
bool mIsFullFile;
|
||||
|
||||
// Used during charset detection
|
||||
nsCString mCharset;
|
||||
nsresult GuessCharset(nsIInputStream *aStream,
|
||||
nsACString &aCharset);
|
||||
nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
|
||||
nsAString &aResult);
|
||||
};
|
||||
|
||||
class nsDOMMemoryFile : public nsDOMFile
|
||||
|
|
|
@ -63,7 +63,7 @@ interface nsIDOMBlob : nsISupports
|
|||
[optional] in DOMString contentType);
|
||||
};
|
||||
|
||||
[scriptable, uuid(91c9ebd9-2a4a-4a38-9412-ef492a2799be)]
|
||||
[scriptable, uuid(b096ef67-7b77-47f8-8e70-5d8ee36416bf)]
|
||||
interface nsIDOMFile : nsIDOMBlob
|
||||
{
|
||||
readonly attribute DOMString name;
|
||||
|
@ -71,14 +71,6 @@ interface nsIDOMFile : nsIDOMBlob
|
|||
|
||||
// This performs no security checks!
|
||||
[noscript] readonly attribute DOMString mozFullPathInternal;
|
||||
|
||||
// These are all deprecated and not in spec. Will be removed in a future
|
||||
// release
|
||||
readonly attribute DOMString fileName;
|
||||
readonly attribute unsigned long long fileSize;
|
||||
DOMString getAsText(in DOMString encoding); // raises(FileException) on retrieval
|
||||
DOMString getAsDataURL(); // raises(FileException) on retrieval
|
||||
DOMString getAsBinary(); // raises(FileException) on retrieval
|
||||
};
|
||||
|
||||
[scriptable, uuid(c4a77171-039b-4f84-97f9-820fb51626af)]
|
||||
|
|
|
@ -142,7 +142,6 @@ NS_INTERFACE_MAP_BEGIN(nsDOMFile)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMBlob)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMFile, mIsFullFile)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICharsetDetectionObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(File, mIsFullFile)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(Blob, !mIsFullFile)
|
||||
|
@ -173,18 +172,6 @@ nsDOMFile::NewFile(nsISupports* *aNewObject)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetFileName(nsAString &aFileName)
|
||||
{
|
||||
return GetName(aFileName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetFileSize(PRUint64 *aFileSize)
|
||||
{
|
||||
return GetSize(aFileSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetName(nsAString &aFileName)
|
||||
{
|
||||
|
@ -358,231 +345,6 @@ nsDOMFile::GetInternalUrl(nsIPrincipal* aPrincipal, nsAString& aURL)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetAsText(const nsAString &aCharset, nsAString &aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsresult rv = GetInternalStream(getter_AddRefs(stream));
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
|
||||
nsCAutoString charsetGuess;
|
||||
if (!aCharset.IsEmpty()) {
|
||||
CopyUTF16toUTF8(aCharset, charsetGuess);
|
||||
} else {
|
||||
rv = GuessCharset(stream, charsetGuess);
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
|
||||
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(stream);
|
||||
if (!seekable) return NS_ERROR_FAILURE;
|
||||
rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
}
|
||||
|
||||
nsCAutoString charset;
|
||||
nsCOMPtr<nsICharsetAlias> alias =
|
||||
do_GetService(NS_CHARSETALIAS_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = alias->GetPreferred(charsetGuess, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return DOMFileResult(ConvertStream(stream, charset.get(), aResult));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetAsDataURL(nsAString &aResult)
|
||||
{
|
||||
aResult.AssignLiteral("data:");
|
||||
|
||||
nsresult rv;
|
||||
if (!mContentType.Length()) {
|
||||
nsCOMPtr<nsIMIMEService> mimeService =
|
||||
do_GetService(NS_MIMESERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString contentType;
|
||||
rv = mimeService->GetTypeFromFile(mFile, contentType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(contentType, mContentType);
|
||||
}
|
||||
}
|
||||
|
||||
if (mContentType.Length()) {
|
||||
aResult.Append(mContentType);
|
||||
} else {
|
||||
aResult.AppendLiteral("application/octet-stream");
|
||||
}
|
||||
aResult.AppendLiteral(";base64,");
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
rv = GetInternalStream(getter_AddRefs(stream));
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
|
||||
char readBuf[4096];
|
||||
PRUint32 leftOver = 0;
|
||||
PRUint32 numRead;
|
||||
do {
|
||||
rv = stream->Read(readBuf + leftOver, sizeof(readBuf) - leftOver, &numRead);
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
|
||||
PRUint32 numEncode = numRead + leftOver;
|
||||
leftOver = 0;
|
||||
|
||||
if (numEncode == 0) break;
|
||||
|
||||
// unless this is the end of the file, encode in multiples of 3
|
||||
if (numRead > 0) {
|
||||
leftOver = numEncode % 3;
|
||||
numEncode -= leftOver;
|
||||
}
|
||||
|
||||
// out buffer should be at least 4/3rds the read buf, plus a terminator
|
||||
char *base64 = PL_Base64Encode(readBuf, numEncode, nsnull);
|
||||
if (!base64) {
|
||||
return DOMFileResult(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
nsDependentCString str(base64);
|
||||
PRUint32 strLen = str.Length();
|
||||
PRUint32 oldLength = aResult.Length();
|
||||
AppendASCIItoUTF16(str, aResult);
|
||||
PR_Free(base64);
|
||||
if (aResult.Length() - oldLength != strLen) {
|
||||
return DOMFileResult(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (leftOver) {
|
||||
memmove(readBuf, readBuf + numEncode, leftOver);
|
||||
}
|
||||
} while (numRead > 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetAsBinary(nsAString &aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsresult rv = GetInternalStream(getter_AddRefs(stream));
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
|
||||
PRUint32 numRead;
|
||||
do {
|
||||
char readBuf[4096];
|
||||
rv = stream->Read(readBuf, sizeof(readBuf), &numRead);
|
||||
NS_ENSURE_SUCCESS(rv, DOMFileResult(rv));
|
||||
PRUint32 oldLength = aResult.Length();
|
||||
AppendASCIItoUTF16(Substring(readBuf, readBuf + numRead), aResult);
|
||||
if (aResult.Length() - oldLength != numRead) {
|
||||
return DOMFileResult(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
} while (numRead > 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMFile::GuessCharset(nsIInputStream *aStream,
|
||||
nsACString &aCharset)
|
||||
{
|
||||
|
||||
if (!mCharset.IsEmpty()) {
|
||||
aCharset = mCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// First try the universal charset detector
|
||||
nsCOMPtr<nsICharsetDetector> detector
|
||||
= do_CreateInstance(NS_CHARSET_DETECTOR_CONTRACTID_BASE
|
||||
"universal_charset_detector");
|
||||
if (!detector) {
|
||||
// No universal charset detector, try the default charset detector
|
||||
const nsAdoptingCString& detectorName =
|
||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
||||
if (!detectorName.IsEmpty()) {
|
||||
nsCAutoString detectorContractID;
|
||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||
detectorContractID += detectorName;
|
||||
detector = do_CreateInstance(detectorContractID.get());
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (detector) {
|
||||
detector->Init(this);
|
||||
|
||||
PRBool done;
|
||||
PRUint32 numRead;
|
||||
do {
|
||||
char readBuf[4096];
|
||||
rv = aStream->Read(readBuf, sizeof(readBuf), &numRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = detector->DoIt(readBuf, numRead, &done);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} while (!done && numRead > 0);
|
||||
|
||||
rv = detector->Done();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// no charset detector available, check the BOM
|
||||
unsigned char sniffBuf[4];
|
||||
PRUint32 numRead;
|
||||
rv = aStream->Read(reinterpret_cast<char*>(sniffBuf),
|
||||
sizeof(sniffBuf), &numRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (numRead >= 4 &&
|
||||
sniffBuf[0] == 0x00 &&
|
||||
sniffBuf[1] == 0x00 &&
|
||||
sniffBuf[2] == 0xfe &&
|
||||
sniffBuf[3] == 0xff) {
|
||||
mCharset = "UTF-32BE";
|
||||
} else if (numRead >= 4 &&
|
||||
sniffBuf[0] == 0xff &&
|
||||
sniffBuf[1] == 0xfe &&
|
||||
sniffBuf[2] == 0x00 &&
|
||||
sniffBuf[3] == 0x00) {
|
||||
mCharset = "UTF-32LE";
|
||||
} else if (numRead >= 2 &&
|
||||
sniffBuf[0] == 0xfe &&
|
||||
sniffBuf[1] == 0xff) {
|
||||
mCharset = "UTF-16BE";
|
||||
} else if (numRead >= 2 &&
|
||||
sniffBuf[0] == 0xff &&
|
||||
sniffBuf[1] == 0xfe) {
|
||||
mCharset = "UTF-16LE";
|
||||
} else if (numRead >= 3 &&
|
||||
sniffBuf[0] == 0xef &&
|
||||
sniffBuf[1] == 0xbb &&
|
||||
sniffBuf[2] == 0xbf) {
|
||||
mCharset = "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
if (mCharset.IsEmpty()) {
|
||||
// no charset detected, default to the system charset
|
||||
nsCOMPtr<nsIPlatformCharset> platformCharset =
|
||||
do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = platformCharset->GetCharset(kPlatformCharsetSel_PlainTextInFile,
|
||||
mCharset);
|
||||
}
|
||||
}
|
||||
|
||||
if (mCharset.IsEmpty()) {
|
||||
// no sniffed or default charset, try UTF-8
|
||||
mCharset.AssignLiteral("UTF-8");
|
||||
}
|
||||
|
||||
aCharset = mCharset;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::GetSendInfo(nsIInputStream** aBody,
|
||||
nsACString& aContentType,
|
||||
|
@ -606,14 +368,6 @@ nsDOMFile::GetSendInfo(nsIInputStream** aBody,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::Notify(const char* aCharset, nsDetectionConfident aConf)
|
||||
{
|
||||
mCharset.Assign(aCharset);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFile::Initialize(nsISupports* aOwner,
|
||||
JSContext* aCx,
|
||||
|
@ -674,42 +428,6 @@ nsDOMFile::Initialize(nsISupports* aOwner,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMFile::ConvertStream(nsIInputStream *aStream,
|
||||
const char *aCharset,
|
||||
nsAString &aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
|
||||
nsCOMPtr<nsIConverterInputStream> converterStream =
|
||||
do_CreateInstance("@mozilla.org/intl/converter-input-stream;1");
|
||||
if (!converterStream) return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = converterStream->Init
|
||||
(aStream, aCharset,
|
||||
8192,
|
||||
nsIConverterInputStream::DEFAULT_REPLACEMENT_CHARACTER);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIUnicharInputStream> unicharStream =
|
||||
do_QueryInterface(converterStream);
|
||||
if (!unicharStream) return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 numChars;
|
||||
nsString result;
|
||||
rv = unicharStream->ReadString(8192, result, &numChars);
|
||||
while (NS_SUCCEEDED(rv) && numChars > 0) {
|
||||
PRUint32 oldLength = aResult.Length();
|
||||
aResult.Append(result);
|
||||
if (aResult.Length() - oldLength != result.Length()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
rv = unicharStream->ReadString(8192, result, &numChars);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsDOMMemoryFile Implementation
|
||||
NS_IMETHODIMP
|
||||
nsDOMMemoryFile::GetName(nsAString &aFileName)
|
||||
|
|
|
@ -295,7 +295,6 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
|
|||
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(mPrincipal));
|
||||
|
||||
JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024);
|
||||
JS_SetScriptStackQuota(cx, 25 * sizeof(size_t) * 1024 * 1024);
|
||||
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_ANONFUNFIX | JSOPTION_PRIVATE_IS_NSISUPPORTS);
|
||||
JS_SetVersion(cx, JSVERSION_LATEST);
|
||||
|
|
|
@ -158,7 +158,6 @@ _TEST_FILES1 = test_bug5141.html \
|
|||
test_bug413974.html \
|
||||
test_bug415860.html \
|
||||
test_bug414190.html \
|
||||
test_bug414796.html \
|
||||
test_bug527896.html \
|
||||
test_bug416317-1.html \
|
||||
test_bug416317-2.html \
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=414796
|
||||
-->
|
||||
<title>Test for Bug 414796</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414796">Mozilla Bug 414796</a>
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
|
||||
// Write a test file > 8192 characters
|
||||
|
||||
var testData = "asdfblahqwer";
|
||||
for (var i = 0; i < 10; i++) {
|
||||
testData = testData + testData;
|
||||
}
|
||||
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
testFile.append("testfile");
|
||||
|
||||
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(testData, testData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
fileList.value = testFile.path;
|
||||
|
||||
var domFileData = fileList.files[0].getAsText("iso-8859-1");
|
||||
ok(domFileData.length == testData.length);
|
||||
ok(domFileData == testData);
|
||||
|
||||
testFile.remove(false);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body> </html>
|
|
@ -6,6 +6,21 @@
|
|||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
function compareAsync(file, canvas, type)
|
||||
{
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onload =
|
||||
function(e) {
|
||||
is(e.target.result, canvas.toDataURL(type),
|
||||
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
MochiKit.DOM.addLoadEvent(function () {
|
||||
|
||||
|
@ -16,15 +31,13 @@ ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
|||
|
||||
var pngfile = canvas.mozGetAsFile("foo.png");
|
||||
is(pngfile.type, "image/png", "Default type for mozGetAsFile should be PNG");
|
||||
is(pngfile.getAsDataURL(), canvas.toDataURL(),
|
||||
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
||||
compareAsync(pngfile, canvas, "image/png");
|
||||
is(pngfile.name, "foo.png", "File name should be what we passed in");
|
||||
|
||||
var jpegfile = canvas.mozGetAsFile("bar.jpg", "image/jpeg");
|
||||
is(jpegfile.type, "image/jpeg",
|
||||
"When a valid type is specified that should be returned");
|
||||
is(jpegfile.getAsDataURL(), canvas.toDataURL("image/jpeg"),
|
||||
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
||||
compareAsync(jpegfile, canvas, "image/jpeg");
|
||||
is(jpegfile.name, "bar.jpg", "File name should be what we passed in");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -10678,7 +10678,9 @@ nsDocShell::ConfirmRepost(PRBool * aRepost)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 buttonPressed;
|
||||
PRBool checkState;
|
||||
// The actual value here is irrelevant, but we can't pass an invalid
|
||||
// PRBool through XPConnect.
|
||||
PRBool checkState = PR_FALSE;
|
||||
rv = prompter->
|
||||
ConfirmEx(nsnull, msgString.get(),
|
||||
(nsIPrompt::BUTTON_POS_0 * nsIPrompt::BUTTON_TITLE_IS_STRING) +
|
||||
|
|
|
@ -1009,7 +1009,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
|||
#ifdef JS_GC_ZEAL
|
||||
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
|
||||
if (zeal >= 0)
|
||||
::JS_SetGCZeal(context->mContext, (PRUint8)zeal);
|
||||
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -690,13 +690,13 @@ ContentParent::SetChildMemoryReporters(const InfallibleTArray<MemoryReport>& rep
|
|||
|
||||
for (PRUint32 i = 0; i < report.Length(); i++) {
|
||||
|
||||
nsCString prefix = report[i].prefix();
|
||||
nsCString path = report[i].path();
|
||||
PRInt32 kind = report[i].kind();
|
||||
nsCString desc = report[i].desc();
|
||||
nsCString process = report[i].process();
|
||||
nsCString path = report[i].path();
|
||||
PRInt32 kind = report[i].kind();
|
||||
nsCString desc = report[i].desc();
|
||||
PRInt64 memoryUsed = report[i].memoryUsed();
|
||||
|
||||
nsRefPtr<nsMemoryReporter> r = new nsMemoryReporter(prefix,
|
||||
nsRefPtr<nsMemoryReporter> r = new nsMemoryReporter(process,
|
||||
path,
|
||||
kind,
|
||||
desc,
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
struct MemoryReport {
|
||||
nsCString prefix;
|
||||
nsCString process;
|
||||
nsCString path;
|
||||
PRInt32 kind;
|
||||
nsCString desc;
|
||||
|
|
|
@ -844,7 +844,6 @@ TabChild::InitTabChildGlobal()
|
|||
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(mPrincipal));
|
||||
|
||||
JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024);
|
||||
JS_SetScriptStackQuota(cx, 25 * sizeof(size_t) * 1024 * 1024);
|
||||
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_ANONFUNFIX | JSOPTION_PRIVATE_IS_NSISUPPORTS);
|
||||
JS_SetVersion(cx, JSVERSION_LATEST);
|
||||
|
|
|
@ -258,17 +258,6 @@ PluginPRLibrary::GetImageSize(NPP instance, nsIntSize* aSize)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginPRLibrary::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
|
||||
{
|
||||
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)instance->ndata;
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_NULL_POINTER);
|
||||
*aDrawing = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginPRLibrary::SetBackgroundUnknown(NPP instance)
|
||||
{
|
||||
|
|
|
@ -143,9 +143,6 @@ public:
|
|||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage);
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
|
||||
NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
|
||||
#endif
|
||||
NS_OVERRIDE
|
||||
virtual nsresult SetBackgroundUnknown(NPP instance);
|
||||
NS_OVERRIDE
|
||||
|
|
|
@ -729,22 +729,6 @@ nsresult nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
|||
#endif
|
||||
}
|
||||
|
||||
nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(PRBool* aDrawing)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
if (!mPlugin)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PluginLibrary* library = mPlugin->GetLibrary();
|
||||
if (!library)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return library->IsRemoteDrawingCoreAnimation(&mNPP, aDrawing);
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
|
||||
{
|
||||
|
|
|
@ -251,6 +251,28 @@ nsPluginInstanceOwner::EndUpdateBackground(gfxContext* aContext,
|
|||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsPluginInstanceOwner::UseAsyncRendering()
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
nsRefPtr<ImageContainer> container = mObjectFrame->GetImageContainer();
|
||||
#endif
|
||||
|
||||
PRBool useAsyncRendering;
|
||||
return (mInstance &&
|
||||
NS_SUCCEEDED(mInstance->UseAsyncPainting(&useAsyncRendering)) &&
|
||||
useAsyncRendering &&
|
||||
#ifdef XP_MACOSX
|
||||
mObjectFrame && mObjectFrame->GetImageContainer().get() &&
|
||||
mObjectFrame->GetImageContainer().get()->GetBackendType() ==
|
||||
LayerManager::LAYERS_OPENGL
|
||||
#else
|
||||
(!mPluginWindow ||
|
||||
mPluginWindow->type == NPWindowTypeDrawable)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
nsPluginInstanceOwner::GetCurrentImageSize()
|
||||
{
|
||||
|
@ -1338,18 +1360,6 @@ NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
|
|||
return drawingModel;
|
||||
}
|
||||
|
||||
PRBool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation()
|
||||
{
|
||||
if (!mInstance)
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool coreAnimation;
|
||||
if (!NS_SUCCEEDED(mInstance->IsRemoteDrawingCoreAnimation(&coreAnimation)))
|
||||
return PR_FALSE;
|
||||
|
||||
return coreAnimation;
|
||||
}
|
||||
|
||||
NPEventModel nsPluginInstanceOwner::GetEventModel()
|
||||
{
|
||||
return mEventModel;
|
||||
|
@ -3217,7 +3227,7 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
|||
mPluginWindow->clipRect.right != oldClipRect.right ||
|
||||
mPluginWindow->clipRect.bottom != oldClipRect.bottom)
|
||||
{
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
CallSetWindow();
|
||||
mPluginPortChanged = PR_FALSE;
|
||||
#ifdef MAC_CARBON_PLUGINS
|
||||
// if the clipRect is of size 0, make the null timer fire less often
|
||||
|
@ -3231,7 +3241,7 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
|||
}
|
||||
#endif
|
||||
} else if (mPluginPortChanged) {
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
CallSetWindow();
|
||||
mPluginPortChanged = PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -3273,7 +3283,11 @@ nsPluginInstanceOwner::HidePluginWindow()
|
|||
mPluginWindow->clipRect.bottom = mPluginWindow->clipRect.top;
|
||||
mPluginWindow->clipRect.right = mPluginWindow->clipRect.left;
|
||||
mWidgetVisible = PR_FALSE;
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
if (mAsyncHidePluginWindow) {
|
||||
mInstance->AsyncSetWindow(mPluginWindow);
|
||||
} else {
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
}
|
||||
}
|
||||
|
||||
#else // XP_MACOSX
|
||||
|
@ -3321,19 +3335,6 @@ void nsPluginInstanceOwner::UpdateWindowPositionAndClipRect(PRBool aSetWindow)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstanceOwner::CallSetWindow()
|
||||
{
|
||||
if (!mInstance)
|
||||
return;
|
||||
|
||||
if (UseAsyncRendering()) {
|
||||
mInstance->AsyncSetWindow(mPluginWindow);
|
||||
} else {
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstanceOwner::UpdateWindowVisibility(PRBool aVisible)
|
||||
{
|
||||
|
@ -3343,6 +3344,21 @@ nsPluginInstanceOwner::UpdateWindowVisibility(PRBool aVisible)
|
|||
|
||||
#endif // XP_MACOSX
|
||||
|
||||
void
|
||||
nsPluginInstanceOwner::CallSetWindow()
|
||||
{
|
||||
if (!mInstance)
|
||||
return;
|
||||
|
||||
if (UseAsyncRendering()) {
|
||||
mAsyncHidePluginWindow = true;
|
||||
mInstance->AsyncSetWindow(mPluginWindow);
|
||||
} else {
|
||||
mAsyncHidePluginWindow = false;
|
||||
mInstance->SetWindow(mPluginWindow);
|
||||
}
|
||||
}
|
||||
|
||||
// Little helper function to resolve relative URL in
|
||||
// |value| for certain inputs of |name|
|
||||
void nsPluginInstanceOwner::FixUpURLS(const nsString &name, nsAString &value)
|
||||
|
|
|
@ -179,7 +179,6 @@ public:
|
|||
enum { ePluginPaintEnable, ePluginPaintDisable };
|
||||
|
||||
NPDrawingModel GetDrawingModel();
|
||||
PRBool IsRemoteDrawingCoreAnimation();
|
||||
NPEventModel GetEventModel();
|
||||
static void CARefresh(nsITimer *aTimer, void *aClosure);
|
||||
static void AddToCARefreshTimer(nsPluginInstanceOwner *aPluginInstance);
|
||||
|
@ -207,9 +206,9 @@ public:
|
|||
void EndCGPaint();
|
||||
#else // XP_MACOSX
|
||||
void UpdateWindowPositionAndClipRect(PRBool aSetWindow);
|
||||
void CallSetWindow();
|
||||
void UpdateWindowVisibility(PRBool aVisible);
|
||||
#endif // XP_MACOSX
|
||||
void CallSetWindow();
|
||||
|
||||
void SetOwner(nsObjectFrame *aOwner)
|
||||
{
|
||||
|
@ -295,15 +294,7 @@ public:
|
|||
already_AddRefed<gfxContext> BeginUpdateBackground(const nsIntRect& aRect);
|
||||
void EndUpdateBackground(gfxContext* aContext, const nsIntRect& aRect);
|
||||
|
||||
PRBool UseAsyncRendering()
|
||||
{
|
||||
PRBool useAsyncRendering;
|
||||
return (mInstance &&
|
||||
NS_SUCCEEDED(mInstance->UseAsyncPainting(&useAsyncRendering)) &&
|
||||
useAsyncRendering &&
|
||||
(!mPluginWindow ||
|
||||
mPluginWindow->type == NPWindowTypeDrawable));
|
||||
}
|
||||
PRBool UseAsyncRendering();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -339,6 +330,9 @@ private:
|
|||
static nsTArray<nsPluginInstanceOwner*> *sCARefreshListeners;
|
||||
PRBool mSentInitialTopLevelWindowEvent;
|
||||
#endif
|
||||
// We need to know if async hide window is required since we
|
||||
// can not check UseAsyncRendering when executing StopPlugin
|
||||
PRBool mAsyncHidePluginWindow;
|
||||
|
||||
// Initially, the event loop nesting level we were created on, it's updated
|
||||
// if we detect the appshell is on a lower level as long as we're not stopped.
|
||||
|
|
|
@ -69,10 +69,15 @@ struct SurfaceDescriptorX11 {
|
|||
gfxIntSize size;
|
||||
};
|
||||
|
||||
struct IOSurfaceDescriptor {
|
||||
uint32_t surfaceId;
|
||||
};
|
||||
|
||||
union SurfaceDescriptor {
|
||||
Shmem;
|
||||
SurfaceDescriptorX11;
|
||||
PPluginSurface; // used on Windows
|
||||
IOSurfaceDescriptor; // used on OSX 10.5+
|
||||
// Descriptor can be null here in case
|
||||
// 1) of first Show call (prevSurface is null)
|
||||
// 2) when child is going to destroy
|
||||
|
|
|
@ -105,6 +105,7 @@ static const TCHAR kPluginIgnoreSubclassProperty[] = TEXT("PluginIgnoreSubclassP
|
|||
|
||||
#elif defined(XP_MACOSX)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include "PluginUtilsOSX.h"
|
||||
#endif // defined(XP_MACOSX)
|
||||
|
||||
template<>
|
||||
|
@ -135,6 +136,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
|
|||
, mShColorSpace(nsnull)
|
||||
, mShContext(nsnull)
|
||||
, mDrawingModel(NPDrawingModelCoreGraphics)
|
||||
, mCGLayer(nsnull)
|
||||
, mCurrentEvent(nsnull)
|
||||
#endif
|
||||
, mLayersRendering(false)
|
||||
|
@ -183,6 +185,9 @@ PluginInstanceChild::~PluginInstanceChild()
|
|||
if (mShContext) {
|
||||
::CGContextRelease(mShContext);
|
||||
}
|
||||
if (mCGLayer) {
|
||||
mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(mCGLayer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -477,6 +482,9 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
|
|||
return NPERR_GENERIC_ERROR;
|
||||
mDrawingModel = drawingModel;
|
||||
|
||||
PLUGIN_LOG_DEBUG((" Plugin requested drawing model id #%i\n",
|
||||
mDrawingModel));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -490,6 +498,9 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
|
|||
mEventModel = static_cast<NPEventModel>(eventModel);
|
||||
#endif
|
||||
|
||||
PLUGIN_LOG_DEBUG((" Plugin requested event model id # %i\n",
|
||||
eventModel));
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
@ -778,6 +789,32 @@ PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
|
|||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
||||
void CallCGDraw(CGContextRef ref, void* aPluginInstance, nsIntRect aUpdateRect) {
|
||||
PluginInstanceChild* pluginInstance = (PluginInstanceChild*)aPluginInstance;
|
||||
|
||||
pluginInstance->CGDraw(ref, aUpdateRect);
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceChild::CGDraw(CGContextRef ref, nsIntRect aUpdateRect) {
|
||||
|
||||
NPCocoaEvent drawEvent;
|
||||
drawEvent.type = NPCocoaEventDrawRect;
|
||||
drawEvent.version = 0;
|
||||
drawEvent.data.draw.x = aUpdateRect.x;
|
||||
drawEvent.data.draw.y = aUpdateRect.y;
|
||||
drawEvent.data.draw.width = aUpdateRect.width;
|
||||
drawEvent.data.draw.height = aUpdateRect.height;
|
||||
drawEvent.data.draw.context = ref;
|
||||
|
||||
NPRemoteEvent remoteDrawEvent = {drawEvent};
|
||||
|
||||
int16_t handled;
|
||||
AnswerNPP_HandleEvent(remoteDrawEvent, &handled);
|
||||
return handled == true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
|
||||
const uint32_t &surfaceid,
|
||||
|
@ -803,13 +840,16 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
|
|||
NPError result = mPluginIface->getvalue(GetNPP(),
|
||||
NPPVpluginCoreAnimationLayer,
|
||||
&caLayer);
|
||||
|
||||
if (result != NPERR_NO_ERROR || !caLayer) {
|
||||
PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not "
|
||||
"provide CALayer."));
|
||||
*handled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
mCARenderer.SetupRenderer(caLayer, mWindow.width, mWindow.height);
|
||||
|
||||
// Flash needs to have the window set again after this step
|
||||
if (mPluginIface->setwindow)
|
||||
(void) mPluginIface->setwindow(&mData, &mWindow);
|
||||
|
@ -2278,12 +2318,17 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
|||
}
|
||||
|
||||
mWindow.window = NULL;
|
||||
#ifdef XP_MACOSX
|
||||
if (mWindow.width != aWindow.width || mWindow.height != aWindow.height)
|
||||
mAccumulatedInvalidRect = nsIntRect(0, 0, aWindow.width, aWindow.height);
|
||||
#else
|
||||
if (mWindow.width != aWindow.width || mWindow.height != aWindow.height ||
|
||||
mWindow.clipRect.top != aWindow.clipRect.top ||
|
||||
mWindow.clipRect.left != aWindow.clipRect.left ||
|
||||
mWindow.clipRect.bottom != aWindow.clipRect.bottom ||
|
||||
mWindow.clipRect.right != aWindow.clipRect.right)
|
||||
mAccumulatedInvalidRect = nsIntRect(0, 0, aWindow.width, aWindow.height);
|
||||
#endif
|
||||
|
||||
mWindow.x = aWindow.x;
|
||||
mWindow.y = aWindow.y;
|
||||
|
@ -2472,6 +2517,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
|
|||
bool
|
||||
PluginInstanceChild::EnsureCurrentBuffer(void)
|
||||
{
|
||||
#ifndef XP_MACOSX
|
||||
nsIntRect toInvalidate(0, 0, 0, 0);
|
||||
gfxIntSize winSize = gfxIntSize(mWindow.width, mWindow.height);
|
||||
|
||||
|
@ -2503,7 +2549,7 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
|
|||
mAccumulatedInvalidRect.UnionRect(mAccumulatedInvalidRect, toInvalidate);
|
||||
|
||||
if (mCurrentSurface) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CreateOptSurface()) {
|
||||
|
@ -2517,6 +2563,65 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
|
|||
}
|
||||
|
||||
return true;
|
||||
#else // XP_MACOSX
|
||||
if (mCurrentIOSurface &&
|
||||
(mCurrentIOSurface->GetWidth() != mWindow.width ||
|
||||
mCurrentIOSurface->GetHeight() != mWindow.height) ) {
|
||||
mCurrentIOSurface = nsnull;
|
||||
}
|
||||
|
||||
if (!mCARenderer.isInit() || !mCurrentIOSurface) {
|
||||
if (!mCurrentIOSurface) {
|
||||
mCurrentIOSurface = nsIOSurface::CreateIOSurface(mWindow.width, mWindow.height);
|
||||
|
||||
nsIntRect toInvalidate(0, 0, mWindow.width, mWindow.height);
|
||||
mAccumulatedInvalidRect.UnionRect(mAccumulatedInvalidRect, toInvalidate);
|
||||
}
|
||||
|
||||
if (!mCurrentIOSurface) {
|
||||
NS_WARNING("Failed to allocate IOSurface");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIOSurface *rendererSurface = nsIOSurface::LookupSurface(mCurrentIOSurface->GetIOSurfaceID());
|
||||
if (!rendererSurface) {
|
||||
NS_WARNING("Failed to lookup IOSurface");
|
||||
return false;
|
||||
}
|
||||
mCARenderer.AttachIOSurface(rendererSurface);
|
||||
|
||||
void *caLayer = nsnull;
|
||||
if (mDrawingModel == NPDrawingModelCoreGraphics) {
|
||||
if (mCGLayer) {
|
||||
mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(mCGLayer);
|
||||
mCGLayer = nsnull;
|
||||
}
|
||||
|
||||
caLayer = mozilla::plugins::PluginUtilsOSX::GetCGLayer(CallCGDraw, this);
|
||||
if (!caLayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mCGLayer = caLayer;
|
||||
} else {
|
||||
NPError result = mPluginIface->getvalue(GetNPP(),
|
||||
NPPVpluginCoreAnimationLayer,
|
||||
&caLayer);
|
||||
if (result != NPERR_NO_ERROR || !caLayer) {
|
||||
PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not "
|
||||
"provide CALayer."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
mCARenderer.SetupRenderer(caLayer, mWindow.width, mWindow.height);
|
||||
// Flash needs to have the window set again after this step
|
||||
if (mPluginIface->setwindow)
|
||||
(void) mPluginIface->setwindow(&mData, &mWindow);
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2893,6 +2998,57 @@ PluginInstanceChild::ShowPluginFrame()
|
|||
AutoRestore<bool> pending(mPendingPluginCall);
|
||||
mPendingPluginCall = true;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// We can't use the thebes code with CoreAnimation so we will
|
||||
// take a different code path.
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation ||
|
||||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation ||
|
||||
mDrawingModel == NPDrawingModelCoreGraphics) {
|
||||
|
||||
if (!EnsureCurrentBuffer()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear accRect here to be able to pass
|
||||
// test_invalidate_during_plugin_paint test
|
||||
nsIntRect rect = mAccumulatedInvalidRect;
|
||||
mAccumulatedInvalidRect.SetEmpty();
|
||||
|
||||
// Fix up old invalidations that might have been made when our
|
||||
// surface was a different size
|
||||
rect.IntersectRect(rect,
|
||||
nsIntRect(0, 0, mCurrentIOSurface->GetWidth(), mCurrentIOSurface->GetHeight()));
|
||||
|
||||
if (!mCARenderer.isInit()) {
|
||||
NS_ERROR("CARenderer not initialized");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mDrawingModel == NPDrawingModelCoreGraphics) {
|
||||
mozilla::plugins::PluginUtilsOSX::Repaint(mCGLayer, rect);
|
||||
}
|
||||
|
||||
mCARenderer.Render(mWindow.width, mWindow.height, nsnull);
|
||||
|
||||
NPRect r = { (uint16_t)rect.y, (uint16_t)rect.x,
|
||||
(uint16_t)rect.YMost(), (uint16_t)rect.XMost() };
|
||||
SurfaceDescriptor currSurf;
|
||||
currSurf = IOSurfaceDescriptor(mCurrentIOSurface->GetIOSurfaceID());
|
||||
|
||||
// Unused
|
||||
SurfaceDescriptor returnSurf;
|
||||
|
||||
if (!SendShow(r, currSurf, &returnSurf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
NS_ERROR("Unsupported drawing model for async layer rendering");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool temporarilyMakeVisible = !IsVisible() && !mHasPainted;
|
||||
if (temporarilyMakeVisible && mWindow.width && mWindow.height) {
|
||||
mWindow.clipRect.right = mWindow.width;
|
||||
|
@ -3145,6 +3301,7 @@ PluginInstanceChild::InvalidateRect(NPRect* aInvalidRect)
|
|||
AsyncShowPluginFrame();
|
||||
return;
|
||||
}
|
||||
|
||||
// If we were going to use layers rendering but it's not set up
|
||||
// yet, and the plugin happens to call this first, we'll forward
|
||||
// the invalidation to the browser. It's unclear whether
|
||||
|
@ -3384,6 +3541,18 @@ PluginInstanceChild::ClearAllSurfaces()
|
|||
mBackSurfaceActor = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (mCurrentIOSurface) {
|
||||
// Get last surface back, and drop it
|
||||
SurfaceDescriptor temp = null_t();
|
||||
NPRect r = { 0, 0, 1, 1 };
|
||||
SendShow(r, temp, &temp);
|
||||
|
||||
}
|
||||
|
||||
mCurrentIOSurface = nsnull;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -414,11 +414,14 @@ private:
|
|||
CGContextRef mShContext;
|
||||
int16_t mDrawingModel;
|
||||
nsCARenderer mCARenderer;
|
||||
void *mCGLayer;
|
||||
|
||||
public:
|
||||
const NPCocoaEvent* getCurrentEvent() {
|
||||
return mCurrentEvent;
|
||||
}
|
||||
|
||||
bool CGDraw(CGContextRef ref, nsIntRect aUpdateRect);
|
||||
|
||||
#if defined(__i386__)
|
||||
NPEventModel EventModel() { return mEventModel; }
|
||||
|
@ -511,6 +514,12 @@ private:
|
|||
// surface which is on ParentProcess side
|
||||
nsRefPtr<gfxASurface> mBackSurface;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Current IOSurface available for rendering
|
||||
// We can't use thebes gfxASurface like other platforms.
|
||||
nsAutoPtr<nsIOSurface> mCurrentIOSurface;
|
||||
#endif
|
||||
|
||||
// (Not to be confused with mBackSurface). This is a recent copy
|
||||
// of the opaque pixels under our object frame, if
|
||||
// |mIsTransparent|. We ask the plugin render directly onto a
|
||||
|
|
|
@ -103,7 +103,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
|
|||
, mShHeight(0)
|
||||
, mShColorSpace(nsnull)
|
||||
, mDrawingModel(NPDrawingModelCoreGraphics)
|
||||
, mIOSurface(nsnull)
|
||||
#endif
|
||||
{
|
||||
InitQuirksModes(aMimeType);
|
||||
|
@ -137,7 +136,6 @@ PluginInstanceParent::~PluginInstanceParent()
|
|||
}
|
||||
if (mShColorSpace)
|
||||
::CGColorSpaceRelease(mShColorSpace);
|
||||
delete mIOSurface;
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation) {
|
||||
mParent->RemoveFromRefreshTimer(this);
|
||||
}
|
||||
|
@ -517,6 +515,29 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
|
|||
}
|
||||
surface = gfxSharedImageSurface::Open(newSurface.get_Shmem());
|
||||
}
|
||||
#ifdef XP_MACOSX
|
||||
else if (newSurface.type() == SurfaceDescriptor::TIOSurfaceDescriptor) {
|
||||
IOSurfaceDescriptor iodesc = newSurface.get_IOSurfaceDescriptor();
|
||||
|
||||
nsIOSurface *newIOSurface = nsIOSurface::LookupSurface(iodesc.surfaceId());
|
||||
|
||||
if (!newIOSurface) {
|
||||
NS_WARNING("Got bad IOSurfaceDescriptor in RecvShow");
|
||||
return false;
|
||||
}
|
||||
|
||||
mIOSurface = newIOSurface;
|
||||
|
||||
RecvNPN_InvalidateRect(updatedRect);
|
||||
|
||||
*prevSurface = null_t();
|
||||
|
||||
PLUGIN_LOG_DEBUG((" (RecvShow invalidated for surface %p)",
|
||||
mFrontSurface.get()));
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_X11
|
||||
else if (newSurface.type() == SurfaceDescriptor::TSurfaceDescriptorX11) {
|
||||
SurfaceDescriptorX11 xdesc = newSurface.get_SurfaceDescriptorX11();
|
||||
|
@ -659,16 +680,6 @@ PluginInstanceParent::GetImageSize(nsIntSize* aSize)
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
nsresult
|
||||
PluginInstanceParent::IsRemoteDrawingCoreAnimation(PRBool *aDrawing)
|
||||
{
|
||||
*aDrawing = (NPDrawingModelCoreAnimation == (NPDrawingModel)mDrawingModel ||
|
||||
NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginInstanceParent::SetBackgroundUnknown()
|
||||
{
|
||||
|
@ -869,7 +880,6 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
|
|||
if (mShWidth != window.width || mShHeight != window.height) {
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation ||
|
||||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
|
||||
delete mIOSurface;
|
||||
mIOSurface = nsIOSurface::CreateIOSurface(window.width, window.height);
|
||||
} else if (mShWidth * mShHeight != window.width * window.height) {
|
||||
if (mShWidth != 0 && mShHeight != 0) {
|
||||
|
|
|
@ -282,9 +282,6 @@ public:
|
|||
nsresult AsyncSetWindow(NPWindow* window);
|
||||
nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
|
||||
nsresult GetImageSize(nsIntSize* aSize);
|
||||
#ifdef XP_MACOSX
|
||||
nsresult IsRemoteDrawingCoreAnimation(PRBool *aDrawing);
|
||||
#endif
|
||||
nsresult SetBackgroundUnknown();
|
||||
nsresult BeginUpdateBackground(const nsIntRect& aRect,
|
||||
gfxContext** aCtx);
|
||||
|
@ -352,12 +349,12 @@ private:
|
|||
#endif // defined(XP_WIN)
|
||||
#if defined(OS_MACOSX)
|
||||
private:
|
||||
Shmem mShSurface;
|
||||
size_t mShWidth;
|
||||
size_t mShHeight;
|
||||
CGColorSpaceRef mShColorSpace;
|
||||
int16_t mDrawingModel;
|
||||
nsIOSurface *mIOSurface;
|
||||
Shmem mShSurface;
|
||||
size_t mShWidth;
|
||||
size_t mShHeight;
|
||||
CGColorSpaceRef mShColorSpace;
|
||||
int16_t mDrawingModel;
|
||||
nsAutoPtr<nsIOSurface> mIOSurface;
|
||||
#endif // definied(OS_MACOSX)
|
||||
|
||||
// ObjectFrame layer wrapper
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include "base/basictypes.h"
|
||||
#include "nsPoint.h"
|
||||
#include "npapi.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
// Make this includable from non-Objective-C code.
|
||||
#ifndef __OBJC__
|
||||
|
|
|
@ -102,9 +102,6 @@ public:
|
|||
virtual nsresult GetImage(NPP instance, ImageContainer* aContainer, Image** aImage) = 0;
|
||||
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
|
||||
virtual bool UseAsyncPainting() = 0;
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing) = 0;
|
||||
#endif
|
||||
/**
|
||||
* The next three methods are the third leg in the trip to
|
||||
* PluginInstanceParent. They approximately follow the ReadbackSink
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <glib.h>
|
||||
#elif XP_MACOSX
|
||||
#include "PluginUtilsOSX.h"
|
||||
#include "PluginInterposeOSX.h"
|
||||
#include "PluginUtilsOSX.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#endif
|
||||
|
@ -924,18 +924,6 @@ PluginModuleParent::NPP_GetSitesWithData(InfallibleTArray<nsCString>& result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing)
|
||||
{
|
||||
PluginInstanceParent* i = InstCast(instance);
|
||||
if (!i)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return i->IsRemoteDrawingCoreAnimation(aDrawing);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
PluginModuleParent::AnswerNPN_GetValue_WithBoolReturn(const NPNVariable& aVariable,
|
||||
NPError* aError,
|
||||
|
|
|
@ -282,10 +282,6 @@ private:
|
|||
uint64_t maxAge);
|
||||
virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, PRBool *aDrawing);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void WritePluginExtraDataForMinidump(const nsAString& id);
|
||||
void WriteExtraDataForHang();
|
||||
|
|
|
@ -38,18 +38,27 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "npapi.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
namespace PluginUtilsOSX {
|
||||
|
||||
// Need to call back into the browser's to process event.
|
||||
// Need to call back into the browser's message loop to process event.
|
||||
typedef void (*RemoteProcessEvents) (void*);
|
||||
|
||||
NPError ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent);
|
||||
|
||||
void InvokeNativeEventLoop();
|
||||
|
||||
// Need to call back and send a cocoa draw event to the plugin.
|
||||
typedef void (*DrawPluginFunc) (CGContextRef, void*, nsIntRect aUpdateRect);
|
||||
|
||||
void* GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance);
|
||||
void ReleaseCGLayer(void* cgLayer);
|
||||
void Repaint(void* cgLayer, nsIntRect aRect);
|
||||
|
||||
|
||||
} // namespace PluginUtilsOSX
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#include "PluginUtilsOSX.h"
|
||||
|
||||
// Remove definitions for try/catch interfering with ObjCException macros.
|
||||
|
@ -45,6 +46,61 @@
|
|||
|
||||
using namespace mozilla::plugins::PluginUtilsOSX;
|
||||
|
||||
@interface CGBridgeLayer : CALayer {
|
||||
DrawPluginFunc mDrawFunc;
|
||||
void* mPluginInstance;
|
||||
nsIntRect mUpdateRect;
|
||||
}
|
||||
- (void) setDrawFunc: (DrawPluginFunc)aFunc pluginInstance:(void*) aPluginInstance;
|
||||
- (void) updateRect: (nsIntRect)aRect;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CGBridgeLayer
|
||||
- (void) updateRect: (nsIntRect)aRect
|
||||
{
|
||||
mUpdateRect.UnionRect(mUpdateRect, aRect);
|
||||
}
|
||||
|
||||
- (void) setDrawFunc: (DrawPluginFunc)aFunc pluginInstance:(void*) aPluginInstance
|
||||
{
|
||||
mDrawFunc = aFunc;
|
||||
mPluginInstance = aPluginInstance;
|
||||
}
|
||||
|
||||
- (void)drawInContext:(CGContextRef)aCGContext
|
||||
|
||||
{
|
||||
::CGContextSaveGState(aCGContext);
|
||||
::CGContextTranslateCTM(aCGContext, 0, self.bounds.size.height);
|
||||
::CGContextScaleCTM(aCGContext, (CGFloat) 1, (CGFloat) -1);
|
||||
|
||||
mDrawFunc(aCGContext, mPluginInstance, mUpdateRect);
|
||||
|
||||
::CGContextRestoreGState(aCGContext);
|
||||
|
||||
mUpdateRect.SetEmpty();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void* mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance) {
|
||||
CGBridgeLayer *bridgeLayer = [[CGBridgeLayer alloc] init ];
|
||||
[bridgeLayer setDrawFunc:aFunc pluginInstance:aPluginInstance];
|
||||
return bridgeLayer;
|
||||
}
|
||||
|
||||
void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void *cgLayer) {
|
||||
CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)cgLayer;
|
||||
[bridgeLayer release];
|
||||
}
|
||||
|
||||
void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
|
||||
CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)caLayer;
|
||||
[bridgeLayer updateRect:aRect];
|
||||
[bridgeLayer setNeedsDisplay];
|
||||
}
|
||||
|
||||
@interface EventProcessor : NSObject {
|
||||
RemoteProcessEvents aRemoteEvents;
|
||||
void *aPluginModule;
|
||||
|
|
|
@ -674,8 +674,7 @@ DOMWorkerErrorReporter(JSContext* aCx,
|
|||
}
|
||||
|
||||
// Don't call the error handler if we're out of stack space.
|
||||
if (errorNumber != JSMSG_SCRIPT_STACK_QUOTA &&
|
||||
errorNumber != JSMSG_OVER_RECURSED) {
|
||||
if (errorNumber != JSMSG_OVER_RECURSED) {
|
||||
// Try the onerror handler for the worker's scope.
|
||||
nsRefPtr<nsDOMWorkerScope> scope = worker->GetInnerScope();
|
||||
NS_ASSERTION(scope, "Null scope!");
|
||||
|
@ -1072,7 +1071,6 @@ nsDOMThreadService::CreateJSContext()
|
|||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
JS_SetNativeStackQuota(cx, 256*1024);
|
||||
JS_SetScriptStackQuota(cx, 100*1024*1024);
|
||||
|
||||
JS_SetOptions(cx,
|
||||
JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_JIT |
|
||||
|
|
|
@ -914,7 +914,6 @@ nsDOMWorkerScope::Trace(nsIXPConnectWrappedNative* /* aWrapper */,
|
|||
JSTracer* aTracer,
|
||||
JSObject* /*aObj */)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
nsDOMWorkerMessageHandler::Trace(aTracer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1509,8 +1508,6 @@ nsDOMWorker::Trace(nsIXPConnectWrappedNative* /* aWrapper */,
|
|||
JSTracer* aTracer,
|
||||
JSObject* /*aObj */)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
PRBool canceled = PR_FALSE;
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
|
|
|
@ -430,8 +430,6 @@ nsDOMWorkerXHR::Trace(nsIXPConnectWrappedNative* /* aWrapper */,
|
|||
JSTracer* aTracer,
|
||||
JSObject* /*aObj */)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (!mCanceled) {
|
||||
nsDOMWorkerMessageHandler::Trace(aTracer);
|
||||
if (mUpload) {
|
||||
|
|
|
@ -543,31 +543,31 @@ gfxASurface::MovePixels(const nsIntRect& aSourceRect,
|
|||
/** Memory reporting **/
|
||||
|
||||
static const char *sSurfaceNamesForSurfaceType[] = {
|
||||
"explicit/gfx/surface/image",
|
||||
"explicit/gfx/surface/pdf",
|
||||
"explicit/gfx/surface/ps",
|
||||
"explicit/gfx/surface/xlib",
|
||||
"explicit/gfx/surface/xcb",
|
||||
"explicit/gfx/surface/glitz",
|
||||
"explicit/gfx/surface/quartz",
|
||||
"explicit/gfx/surface/win32",
|
||||
"explicit/gfx/surface/beos",
|
||||
"explicit/gfx/surface/directfb",
|
||||
"explicit/gfx/surface/svg",
|
||||
"explicit/gfx/surface/os2",
|
||||
"explicit/gfx/surface/win32printing",
|
||||
"explicit/gfx/surface/quartzimage",
|
||||
"explicit/gfx/surface/script",
|
||||
"explicit/gfx/surface/qpainter",
|
||||
"explicit/gfx/surface/recording",
|
||||
"explicit/gfx/surface/vg",
|
||||
"explicit/gfx/surface/gl",
|
||||
"explicit/gfx/surface/drm",
|
||||
"explicit/gfx/surface/tee",
|
||||
"explicit/gfx/surface/xml",
|
||||
"explicit/gfx/surface/skia",
|
||||
"explicit/gfx/surface/subsurface",
|
||||
"explicit/gfx/surface/d2d"
|
||||
"gfx-surface-image",
|
||||
"gfx-surface-pdf",
|
||||
"gfx-surface-ps",
|
||||
"gfx-surface-xlib",
|
||||
"gfx-surface-xcb",
|
||||
"gfx-surface-glitz",
|
||||
"gfx-surface-quartz",
|
||||
"gfx-surface-win32",
|
||||
"gfx-surface-beos",
|
||||
"gfx-surface-directfb",
|
||||
"gfx-surface-svg",
|
||||
"gfx-surface-os2",
|
||||
"gfx-surface-win32printing",
|
||||
"gfx-surface-quartzimage",
|
||||
"gfx-surface-script",
|
||||
"gfx-surface-qpainter",
|
||||
"gfx-surface-recording",
|
||||
"gfx-surface-vg",
|
||||
"gfx-surface-gl",
|
||||
"gfx-surface-drm",
|
||||
"gfx-surface-tee",
|
||||
"gfx-surface-xml",
|
||||
"gfx-surface-skia",
|
||||
"gfx-surface-subsurface",
|
||||
"gfx-surface-d2d"
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sSurfaceNamesForSurfaceType) == gfxASurface::SurfaceTypeMax);
|
||||
|
@ -581,7 +581,7 @@ SurfaceMemoryReporterPathForType(gfxASurface::gfxSurfaceType aType)
|
|||
{
|
||||
if (aType < 0 ||
|
||||
aType >= gfxASurface::SurfaceTypeMax)
|
||||
return "explicit/gfx/surface/unknown";
|
||||
return "gfx-surface-unknown";
|
||||
|
||||
return sSurfaceNamesForSurfaceType[aType];
|
||||
}
|
||||
|
@ -600,13 +600,18 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetProcess(char **process) {
|
||||
*process = strdup("");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPath(char **memoryPath) {
|
||||
*memoryPath = strdup(SurfaceMemoryReporterPathForType(mType));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetKind(PRInt32 *kind) {
|
||||
*kind = MR_HEAP;
|
||||
*kind = MR_OTHER;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,11 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetProcess(char **process) {
|
||||
*process = strdup("");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPath(char **memoryPath) {
|
||||
*memoryPath = strdup("gfx-d2d-surfacecache");
|
||||
return NS_OK;
|
||||
|
@ -127,6 +132,11 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetProcess(char **process) {
|
||||
*process = strdup("");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPath(char **memoryPath) {
|
||||
*memoryPath = strdup("gfx-d2d-surfacevram");
|
||||
return NS_OK;
|
||||
|
|
|
@ -441,7 +441,7 @@ GCZeal(JSContext *cx,
|
|||
if (!JS_ValueToECMAUint32(cx, argv[0], &zeal))
|
||||
return JS_FALSE;
|
||||
|
||||
JS_SetGCZeal(cx, PRUint8(zeal));
|
||||
JS_SetGCZeal(cx, PRUint8(zeal), JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -574,7 +574,7 @@ JetpackChild::GCZeal(JSContext* cx, uintN argc, jsval *vp)
|
|||
if (!JS_ValueToECMAUint32(cx, argv[0], &zeal))
|
||||
return JS_FALSE;
|
||||
|
||||
JS_SetGCZeal(cx, PRUint8(zeal));
|
||||
JS_SetGCZeal(cx, PRUint8(zeal), JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -542,7 +542,7 @@ interface jsdIContextEnumerator : nsISupports
|
|||
/**
|
||||
* Set jsdIDebuggerService::scriptHook to an instance of one of these.
|
||||
*/
|
||||
[scriptable, uuid(bb722893-0f63-45c5-b547-7a0947c7b6b6)]
|
||||
[scriptable, uuid(d030d1a2-a58a-4f19-b9e3-96da4e2cdd09)]
|
||||
interface jsdIScriptHook : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -811,7 +811,7 @@ interface jsdIContext : jsdIEphemeral
|
|||
* interface. Once a jsdIStackFrame has been invalidated all method and
|
||||
* property accesses will throw a NS_ERROR_NOT_AVAILABLE exception.
|
||||
*/
|
||||
[scriptable, uuid(0633ca73-105e-4e8e-bcc5-13405d61754a)]
|
||||
[scriptable, uuid(7c95422c-7579-4a6f-8ef7-e5b391552ee5)]
|
||||
interface jsdIStackFrame : jsdIEphemeral
|
||||
{
|
||||
/** Internal use only. */
|
||||
|
@ -884,7 +884,7 @@ interface jsdIStackFrame : jsdIEphemeral
|
|||
* Script object. In JavaScript engine terms, there's a single script for each
|
||||
* function, and one for the top level script.
|
||||
*/
|
||||
[scriptable, uuid(e7935220-7def-4c8e-832f-fbc948a97490)]
|
||||
[scriptable, uuid(721724e0-7716-4bf4-b48f-92b78d056141)]
|
||||
interface jsdIScript : jsdIEphemeral
|
||||
{
|
||||
/** Internal use only. */
|
||||
|
@ -1030,6 +1030,17 @@ interface jsdIScript : jsdIEphemeral
|
|||
* The |pcmap| argument specifies which pc to source line map to use.
|
||||
*/
|
||||
boolean isLineExecutable(in unsigned long line, in unsigned long pcmap);
|
||||
|
||||
/**
|
||||
* Return a list of all executable lines in a script.
|
||||
* |pcmap| specifies which pc to source line map to use.
|
||||
* |startLine| and |maxLines| may be used to retrieve a chunk at a time.
|
||||
*/
|
||||
void getExecutableLines(in unsigned long pcmap,
|
||||
in unsigned long startLine, in unsigned long maxLines,
|
||||
[optional] out unsigned long count,
|
||||
[array, size_is(count), retval] out unsigned long executableLines);
|
||||
|
||||
/**
|
||||
* Set a breakpoint at a PC in this script.
|
||||
*/
|
||||
|
@ -1054,7 +1065,7 @@ interface jsdIScript : jsdIEphemeral
|
|||
* jsdIValue adds a root for the underlying JavaScript value, so don't keep it
|
||||
* if you don't need to.
|
||||
*/
|
||||
[scriptable, uuid(fd1311f7-096c-44a3-847b-9d478c8176c3)]
|
||||
[scriptable, uuid(861c4d37-e115-4a52-9f76-273cb6b21c3b)]
|
||||
interface jsdIValue : jsdIEphemeral
|
||||
{
|
||||
/** Internal use only. */
|
||||
|
|
|
@ -481,6 +481,11 @@ jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, uintN line);
|
|||
extern uintN
|
||||
jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
|
||||
|
||||
extern JSBool
|
||||
jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||
uintN startLine, uintN maxLines,
|
||||
uintN* count, uintN** lines, jsuword** pcs);
|
||||
|
||||
extern void
|
||||
jsd_NewScriptHookProc(
|
||||
JSContext *cx,
|
||||
|
|
|
@ -580,6 +580,44 @@ jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc)
|
|||
return line;
|
||||
}
|
||||
|
||||
JSBool
|
||||
jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||
uintN startLine, uintN maxLines,
|
||||
uintN* count, uintN** retLines, jsuword** retPCs)
|
||||
{
|
||||
JSCrossCompartmentCall *call;
|
||||
uintN first = jsdscript->lineBase;
|
||||
uintN last = first + jsd_GetScriptLineExtent(jsdc, jsdscript) - 1;
|
||||
JSBool ok;
|
||||
uintN *lines;
|
||||
jsbytecode **pcs;
|
||||
uintN i;
|
||||
|
||||
if (last < startLine)
|
||||
return JS_TRUE;
|
||||
|
||||
call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script);
|
||||
if (!call)
|
||||
return JS_FALSE;
|
||||
|
||||
ok = JS_GetLinePCs(jsdc->dumbContext, jsdscript->script,
|
||||
startLine, maxLines,
|
||||
count, retLines, &pcs);
|
||||
|
||||
if (ok) {
|
||||
if (retPCs) {
|
||||
for (i = 0; i < *count; ++i) {
|
||||
(*retPCs)[i] = (*pcs)[i];
|
||||
}
|
||||
}
|
||||
|
||||
JS_free(jsdc->dumbContext, pcs);
|
||||
}
|
||||
|
||||
JS_LeaveCrossCompartmentCall(call);
|
||||
return ok;
|
||||
}
|
||||
|
||||
JSBool
|
||||
jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata)
|
||||
{
|
||||
|
|
|
@ -1019,10 +1019,8 @@ jsdScript::jsdScript (JSDContext *aCx, JSDScript *aScript) : mValid(PR_FALSE),
|
|||
jsdScript::~jsdScript ()
|
||||
{
|
||||
DEBUG_DESTROY ("jsdScript", gScriptCount);
|
||||
if (mFileName)
|
||||
delete mFileName;
|
||||
if (mFunctionName)
|
||||
delete mFunctionName;
|
||||
delete mFileName;
|
||||
delete mFunctionName;
|
||||
|
||||
if (mPPLineMap)
|
||||
PR_Free(mPPLineMap);
|
||||
|
@ -1541,6 +1539,58 @@ jsdScript::EnableSingleStepInterrupts(PRBool enable)
|
|||
return (JSD_EnableSingleStepInterrupts(mCx, mScript, enable) ? NS_OK : NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
jsdScript::GetExecutableLines(PRUint32 aPcmap, PRUint32 aStartLine, PRUint32 aMaxLines,
|
||||
PRUint32* aCount, PRUint32** aExecutableLines)
|
||||
{
|
||||
ASSERT_VALID_EPHEMERAL;
|
||||
if (aPcmap == PCMAP_SOURCETEXT) {
|
||||
jsuword start = JSD_GetClosestPC(mCx, mScript, 0);
|
||||
uintN lastLine = JSD_GetScriptBaseLineNumber(mCx, mScript)
|
||||
+ JSD_GetScriptLineExtent(mCx, mScript) - 1;
|
||||
jsuword end = JSD_GetClosestPC(mCx, mScript, lastLine + 1);
|
||||
|
||||
*aExecutableLines = static_cast<PRUint32*>(NS_Alloc((end - start + 1) * sizeof(PRUint32)));
|
||||
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines, NULL))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aPcmap == PCMAP_PRETTYPRINT) {
|
||||
if (!mPPLineMap) {
|
||||
if (!CreatePPLineMap())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsTArray<PRUint32> lines;
|
||||
PRUint32 i;
|
||||
|
||||
for (i = 0; i < mPCMapSize; ++i) {
|
||||
if (mPPLineMap[i].line >= aStartLine)
|
||||
break;
|
||||
}
|
||||
|
||||
for (; i < mPCMapSize && lines.Length() < aMaxLines; ++i) {
|
||||
lines.AppendElement(mPPLineMap[i].line);
|
||||
}
|
||||
|
||||
if (aCount)
|
||||
*aCount = lines.Length();
|
||||
|
||||
*aExecutableLines = static_cast<PRUint32*>(NS_Alloc(lines.Length() * sizeof(PRUint32)));
|
||||
if (!*aExecutableLines)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
for (i = 0; i < lines.Length(); ++i)
|
||||
(*aExecutableLines)[i] = lines[i];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
jsdScript::IsLineExecutable(PRUint32 aLine, PRUint32 aPcmap, PRBool *_rval)
|
||||
{
|
||||
|
|
|
@ -356,6 +356,16 @@ JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc)
|
|||
return jsd_GetClosestLine(jsdc, jsdscript, pc);
|
||||
}
|
||||
|
||||
JSD_PUBLIC_API(JSBool)
|
||||
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||
uintN startLine, uintN maxLines,
|
||||
uintN* count, uintN** lines, jsuword** pcs)
|
||||
{
|
||||
JSD_ASSERT_VALID_CONTEXT(jsdc);
|
||||
JSD_ASSERT_VALID_SCRIPT(jsdscript);
|
||||
return jsd_GetLinePCs(jsdc, jsdscript, startLine, maxLines, count, lines, pcs);
|
||||
}
|
||||
|
||||
JSD_PUBLIC_API(void)
|
||||
JSD_ScriptCreated(JSDContext* jsdc,
|
||||
JSContext *cx,
|
||||
|
|
|
@ -496,6 +496,17 @@ JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, uintN line);
|
|||
extern JSD_PUBLIC_API(uintN)
|
||||
JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
|
||||
|
||||
/*
|
||||
* Get a list of lines and the corresponding earliest PC for each (see
|
||||
* JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL
|
||||
* may be passed for either lines or pcs to avoid filling anything in for that
|
||||
* argument.
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSBool)
|
||||
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||
uintN startLine, uintN maxLines,
|
||||
uintN* count, uintN** lines, jsuword** pcs);
|
||||
|
||||
/* these are only used in cases where scripts are created outside of JS*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -49,6 +49,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
_TEST_FILES = test_bug507448.html bug507448.js \
|
||||
test_bug617870-callhooks.html test-bug617870-callhooks.js jsd-test.js \
|
||||
test_bug638178-execlines.html test-bug638178-execlines.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var jsdIScript = Components.interfaces.jsdIScript;
|
||||
|
||||
function f1() {
|
||||
var x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
|
||||
|
||||
var x; var y; x = 1;
|
||||
}
|
||||
|
||||
function f3() {
|
||||
|
||||
|
||||
var x;
|
||||
|
||||
var y; var y2; y = 1;
|
||||
var z;
|
||||
|
||||
}
|
||||
|
||||
var jsdIFilter = Components.interfaces.jsdIFilter;
|
||||
|
||||
function testJSD(jsd) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
ok(jsd.isOn, "JSD needs to be running for this test.");
|
||||
|
||||
jsd.functionHook = ({
|
||||
onCall: function(frame, type) {
|
||||
//console.log("Got " + type);
|
||||
console.log("Got " + frame.script.fileName);
|
||||
}
|
||||
});
|
||||
|
||||
console.log("Triggering functions");
|
||||
f1();
|
||||
f2();
|
||||
f3();
|
||||
console.log("Done with functions");
|
||||
|
||||
var linemap = {};
|
||||
var firsts = {};
|
||||
var rests = {};
|
||||
var startlines = {};
|
||||
jsd.enumerateScripts({
|
||||
enumerateScript: function(script) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (/execlines\.js$/.test(script.fileName)) {
|
||||
console.log("script: " + script.fileName + " " + script.functionName);
|
||||
var execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, 0, 10000);
|
||||
console.log(execLines.toSource());
|
||||
linemap[script.functionName] = execLines;
|
||||
startlines[script.functionName] = script.baseLineNumber;
|
||||
|
||||
execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, 0, 1);
|
||||
firsts[script.functionName] = execLines;
|
||||
execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, execLines[0]+1, 10000);
|
||||
rests[script.functionName] = execLines;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var checklines = function (funcname, linemap, rellines) {
|
||||
var base = startlines[funcname];
|
||||
var b = [];
|
||||
for (var i = 0; i < rellines.length; ++i) {
|
||||
b[i] = rellines[i] + base;
|
||||
}
|
||||
is(linemap[funcname].toSource(), b.toSource(), funcname + " lines");
|
||||
};
|
||||
|
||||
checklines('f1', linemap, [ 1 ]);
|
||||
checklines('f2', linemap, [ 3 ]);
|
||||
checklines('f3', linemap, [ 3, 5, 6 ]);
|
||||
|
||||
checklines('f1', firsts, [ 1 ]);
|
||||
checklines('f1', rests, []);
|
||||
checklines('f3', firsts, [ 3 ]);
|
||||
checklines('f3', rests, [ 5, 6 ]);
|
||||
|
||||
jsd.functionHook = null;
|
||||
|
||||
if (!jsdOnAtStart) {
|
||||
// turn JSD off if it wasn't on when this test started
|
||||
jsd.off();
|
||||
ok(!jsd.isOn, "JSD shouldn't be running at the end of this test.");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
testJSD(jsd);
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<!-- The bug number is pulled from the test URL -->
|
||||
<title>JSD Test for Bug AUTOFILLED</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="jsd-test.js"></script>
|
||||
<script type="application/javascript">
|
||||
var BUG = 638178;
|
||||
var TEST_SCRIPT = "test-bug638178-execlines.js";
|
||||
document.getElementsByTagName("title")[0].innerHTML = "JSD Test for Bug " + BUG;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
console.log("start of runTest, loading script");
|
||||
loadScript(TEST_SCRIPT, document.getElementById("test"));
|
||||
console.log("end of runTest");
|
||||
}
|
||||
|
||||
function setupTest() {
|
||||
var buglink = document.getElementById("buglink");
|
||||
buglink.href = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + BUG;
|
||||
buglink.innerHTML = "Mozilla Bug " + BUG;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onLoad='setupTest(); setupJSD();'>
|
||||
|
||||
<a id="buglink" target="_blank"></a>
|
||||
<p id="display"></p>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
<pre id='test'>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div id='test-output'>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -365,7 +365,6 @@ CPPSRCS += MethodJIT.cpp \
|
|||
Retcon.cpp \
|
||||
TrampolineCompiler.cpp \
|
||||
$(NULL)
|
||||
# PICStubCompiler.cpp \
|
||||
|
||||
ifeq (86, $(findstring 86,$(TARGET_CPU)))
|
||||
ifeq (x86_64, $(TARGET_CPU))
|
||||
|
@ -423,14 +422,17 @@ ifeq (,$(filter arm% sparc %86 x86_64,$(TARGET_CPU)))
|
|||
|
||||
VPATH += $(srcdir)/assembler \
|
||||
$(srcdir)/assembler/wtf \
|
||||
$(srcdir)/yarr/pcre \
|
||||
$(srcdir)/yarr\
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS += pcre_compile.cpp \
|
||||
pcre_exec.cpp \
|
||||
pcre_tables.cpp \
|
||||
pcre_xclass.cpp \
|
||||
pcre_ucp_searchfuncs.cpp \
|
||||
CPPSRCS += \
|
||||
Assertions.cpp \
|
||||
OSAllocatorPosix.cpp \
|
||||
OSAllocatorWin.cpp \
|
||||
PageBlock.cpp \
|
||||
YarrInterpreter.cpp \
|
||||
YarrPattern.cpp \
|
||||
YarrSyntaxChecker.cpp \
|
||||
$(NULL)
|
||||
else
|
||||
|
||||
|
@ -443,9 +445,6 @@ VPATH += $(srcdir)/assembler \
|
|||
$(srcdir)/assembler/assembler \
|
||||
$(srcdir)/methodjit \
|
||||
$(srcdir)/yarr \
|
||||
$(srcdir)/yarr/yarr \
|
||||
$(srcdir)/yarr/pcre \
|
||||
$(srcdir)/yarr/wtf \
|
||||
$(NONE)
|
||||
|
||||
CPPSRCS += Assertions.cpp \
|
||||
|
@ -454,16 +453,16 @@ CPPSRCS += Assertions.cpp \
|
|||
ExecutableAllocatorOS2.cpp \
|
||||
ExecutableAllocator.cpp \
|
||||
ARMAssembler.cpp \
|
||||
Logging.cpp \
|
||||
Logging.cpp \
|
||||
MacroAssemblerARM.cpp \
|
||||
MacroAssemblerX86Common.cpp \
|
||||
RegexCompiler.cpp \
|
||||
RegexJIT.cpp \
|
||||
pcre_compile.cpp \
|
||||
pcre_exec.cpp \
|
||||
pcre_tables.cpp \
|
||||
pcre_xclass.cpp \
|
||||
pcre_ucp_searchfuncs.cpp \
|
||||
OSAllocatorPosix.cpp \
|
||||
OSAllocatorWin.cpp \
|
||||
PageBlock.cpp \
|
||||
YarrInterpreter.cpp \
|
||||
YarrJIT.cpp \
|
||||
YarrPattern.cpp \
|
||||
YarrSyntaxChecker.cpp \
|
||||
$(NONE)
|
||||
|
||||
ifeq (86, $(findstring 86,$(TARGET_CPU)))
|
||||
|
@ -640,7 +639,7 @@ endif
|
|||
# don't give different results. We skip the contents of objdirs using |find|
|
||||
# (it can't be done with %-expansion, because the files we want to skip aren't
|
||||
# in the vpath).
|
||||
ALL_FILES=$(shell find $(srcdir) \( -name "*.cpp" -o -name "*.h" \) -not -path "*/dist/*")
|
||||
ALL_FILES=$(shell find $(srcdir) \( -name "*.cpp" -o -name "*.h" \) -not -path "*/dist/*" -not -path "*/config/*")
|
||||
check-malloc-function-usage: $(filter-out %jsalloc.h %jscntxt.h %jsutil.h, $(ALL_FILES))
|
||||
|
||||
# js_malloc and friends are only used by other memory managers, and should
|
||||
|
@ -656,7 +655,7 @@ check-malloc-function-usage: $(filter-out %jsalloc.h %jscntxt.h %jsutil.h, $(ALL
|
|||
|
||||
# We desire these numbers to go down, not up. See "User guide to memory
|
||||
# management within SpiderMonkey" in jsutil.h.
|
||||
$(srcdir)/config/check_source_count.py OffTheBooks:: 52 \
|
||||
$(srcdir)/config/check_source_count.py OffTheBooks:: 53 \
|
||||
"in Makefile.in" "{cx,rt}->{new_,new_array,malloc_,calloc_,realloc_}" $^
|
||||
# This should go to zero, if possible.
|
||||
$(srcdir)/config/check_source_count.py UnwantedForeground:: 34 \
|
||||
|
|
|
@ -847,7 +847,7 @@ namespace JSC {
|
|||
|
||||
JmpSrc blx(int rm, Condition cc = AL)
|
||||
{
|
||||
#if WTF_ARM_ARCH_AT_LEAST(5)
|
||||
#if WTF_CPU_ARM && WTF_ARM_ARCH_VERSION >= 5
|
||||
int s = m_buffer.uncheckedSize();
|
||||
js::JaegerSpew(
|
||||
js::JSpew_Insns,
|
||||
|
@ -980,7 +980,7 @@ namespace JSC {
|
|||
|
||||
static ARMWord* getLdrImmAddress(ARMWord* insn)
|
||||
{
|
||||
#if WTF_ARM_ARCH_AT_LEAST(5)
|
||||
#if WTF_CPU_ARM && WTF_ARM_ARCH_VERSION >= 5
|
||||
// Check for call
|
||||
if ((*insn & 0x0f7f0000) != 0x051f0000) {
|
||||
// Must be BLX
|
||||
|
|
|
@ -166,13 +166,13 @@ public:
|
|||
void* m_ptr;
|
||||
};
|
||||
|
||||
// ImmPtr:
|
||||
// TrustedImmPtr:
|
||||
//
|
||||
// A pointer sized immediate operand to an instruction - this is wrapped
|
||||
// in a class requiring explicit construction in order to differentiate
|
||||
// from pointers used as absolute addresses to memory operations
|
||||
struct ImmPtr {
|
||||
explicit ImmPtr(const void* value)
|
||||
struct TrustedImmPtr {
|
||||
explicit TrustedImmPtr(const void* value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
@ -185,14 +185,21 @@ public:
|
|||
const void* m_value;
|
||||
};
|
||||
|
||||
// Imm32:
|
||||
struct ImmPtr : public TrustedImmPtr {
|
||||
explicit ImmPtr(const void* value)
|
||||
: TrustedImmPtr(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// TrustedImm32:
|
||||
//
|
||||
// A 32bit immediate operand to an instruction - this is wrapped in a
|
||||
// class requiring explicit construction in order to prevent RegisterIDs
|
||||
// (which are implemented as an enum) from accidentally being passed as
|
||||
// immediate values.
|
||||
struct Imm32 {
|
||||
explicit Imm32(int32_t value)
|
||||
struct TrustedImm32 {
|
||||
explicit TrustedImm32(int32_t value)
|
||||
: m_value(value)
|
||||
#if WTF_CPU_ARM || WTF_CPU_MIPS
|
||||
, m_isPointer(false)
|
||||
|
@ -201,7 +208,7 @@ public:
|
|||
}
|
||||
|
||||
#if !WTF_CPU_X86_64
|
||||
explicit Imm32(ImmPtr ptr)
|
||||
explicit TrustedImm32(TrustedImmPtr ptr)
|
||||
: m_value(ptr.asIntptr())
|
||||
#if WTF_CPU_ARM || WTF_CPU_MIPS
|
||||
, m_isPointer(true)
|
||||
|
@ -223,6 +230,20 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct Imm32 : public TrustedImm32 {
|
||||
explicit Imm32(int32_t value)
|
||||
: TrustedImm32(value)
|
||||
{
|
||||
}
|
||||
#if !WTF_CPU_X86_64
|
||||
explicit Imm32(TrustedImmPtr ptr)
|
||||
: TrustedImm32(ptr)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ImmDouble {
|
||||
union {
|
||||
struct {
|
||||
|
@ -241,7 +262,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// Section 2: MacroAssembler code buffer handles
|
||||
//
|
||||
// The following types are used to reference items in the code buffer
|
||||
|
@ -273,7 +293,7 @@ public:
|
|||
|
||||
bool isUsed() const { return m_label.isUsed(); }
|
||||
void used() { m_label.used(); }
|
||||
bool isValid() const { return m_label.isValid(); }
|
||||
bool isSet() const { return m_label.isValid(); }
|
||||
private:
|
||||
JmpDst m_label;
|
||||
};
|
||||
|
@ -296,6 +316,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
bool isSet() const { return m_label.isValid(); }
|
||||
|
||||
private:
|
||||
JmpDst m_label;
|
||||
};
|
||||
|
@ -411,6 +433,20 @@ public:
|
|||
public:
|
||||
typedef js::Vector<Jump, 16 ,js::SystemAllocPolicy > JumpVector;
|
||||
|
||||
JumpList() {}
|
||||
|
||||
JumpList(const JumpList &other)
|
||||
{
|
||||
m_jumps.append(other.m_jumps);
|
||||
}
|
||||
|
||||
JumpList &operator=(const JumpList &other)
|
||||
{
|
||||
m_jumps.clear();
|
||||
m_jumps.append(other.m_jumps);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void link(AbstractMacroAssembler<AssemblerType>* masm)
|
||||
{
|
||||
size_t size = m_jumps.length();
|
||||
|
@ -432,17 +468,22 @@ public:
|
|||
m_jumps.append(jump);
|
||||
}
|
||||
|
||||
void append(JumpList& other)
|
||||
void append(const JumpList& other)
|
||||
{
|
||||
m_jumps.append(other.m_jumps.begin(), other.m_jumps.length());
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_jumps.clear();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return !m_jumps.length();
|
||||
}
|
||||
|
||||
const JumpVector& jumps() { return m_jumps; }
|
||||
const JumpVector& jumps() const { return m_jumps; }
|
||||
|
||||
private:
|
||||
JumpVector m_jumps;
|
||||
|
|
|
@ -95,12 +95,12 @@ public:
|
|||
storePtr(src, Address(stackPointerRegister, (index * sizeof(void*))));
|
||||
}
|
||||
|
||||
void poke(Imm32 value, int index = 0)
|
||||
void poke(TrustedImm32 value, int index = 0)
|
||||
{
|
||||
store32(value, Address(stackPointerRegister, (index * sizeof(void*))));
|
||||
}
|
||||
|
||||
void poke(ImmPtr imm, int index = 0)
|
||||
void poke(TrustedImmPtr imm, int index = 0)
|
||||
{
|
||||
storePtr(imm, Address(stackPointerRegister, (index * sizeof(void*))));
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
branch32(cond, op1, op2).linkTo(target, this);
|
||||
}
|
||||
|
||||
void branch32(Condition cond, RegisterID op1, Imm32 imm, Label target)
|
||||
void branch32(Condition cond, RegisterID op1, TrustedImm32 imm, Label target)
|
||||
{
|
||||
branch32(cond, op1, imm).linkTo(target, this);
|
||||
}
|
||||
|
@ -177,21 +177,11 @@ public:
|
|||
and32(src, dest);
|
||||
}
|
||||
|
||||
void andPtr(Address address, RegisterID srcDest)
|
||||
{
|
||||
and32(address, srcDest);
|
||||
}
|
||||
|
||||
void andPtr(Imm32 imm, RegisterID srcDest)
|
||||
{
|
||||
and32(imm, srcDest);
|
||||
}
|
||||
|
||||
void andPtr(ImmPtr ptr, RegisterID srcDest)
|
||||
{
|
||||
and32(Imm32(ptr), srcDest);
|
||||
}
|
||||
|
||||
void notPtr(RegisterID srcDest)
|
||||
{
|
||||
not32(srcDest);
|
||||
|
@ -212,11 +202,6 @@ public:
|
|||
or32(imm, dest);
|
||||
}
|
||||
|
||||
void orPtr(Address address, RegisterID srcDest)
|
||||
{
|
||||
or32(address, srcDest);
|
||||
}
|
||||
|
||||
void subPtr(RegisterID src, RegisterID dest)
|
||||
{
|
||||
sub32(src, dest);
|
||||
|
@ -278,27 +263,22 @@ public:
|
|||
store32(src, address);
|
||||
}
|
||||
|
||||
void storePtr(RegisterID src, BaseIndex address)
|
||||
{
|
||||
store32(src, address);
|
||||
}
|
||||
|
||||
void storePtr(RegisterID src, void* address)
|
||||
{
|
||||
store32(src, address);
|
||||
}
|
||||
|
||||
void storePtr(ImmPtr imm, ImplicitAddress address)
|
||||
void storePtr(TrustedImmPtr imm, ImplicitAddress address)
|
||||
{
|
||||
store32(Imm32(imm), address);
|
||||
}
|
||||
|
||||
void storePtr(ImmPtr imm, BaseIndex address)
|
||||
void storePtr(TrustedImmPtr imm, BaseIndex address)
|
||||
{
|
||||
store32(Imm32(imm), address);
|
||||
}
|
||||
|
||||
void storePtr(ImmPtr imm, void* address)
|
||||
void storePtr(TrustedImmPtr imm, void* address)
|
||||
{
|
||||
store32(Imm32(imm), address);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "MacroAssemblerARM.h"
|
||||
|
||||
#if WTF_PLATFORM_LINUX || WTF_PLATFORM_ANDROID
|
||||
#if WTF_OS_LINUX || WTF_OS_ANDROID
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -91,14 +91,14 @@ public:
|
|||
m_assembler.adds_r(dest, dest, src);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, Address address)
|
||||
void add32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, ARMRegisters::S1);
|
||||
add32(imm, ARMRegisters::S1);
|
||||
store32(ARMRegisters::S1, address);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
m_assembler.orrs_r(dest, dest, src);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, RegisterID dest)
|
||||
void or32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
|
||||
}
|
||||
|
@ -211,12 +211,12 @@ public:
|
|||
m_assembler.subs_r(dest, dest, src);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, RegisterID dest)
|
||||
void sub32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, Address address)
|
||||
void sub32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, ARMRegisters::S1);
|
||||
sub32(imm, ARMRegisters::S1);
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
m_assembler.eors_r(dest, dest, src);
|
||||
}
|
||||
|
||||
void xor32(Imm32 imm, RegisterID dest)
|
||||
void xor32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
m_assembler.baseIndexTransfer32(false, src, address.base, address.index, static_cast<int>(address.scale), address.offset);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, BaseIndex address)
|
||||
void store32(TrustedImm32 imm, BaseIndex address)
|
||||
{
|
||||
if (imm.m_isPointer)
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
|
||||
|
@ -389,7 +389,7 @@ public:
|
|||
store32(ARMRegisters::S1, address);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, ImplicitAddress address)
|
||||
void store32(TrustedImm32 imm, ImplicitAddress address)
|
||||
{
|
||||
if (imm.m_isPointer)
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
|
||||
|
@ -404,7 +404,7 @@ public:
|
|||
m_assembler.dtr_u(false, src, ARMRegisters::S0, 0);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, void* address)
|
||||
void store32(TrustedImm32 imm, void* address)
|
||||
{
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
|
||||
if (imm.m_isPointer)
|
||||
|
@ -436,7 +436,7 @@ public:
|
|||
push(ARMRegisters::S0);
|
||||
}
|
||||
|
||||
void move(Imm32 imm, RegisterID dest)
|
||||
void move(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (imm.m_isPointer)
|
||||
m_assembler.ldr_un_imm(dest, imm.m_value);
|
||||
|
@ -449,7 +449,7 @@ public:
|
|||
m_assembler.mov_r(dest, src);
|
||||
}
|
||||
|
||||
void move(ImmPtr imm, RegisterID dest)
|
||||
void move(TrustedImmPtr imm, RegisterID dest)
|
||||
{
|
||||
move(Imm32(imm), dest);
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ public:
|
|||
return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0)
|
||||
Jump branch32(Condition cond, RegisterID left, TrustedImm32 right, int useConstantPool = 0)
|
||||
{
|
||||
ASSERT(left != ARMRegisters::S0);
|
||||
if (right.m_isPointer) {
|
||||
|
@ -500,21 +500,21 @@ public:
|
|||
// number of instructions emitted is constant, regardless of the argument
|
||||
// values. For ARM, this is identical to branch32WithPatch, except that it
|
||||
// does not generate a DataLabel32.
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S1, right.m_value);
|
||||
return branch32(cond, left, ARMRegisters::S1, true);
|
||||
}
|
||||
|
||||
// As branch32_force32, but allow the value ('right') to be patched.
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, Imm32 right, DataLabel32 &dataLabel)
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel)
|
||||
{
|
||||
ASSERT(left != ARMRegisters::S1);
|
||||
dataLabel = moveWithPatch(right, ARMRegisters::S1);
|
||||
return branch32(cond, left, ARMRegisters::S1, true);
|
||||
}
|
||||
|
||||
Jump branch32WithPatch(Condition cond, Address left, Imm32 right, DataLabel32 &dataLabel)
|
||||
Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32 &dataLabel)
|
||||
{
|
||||
ASSERT(left.base != ARMRegisters::S1);
|
||||
load32(left, ARMRegisters::S1);
|
||||
|
@ -534,19 +534,19 @@ public:
|
|||
return branch32(cond, ARMRegisters::S1, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, Address left, Imm32 right)
|
||||
Jump branch32(Condition cond, Address left, TrustedImm32 right)
|
||||
{
|
||||
load32(left, ARMRegisters::S1);
|
||||
return branch32(cond, ARMRegisters::S1, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
load32(left, ARMRegisters::S1);
|
||||
return branch32(cond, ARMRegisters::S1, right);
|
||||
}
|
||||
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
load32WithUnalignedHalfWords(left, ARMRegisters::S1);
|
||||
return branch32(cond, ARMRegisters::S1, right);
|
||||
|
@ -828,7 +828,7 @@ public:
|
|||
setTest32(cond, address, mask, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID src, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
|
||||
{
|
||||
m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ public:
|
|||
move(ARMRegisters::S1, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, AbsoluteAddress address)
|
||||
void add32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
|
||||
m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
|
||||
|
@ -859,7 +859,7 @@ public:
|
|||
m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, AbsoluteAddress address)
|
||||
void sub32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
|
||||
m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
|
||||
|
@ -880,7 +880,7 @@ public:
|
|||
return branch32(cond, ARMRegisters::S1, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, TrustedImm32 right)
|
||||
{
|
||||
load32(left.m_ptr, ARMRegisters::S1);
|
||||
return branch32(cond, ARMRegisters::S1, right);
|
||||
|
@ -908,14 +908,14 @@ public:
|
|||
return Call::fromTailJump(oldJump);
|
||||
}
|
||||
|
||||
DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
|
||||
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
|
||||
{
|
||||
DataLabelPtr dataLabel(this);
|
||||
m_assembler.ldr_un_imm(dest, reinterpret_cast<ARMWord>(initialValue.m_value));
|
||||
return dataLabel;
|
||||
}
|
||||
|
||||
DataLabel32 moveWithPatch(Imm32 initialValue, RegisterID dest)
|
||||
DataLabel32 moveWithPatch(TrustedImm32 initialValue, RegisterID dest)
|
||||
{
|
||||
DataLabel32 dataLabel(this);
|
||||
m_assembler.ldr_un_imm(dest, initialValue.m_value);
|
||||
|
@ -937,7 +937,7 @@ public:
|
|||
return jump;
|
||||
}
|
||||
|
||||
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
|
||||
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
|
||||
{
|
||||
DataLabelPtr dataLabel = moveWithPatch(initialValue, ARMRegisters::S1);
|
||||
store32(ARMRegisters::S1, address);
|
||||
|
|
|
@ -52,7 +52,7 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler<ARMv7Assembler> {
|
|||
struct ArmAddress {
|
||||
enum AddressType {
|
||||
HasOffset,
|
||||
HasIndex,
|
||||
HasIndex
|
||||
} type;
|
||||
RegisterID base;
|
||||
union {
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
DoubleGreaterThanOrUnordered = ARMv7Assembler::ConditionHI,
|
||||
DoubleGreaterThanOrEqualOrUnordered = ARMv7Assembler::ConditionHS,
|
||||
DoubleLessThanOrUnordered = ARMv7Assembler::ConditionLT,
|
||||
DoubleLessThanOrEqualOrUnordered = ARMv7Assembler::ConditionLE,
|
||||
DoubleLessThanOrEqualOrUnordered = ARMv7Assembler::ConditionLE
|
||||
};
|
||||
|
||||
static const RegisterID stackPointerRegister = ARMRegisters::sp;
|
||||
|
@ -131,12 +131,12 @@ public:
|
|||
m_assembler.add(dest, dest, src);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
add32(imm, dest, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID src, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
|
||||
{
|
||||
ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
|
||||
if (armImm.isValid())
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, Address address)
|
||||
void add32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, dataTempRegister);
|
||||
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
add32(dataTempRegister, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, AbsoluteAddress address)
|
||||
void add32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
load32(address.m_ptr, dataTempRegister);
|
||||
|
||||
|
@ -239,7 +239,7 @@ public:
|
|||
m_assembler.orr(dest, dest, src);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, RegisterID dest)
|
||||
void or32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
|
||||
if (armImm.isValid())
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
m_assembler.sub(dest, dest, src);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, RegisterID dest)
|
||||
void sub32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
|
||||
if (armImm.isValid())
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, Address address)
|
||||
void sub32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, dataTempRegister);
|
||||
|
||||
|
@ -319,7 +319,7 @@ public:
|
|||
sub32(dataTempRegister, dest);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, AbsoluteAddress address)
|
||||
void sub32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
load32(address.m_ptr, dataTempRegister);
|
||||
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
m_assembler.eor(dest, dest, src);
|
||||
}
|
||||
|
||||
void xor32(Imm32 imm, RegisterID dest)
|
||||
void xor32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
|
||||
if (armImm.isValid())
|
||||
|
@ -486,7 +486,7 @@ public:
|
|||
store32(src, setupArmAddress(address));
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, ImplicitAddress address)
|
||||
void store32(TrustedImm32 imm, ImplicitAddress address)
|
||||
{
|
||||
move(imm, dataTempRegister);
|
||||
store32(dataTempRegister, setupArmAddress(address));
|
||||
|
@ -498,7 +498,7 @@ public:
|
|||
m_assembler.str(src, addressTempRegister, ARMThumbImmediate::makeUInt16(0));
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, void* address)
|
||||
void store32(TrustedImm32 imm, void* address)
|
||||
{
|
||||
move(imm, dataTempRegister);
|
||||
store32(dataTempRegister, address);
|
||||
|
@ -667,7 +667,7 @@ public:
|
|||
//
|
||||
// Move values in registers.
|
||||
|
||||
void move(Imm32 imm, RegisterID dest)
|
||||
void move(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
uint32_t value = imm.m_value;
|
||||
|
||||
|
@ -693,7 +693,7 @@ public:
|
|||
m_assembler.mov(dest, src);
|
||||
}
|
||||
|
||||
void move(ImmPtr imm, RegisterID dest)
|
||||
void move(TrustedImmPtr imm, RegisterID dest)
|
||||
{
|
||||
move(Imm32(imm), dest);
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ public:
|
|||
return Jump(makeBranch(cond));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
compare32(left, right);
|
||||
return Jump(makeBranch(cond));
|
||||
|
@ -798,21 +798,21 @@ public:
|
|||
return branch32(cond, dataTempRegister, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, Address left, Imm32 right)
|
||||
Jump branch32(Condition cond, Address left, TrustedImm32 right)
|
||||
{
|
||||
// use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
|
||||
load32(left, addressTempRegister);
|
||||
return branch32(cond, addressTempRegister, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
// use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
|
||||
load32(left, addressTempRegister);
|
||||
return branch32(cond, addressTempRegister, right);
|
||||
}
|
||||
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
// use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
|
||||
load32WithUnalignedHalfWords(left, addressTempRegister);
|
||||
|
@ -825,7 +825,7 @@ public:
|
|||
return branch32(cond, dataTempRegister, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, TrustedImm32 right)
|
||||
{
|
||||
// use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
|
||||
load32(left.m_ptr, addressTempRegister);
|
||||
|
@ -1065,13 +1065,13 @@ public:
|
|||
m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
|
||||
}
|
||||
|
||||
DataLabel32 moveWithPatch(Imm32 imm, RegisterID dst)
|
||||
DataLabel32 moveWithPatch(TrustedImm32 imm, RegisterID dst)
|
||||
{
|
||||
moveFixedWidthEncoding(imm, dst);
|
||||
return DataLabel32(this);
|
||||
}
|
||||
|
||||
DataLabelPtr moveWithPatch(ImmPtr imm, RegisterID dst)
|
||||
DataLabelPtr moveWithPatch(TrustedImmPtr imm, RegisterID dst)
|
||||
{
|
||||
moveFixedWidthEncoding(Imm32(imm), dst);
|
||||
return DataLabelPtr(this);
|
||||
|
@ -1090,7 +1090,7 @@ public:
|
|||
return branch32(cond, addressTempRegister, dataTempRegister);
|
||||
}
|
||||
|
||||
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
|
||||
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
|
||||
{
|
||||
DataLabelPtr label = moveWithPatch(initialValue, dataTempRegister);
|
||||
store32(dataTempRegister, address);
|
||||
|
@ -1179,7 +1179,7 @@ protected:
|
|||
return addressTempRegister;
|
||||
}
|
||||
|
||||
void moveFixedWidthEncoding(Imm32 imm, RegisterID dst)
|
||||
void moveFixedWidthEncoding(TrustedImm32 imm, RegisterID dst)
|
||||
{
|
||||
uint32_t value = imm.m_value;
|
||||
m_assembler.movT3(dst, ARMThumbImmediate::makeUInt16(value & 0xffff));
|
||||
|
|
|
@ -180,7 +180,8 @@ private:
|
|||
class MacroAssemblerCodeRef {
|
||||
public:
|
||||
MacroAssemblerCodeRef()
|
||||
: m_size(0)
|
||||
: m_executablePool(NULL),
|
||||
m_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -191,6 +192,20 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
// Release the code memory in this code ref.
|
||||
void release()
|
||||
{
|
||||
if (!m_executablePool)
|
||||
return;
|
||||
|
||||
#if defined DEBUG && (defined WTF_CPU_X86 || defined WTF_CPU_X86_64)
|
||||
void *addr = m_code.executableAddress();
|
||||
memset(addr, 0xcc, m_size);
|
||||
#endif
|
||||
m_executablePool->release();
|
||||
m_executablePool = NULL;
|
||||
}
|
||||
|
||||
MacroAssemblerCodePtr m_code;
|
||||
ExecutablePool* m_executablePool;
|
||||
size_t m_size;
|
||||
|
|
|
@ -97,14 +97,14 @@ namespace JSC {
|
|||
m_assembler.addcc_r(dest, src, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, Address address)
|
||||
void add32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, SparcRegisters::g2);
|
||||
add32(imm, SparcRegisters::g2);
|
||||
store32(SparcRegisters::g2, address);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.addcc_imm(dest, imm.m_value, dest);
|
||||
|
@ -126,7 +126,7 @@ namespace JSC {
|
|||
m_assembler.andcc_r(dest, SparcRegisters::g2, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID src, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.addcc_imm(src, imm.m_value, dest);
|
||||
|
@ -194,7 +194,7 @@ namespace JSC {
|
|||
m_assembler.orcc_r(dest, src, dest);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, RegisterID dest)
|
||||
void or32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.orcc_imm(dest, imm.m_value, dest);
|
||||
|
@ -240,7 +240,7 @@ namespace JSC {
|
|||
m_assembler.subcc_r(dest, src, dest);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, RegisterID dest)
|
||||
void sub32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.subcc_imm(dest, imm.m_value, dest);
|
||||
|
@ -250,7 +250,7 @@ namespace JSC {
|
|||
}
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, Address address)
|
||||
void sub32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
load32(address, SparcRegisters::g2);
|
||||
sub32(imm, SparcRegisters::g2);
|
||||
|
@ -268,7 +268,7 @@ namespace JSC {
|
|||
m_assembler.xorcc_r(src, dest, dest);
|
||||
}
|
||||
|
||||
void xor32(Imm32 imm, RegisterID dest)
|
||||
void xor32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.xorcc_imm(dest, imm.m_value, dest);
|
||||
|
@ -548,7 +548,7 @@ namespace JSC {
|
|||
m_assembler.stw_r(src, address.base, SparcRegisters::g2);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, BaseIndex address)
|
||||
void store32(TrustedImm32 imm, BaseIndex address)
|
||||
{
|
||||
m_assembler.sll_imm(address.index, address.scale, SparcRegisters::g2);
|
||||
add32(Imm32(address.offset), SparcRegisters::g2);
|
||||
|
@ -556,7 +556,7 @@ namespace JSC {
|
|||
m_assembler.stw_r(SparcRegisters::g3, SparcRegisters::g2, address.base);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, ImplicitAddress address)
|
||||
void store32(TrustedImm32 imm, ImplicitAddress address)
|
||||
{
|
||||
m_assembler.move_nocheck(imm.m_value, SparcRegisters::g2);
|
||||
store32(SparcRegisters::g2, address);
|
||||
|
@ -568,7 +568,7 @@ namespace JSC {
|
|||
m_assembler.stw_r(src, SparcRegisters::g0, SparcRegisters::g3);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, void* address)
|
||||
void store32(TrustedImm32 imm, void* address)
|
||||
{
|
||||
move(imm, SparcRegisters::g2);
|
||||
store32(SparcRegisters::g2, address);
|
||||
|
@ -598,7 +598,7 @@ namespace JSC {
|
|||
push(SparcRegisters::g2);
|
||||
}
|
||||
|
||||
void move(Imm32 imm, RegisterID dest)
|
||||
void move(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
if (m_assembler.isimm13(imm.m_value))
|
||||
m_assembler.or_imm(SparcRegisters::g0, imm.m_value, dest);
|
||||
|
@ -611,7 +611,7 @@ namespace JSC {
|
|||
m_assembler.or_r(src, SparcRegisters::g0, dest);
|
||||
}
|
||||
|
||||
void move(ImmPtr imm, RegisterID dest)
|
||||
void move(TrustedImmPtr imm, RegisterID dest)
|
||||
{
|
||||
move(Imm32(imm), dest);
|
||||
}
|
||||
|
@ -641,20 +641,20 @@ namespace JSC {
|
|||
return branch32(cond, SparcRegisters::g2, right);
|
||||
}
|
||||
|
||||
Jump branch32_force32(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32_force32(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.move_nocheck(right.m_value, SparcRegisters::g3);
|
||||
m_assembler.subcc_r(left, SparcRegisters::g3, SparcRegisters::g0);
|
||||
return Jump(m_assembler.branch(SparcCondition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.move_nocheck(right.m_value, SparcRegisters::g2);
|
||||
return branch32(cond, left, SparcRegisters::g2);
|
||||
}
|
||||
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, Imm32 right, DataLabel32 &dataLabel)
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel)
|
||||
{
|
||||
// Always use move_nocheck, since the value is to be patched.
|
||||
dataLabel = DataLabel32(this);
|
||||
|
@ -669,7 +669,7 @@ namespace JSC {
|
|||
return Jump(m_assembler.branch(SparcCondition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
if (m_assembler.isimm13(right.m_value))
|
||||
m_assembler.subcc_imm(left, right.m_value, SparcRegisters::g0);
|
||||
|
@ -692,20 +692,20 @@ namespace JSC {
|
|||
return branch32(cond, SparcRegisters::g2, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, Address left, Imm32 right)
|
||||
Jump branch32(Condition cond, Address left, TrustedImm32 right)
|
||||
{
|
||||
load32(left, SparcRegisters::g2);
|
||||
return branch32(cond, SparcRegisters::g2, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
|
||||
load32(left, SparcRegisters::g2);
|
||||
return branch32(cond, SparcRegisters::g2, right);
|
||||
}
|
||||
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
load32WithUnalignedHalfWords(left, SparcRegisters::g4);
|
||||
return branch32(cond, SparcRegisters::g4, right);
|
||||
|
@ -1052,7 +1052,7 @@ namespace JSC {
|
|||
store32(SparcRegisters::g2, address.m_ptr);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, AbsoluteAddress address)
|
||||
void sub32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
load32(address.m_ptr, SparcRegisters::g2);
|
||||
sub32(imm, SparcRegisters::g2);
|
||||
|
@ -1071,7 +1071,7 @@ namespace JSC {
|
|||
return branch32(cond, SparcRegisters::g2, right);
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, TrustedImm32 right)
|
||||
{
|
||||
load32(left.m_ptr, SparcRegisters::g2);
|
||||
return branch32(cond, SparcRegisters::g2, right);
|
||||
|
@ -1099,7 +1099,7 @@ namespace JSC {
|
|||
return Call::fromTailJump(oldJump);
|
||||
}
|
||||
|
||||
DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
|
||||
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
|
||||
{
|
||||
DataLabelPtr dataLabel(this);
|
||||
Imm32 imm = Imm32(initialValue);
|
||||
|
@ -1107,7 +1107,7 @@ namespace JSC {
|
|||
return dataLabel;
|
||||
}
|
||||
|
||||
DataLabel32 moveWithPatch(Imm32 initialValue, RegisterID dest)
|
||||
DataLabel32 moveWithPatch(TrustedImm32 initialValue, RegisterID dest)
|
||||
{
|
||||
DataLabel32 dataLabel(this);
|
||||
m_assembler.move_nocheck(initialValue.m_value, dest);
|
||||
|
@ -1129,7 +1129,7 @@ namespace JSC {
|
|||
return jump;
|
||||
}
|
||||
|
||||
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
|
||||
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
|
||||
{
|
||||
DataLabelPtr dataLabel = moveWithPatch(initialValue, SparcRegisters::g2);
|
||||
store32(SparcRegisters::g2, address);
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
using MacroAssemblerX86Common::storeDouble;
|
||||
using MacroAssemblerX86Common::convertInt32ToDouble;
|
||||
|
||||
void add32(Imm32 imm, RegisterID src, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
|
||||
{
|
||||
m_assembler.leal_mr(imm.m_value, src, dest);
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ public:
|
|||
m_assembler.andl_im(imm.m_value, address.m_ptr);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, AbsoluteAddress address)
|
||||
void or32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
m_assembler.orl_im(imm.m_value, address.m_ptr);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, AbsoluteAddress address)
|
||||
void sub32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
m_assembler.subl_im(imm.m_value, address.m_ptr);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
addDouble(Address(srcDest), dest);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, void* address)
|
||||
void store32(TrustedImm32 imm, void* address)
|
||||
{
|
||||
m_assembler.movl_i32m(imm.m_value, address);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
|
||||
Jump branch32(Condition cond, AbsoluteAddress left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.cmpl_im(right.m_value, left.m_ptr);
|
||||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
|
||||
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
|
||||
{
|
||||
m_assembler.movl_i32r(initialValue.asIntptr(), dest);
|
||||
return DataLabelPtr(this);
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
|
||||
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
|
||||
{
|
||||
m_assembler.movl_i32m(initialValue.asIntptr(), address.offset, address.base);
|
||||
return DataLabelPtr(this);
|
||||
|
|
|
@ -116,12 +116,12 @@ public:
|
|||
m_assembler.addl_rr(src, dest);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, Address address)
|
||||
void add32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
m_assembler.addl_im(imm.m_value, address.offset, address.base);
|
||||
}
|
||||
|
||||
void add32(Imm32 imm, RegisterID dest)
|
||||
void add32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.addl_ir(imm.m_value, dest);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public:
|
|||
m_assembler.orl_rr(src, dest);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, RegisterID dest)
|
||||
void or32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.orl_ir(imm.m_value, dest);
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
m_assembler.orl_mr(src.offset, src.base, dest);
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, Address address)
|
||||
void or32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
m_assembler.orl_im(imm.m_value, address.offset, address.base);
|
||||
}
|
||||
|
@ -313,12 +313,12 @@ public:
|
|||
m_assembler.subl_rr(src, dest);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, RegisterID dest)
|
||||
void sub32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.subl_ir(imm.m_value, dest);
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, Address address)
|
||||
void sub32(TrustedImm32 imm, Address address)
|
||||
{
|
||||
m_assembler.subl_im(imm.m_value, address.offset, address.base);
|
||||
}
|
||||
|
@ -339,12 +339,12 @@ public:
|
|||
m_assembler.xorl_rr(src, dest);
|
||||
}
|
||||
|
||||
void xor32(Imm32 imm, Address dest)
|
||||
void xor32(TrustedImm32 imm, Address dest)
|
||||
{
|
||||
m_assembler.xorl_im(imm.m_value, dest.offset, dest.base);
|
||||
}
|
||||
|
||||
void xor32(Imm32 imm, RegisterID dest)
|
||||
void xor32(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.xorl_ir(imm.m_value, dest);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
m_assembler.movl_rm(src, address.offset, address.base, address.index, address.scale);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, BaseIndex address)
|
||||
void store32(TrustedImm32 imm, BaseIndex address)
|
||||
{
|
||||
m_assembler.movl_i32m(imm.m_value, address.offset, address.base, address.index, address.scale);
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ public:
|
|||
m_assembler.movb_i8m(imm.m_value, address.offset, address.base, address.index, address.scale);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, ImplicitAddress address)
|
||||
void store32(TrustedImm32 imm, ImplicitAddress address)
|
||||
{
|
||||
m_assembler.movl_i32m(imm.m_value, address.offset, address.base);
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ public:
|
|||
//
|
||||
// Move values in registers.
|
||||
|
||||
void move(Imm32 imm, RegisterID dest)
|
||||
void move(TrustedImm32 imm, RegisterID dest)
|
||||
{
|
||||
// Note: on 64-bit the Imm32 value is zero extended into the register, it
|
||||
// may be useful to have a separate version that sign extends the value?
|
||||
|
@ -767,7 +767,7 @@ public:
|
|||
m_assembler.movq_rr(src, dest);
|
||||
}
|
||||
|
||||
void move(ImmPtr imm, RegisterID dest)
|
||||
void move(TrustedImmPtr imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.movq_i64r(imm.asIntptr(), dest);
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ public:
|
|||
m_assembler.movl_rr(src, dest);
|
||||
}
|
||||
|
||||
void move(ImmPtr imm, RegisterID dest)
|
||||
void move(TrustedImmPtr imm, RegisterID dest)
|
||||
{
|
||||
m_assembler.movl_i32r(imm.asIntptr(), dest);
|
||||
}
|
||||
|
@ -852,7 +852,7 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
|
||||
m_assembler.testl_rr(left, left);
|
||||
|
@ -864,14 +864,14 @@ public:
|
|||
// Branch based on a 32-bit comparison, forcing the size of the
|
||||
// immediate operand to 32 bits in the native code stream to ensure that
|
||||
// the length of code emitted by this instruction is consistent.
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, Imm32 right)
|
||||
Jump branch32FixedLength(Condition cond, RegisterID left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.cmpl_ir_force32(right.m_value, left);
|
||||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
// Branch and record a label after the comparison.
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, Imm32 right, DataLabel32 &dataLabel)
|
||||
Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel)
|
||||
{
|
||||
// Always use cmpl, since the value is to be patched.
|
||||
m_assembler.cmpl_ir_force32(right.m_value, left);
|
||||
|
@ -879,7 +879,7 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32WithPatch(Condition cond, Address left, Imm32 right, DataLabel32 &dataLabel)
|
||||
Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32 &dataLabel)
|
||||
{
|
||||
m_assembler.cmpl_im_force32(right.m_value, left.offset, left.base);
|
||||
dataLabel = DataLabel32(this);
|
||||
|
@ -898,19 +898,19 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, Address left, Imm32 right)
|
||||
Jump branch32(Condition cond, Address left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.cmpl_im(right.m_value, left.offset, left.base);
|
||||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
m_assembler.cmpl_im(right.m_value, left.offset, left.base, left.index, left.scale);
|
||||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
|
||||
Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, TrustedImm32 right)
|
||||
{
|
||||
return branch32(cond, left, right);
|
||||
}
|
||||
|
@ -1369,7 +1369,7 @@ private:
|
|||
}
|
||||
|
||||
#if WTF_CPU_X86
|
||||
#if WTF_PLATFORM_MAC
|
||||
#if WTF_OS_MAC_OS_X
|
||||
|
||||
// All X86 Macs are guaranteed to support at least SSE2
|
||||
static bool isSSEPresent()
|
||||
|
@ -1382,7 +1382,7 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
#else // PLATFORM(MAC)
|
||||
#else // OS(MAC_OS_X)
|
||||
|
||||
static bool isSSEPresent()
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
using MacroAssemblerX86Common::storeDouble;
|
||||
using MacroAssemblerX86Common::convertInt32ToDouble;
|
||||
|
||||
void add32(Imm32 imm, AbsoluteAddress address)
|
||||
void add32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
move(ImmPtr(address.m_ptr), scratchRegister);
|
||||
add32(imm, Address(scratchRegister));
|
||||
|
@ -72,13 +72,13 @@ public:
|
|||
and32(imm, Address(scratchRegister));
|
||||
}
|
||||
|
||||
void or32(Imm32 imm, AbsoluteAddress address)
|
||||
void or32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
move(ImmPtr(address.m_ptr), scratchRegister);
|
||||
or32(imm, Address(scratchRegister));
|
||||
}
|
||||
|
||||
void sub32(Imm32 imm, AbsoluteAddress address)
|
||||
void sub32(TrustedImm32 imm, AbsoluteAddress address)
|
||||
{
|
||||
move(ImmPtr(address.m_ptr), scratchRegister);
|
||||
sub32(imm, Address(scratchRegister));
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
m_assembler.cvtsq2sd_rr(srcDest, dest);
|
||||
}
|
||||
|
||||
void store32(Imm32 imm, void* address)
|
||||
void store32(TrustedImm32 imm, void* address)
|
||||
{
|
||||
move(X86Registers::eax, scratchRegister);
|
||||
move(imm, X86Registers::eax);
|
||||
|
@ -311,7 +311,7 @@ public:
|
|||
m_assembler.movq_rm(src, address.offset, address.base);
|
||||
}
|
||||
|
||||
void storePtr(ImmPtr imm, BaseIndex address)
|
||||
void storePtr(TrustedImmPtr imm, BaseIndex address)
|
||||
{
|
||||
intptr_t value = intptr_t(imm.m_value);
|
||||
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void storePtr(ImmPtr imm, ImplicitAddress address)
|
||||
void storePtr(TrustedImmPtr imm, ImplicitAddress address)
|
||||
{
|
||||
intptr_t value = intptr_t(imm.m_value);
|
||||
|
||||
|
@ -487,7 +487,7 @@ public:
|
|||
return Jump(m_assembler.jCC(x86Condition(cond)));
|
||||
}
|
||||
|
||||
DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
|
||||
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
|
||||
{
|
||||
m_assembler.movq_i64r(initialValue.asIntptr(), dest);
|
||||
return DataLabelPtr(this);
|
||||
|
@ -505,7 +505,7 @@ public:
|
|||
return branchPtr(cond, left, scratchRegister);
|
||||
}
|
||||
|
||||
DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
|
||||
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
|
||||
{
|
||||
DataLabelPtr label = moveWithPatch(initialValue, scratchRegister);
|
||||
storePtr(scratchRegister, address);
|
||||
|
|
|
@ -52,16 +52,16 @@ extern "C" void sync_instruction_memory(caddr_t v, u_int len);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if WTF_PLATFORM_IPHONE
|
||||
#if WTF_OS_IOS
|
||||
#include <libkern/OSCacheControl.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if WTF_PLATFORM_SYMBIAN
|
||||
#if WTF_OS_SYMBIAN
|
||||
#include <e32std.h>
|
||||
#endif
|
||||
|
||||
#if WTF_CPU_MIPS && WTF_PLATFORM_LINUX
|
||||
#if WTF_CPU_MIPS && WTF_OS_LINUX
|
||||
#include <sys/cachectl.h>
|
||||
#endif
|
||||
|
||||
|
@ -90,7 +90,7 @@ private:
|
|||
struct Allocation {
|
||||
char* pages;
|
||||
size_t size;
|
||||
#if WTF_PLATFORM_SYMBIAN
|
||||
#if WTF_OS_SYMBIAN
|
||||
RChunk* chunk;
|
||||
#endif
|
||||
};
|
||||
|
@ -269,6 +269,7 @@ private:
|
|||
return pool;
|
||||
}
|
||||
|
||||
public:
|
||||
ExecutablePool* poolForSize(size_t n)
|
||||
{
|
||||
#ifndef DEBUG_STRESS_JSC_ALLOCATOR
|
||||
|
@ -327,7 +328,6 @@ private:
|
|||
return pool;
|
||||
}
|
||||
|
||||
public:
|
||||
#if ENABLE_ASSEMBLER_WX_EXCLUSIVE
|
||||
static void makeWritable(void* start, size_t size)
|
||||
{
|
||||
|
@ -374,13 +374,13 @@ public:
|
|||
_flush_cache(reinterpret_cast<char*>(code), size, BCACHE);
|
||||
#endif
|
||||
}
|
||||
#elif WTF_CPU_ARM_THUMB2 && WTF_PLATFORM_IPHONE
|
||||
#elif WTF_CPU_ARM_THUMB2 && WTF_OS_IOS
|
||||
static void cacheFlush(void* code, size_t size)
|
||||
{
|
||||
sys_dcache_flush(code, size);
|
||||
sys_icache_invalidate(code, size);
|
||||
}
|
||||
#elif WTF_CPU_ARM_THUMB2 && WTF_PLATFORM_LINUX
|
||||
#elif WTF_CPU_ARM_THUMB2 && WTF_IOS
|
||||
static void cacheFlush(void* code, size_t size)
|
||||
{
|
||||
asm volatile (
|
||||
|
@ -396,14 +396,14 @@ public:
|
|||
: "r" (code), "r" (reinterpret_cast<char*>(code) + size)
|
||||
: "r0", "r1", "r2");
|
||||
}
|
||||
#elif WTF_PLATFORM_SYMBIAN
|
||||
#elif WTF_OS_SYMBIAN
|
||||
static void cacheFlush(void* code, size_t size)
|
||||
{
|
||||
User::IMB_Range(code, static_cast<char*>(code) + size);
|
||||
}
|
||||
#elif WTF_CPU_ARM_TRADITIONAL && WTF_PLATFORM_LINUX && WTF_COMPILER_RVCT
|
||||
#elif WTF_CPU_ARM_TRADITIONAL && WTF_OS_LINUX && WTF_COMPILER_RVCT
|
||||
static __asm void cacheFlush(void* code, size_t size);
|
||||
#elif WTF_CPU_ARM_TRADITIONAL && (WTF_PLATFORM_LINUX || WTF_PLATFORM_ANDROID) && WTF_COMPILER_GCC
|
||||
#elif WTF_CPU_ARM_TRADITIONAL && (WTF_OS_LINUX || WTF_OS_ANDROID) && WTF_COMPILER_GCC
|
||||
static void cacheFlush(void* code, size_t size)
|
||||
{
|
||||
asm volatile (
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "ExecutableAllocator.h"
|
||||
|
||||
#if ENABLE_ASSEMBLER && WTF_PLATFORM_OS2
|
||||
#if ENABLE_ASSEMBLER && WTF_OS_OS2
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "ExecutableAllocator.h"
|
||||
|
||||
#if ENABLE_ASSEMBLER && WTF_PLATFORM_UNIX && !WTF_PLATFORM_SYMBIAN
|
||||
#if ENABLE_ASSEMBLER && WTF_OS_UNIX && !WTF_OS_SYMBIAN
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
@ -74,7 +74,7 @@ void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSe
|
|||
}
|
||||
#endif
|
||||
|
||||
#if WTF_CPU_ARM_TRADITIONAL && WTF_PLATFORM_LINUX && WTF_COMPILER_RVCT
|
||||
#if WTF_CPU_ARM_TRADITIONAL && WTF_OS_LINUX && WTF_COMPILER_RVCT
|
||||
__asm void ExecutableAllocator::cacheFlush(void* code, size_t size)
|
||||
{
|
||||
ARM
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "ExecutableAllocator.h"
|
||||
|
||||
#if ENABLE_ASSEMBLER && WTF_PLATFORM_SYMBIAN
|
||||
#if ENABLE_ASSEMBLER && WTF_OS_SYMBIAN
|
||||
|
||||
#include <e32hal.h>
|
||||
#include <e32std.h>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "ExecutableAllocator.h"
|
||||
|
||||
#if ENABLE_ASSEMBLER && WTF_PLATFORM_WIN_OS
|
||||
#if ENABLE_ASSEMBLER && WTF_OS_WINDOWS
|
||||
|
||||
#include "jswin.h"
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1842,7 +1842,7 @@ ImplicitConvert(JSContext* cx,
|
|||
case TYPE_unsigned_char: {
|
||||
// Convert from UTF-16 to UTF-8.
|
||||
size_t nbytes =
|
||||
js_GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
if (nbytes == (size_t) -1)
|
||||
return false;
|
||||
|
||||
|
@ -1853,7 +1853,7 @@ ImplicitConvert(JSContext* cx,
|
|||
return false;
|
||||
}
|
||||
|
||||
ASSERT_OK(js_DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength,
|
||||
ASSERT_OK(DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength,
|
||||
*charBuffer, &nbytes));
|
||||
(*charBuffer)[nbytes] = 0;
|
||||
*freePointer = true;
|
||||
|
@ -1899,7 +1899,7 @@ ImplicitConvert(JSContext* cx,
|
|||
case TYPE_unsigned_char: {
|
||||
// Convert from UTF-16 to UTF-8.
|
||||
size_t nbytes =
|
||||
js_GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
if (nbytes == (size_t) -1)
|
||||
return false;
|
||||
|
||||
|
@ -1909,7 +1909,7 @@ ImplicitConvert(JSContext* cx,
|
|||
}
|
||||
|
||||
char* charBuffer = static_cast<char*>(buffer);
|
||||
ASSERT_OK(js_DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength,
|
||||
ASSERT_OK(DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength,
|
||||
charBuffer, &nbytes));
|
||||
|
||||
if (targetLength > nbytes)
|
||||
|
@ -3584,7 +3584,7 @@ ArrayType::ConstructData(JSContext* cx,
|
|||
case TYPE_signed_char:
|
||||
case TYPE_unsigned_char: {
|
||||
// Determine the UTF-8 length.
|
||||
length = js_GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
length = GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength);
|
||||
if (length == (size_t) -1)
|
||||
return false;
|
||||
|
||||
|
@ -5766,7 +5766,7 @@ CData::ReadString(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
// Determine the length.
|
||||
size_t dstlen;
|
||||
if (!js_InflateUTF8StringToBuffer(cx, bytes, length, NULL, &dstlen))
|
||||
if (!InflateUTF8StringToBuffer(cx, bytes, length, NULL, &dstlen))
|
||||
return JS_FALSE;
|
||||
|
||||
jschar* dst =
|
||||
|
@ -5774,7 +5774,7 @@ CData::ReadString(JSContext* cx, uintN argc, jsval* vp)
|
|||
if (!dst)
|
||||
return JS_FALSE;
|
||||
|
||||
ASSERT_OK(js_InflateUTF8StringToBuffer(cx, bytes, length, dst, &dstlen));
|
||||
ASSERT_OK(InflateUTF8StringToBuffer(cx, bytes, length, dst, &dstlen));
|
||||
dst[dstlen] = 0;
|
||||
|
||||
result = JS_NewUCString(cx, dst, dstlen);
|
||||
|
|
|
@ -159,7 +159,7 @@ Library::Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks)
|
|||
// Fallback: assume the platform native charset is UTF-8. This is true
|
||||
// for Mac OS X, Android, and probably Linux.
|
||||
size_t nbytes =
|
||||
js_GetDeflatedUTF8StringLength(cx, pathStr->chars(), pathStr->length());
|
||||
GetDeflatedUTF8StringLength(cx, pathStr->chars(), pathStr->length());
|
||||
if (nbytes == (size_t) -1)
|
||||
return NULL;
|
||||
|
||||
|
@ -167,7 +167,7 @@ Library::Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks)
|
|||
if (!pathBytes)
|
||||
return NULL;
|
||||
|
||||
ASSERT_OK(js_DeflateStringToUTF8Buffer(cx, pathStr->chars(),
|
||||
ASSERT_OK(DeflateStringToUTF8Buffer(cx, pathStr->chars(),
|
||||
pathStr->length(), pathBytes, &nbytes));
|
||||
pathBytes[nbytes] = 0;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ def run_tests(tests, test_dir, lib_dir, shell_args):
|
|||
|
||||
def show_test(test):
|
||||
if OPTIONS.show_failed:
|
||||
print(' ' + subprocess.list2cmdline(get_test_cmd(test.path, test.jitflags, lib_dir)))
|
||||
print(' ' + subprocess.list2cmdline(get_test_cmd(test.path, test.jitflags, lib_dir, shell_args)))
|
||||
else:
|
||||
print(' ' + ' '.join(test.jitflags + [ test.path ]))
|
||||
|
||||
|
@ -494,6 +494,8 @@ def main(argv):
|
|||
job_list.append(new_test)
|
||||
|
||||
|
||||
shell_args = shlex.split(OPTIONS.shell_args)
|
||||
|
||||
if OPTIONS.debug:
|
||||
if len(job_list) > 1:
|
||||
print('Multiple tests match command line arguments, debugger can only run one')
|
||||
|
@ -502,12 +504,10 @@ def main(argv):
|
|||
sys.exit(1)
|
||||
|
||||
tc = job_list[0]
|
||||
cmd = [ 'gdb', '--args' ] + get_test_cmd(tc.path, tc.jitflags, lib_dir)
|
||||
cmd = [ 'gdb', '--args' ] + get_test_cmd(tc.path, tc.jitflags, lib_dir, shell_args)
|
||||
call(cmd)
|
||||
sys.exit()
|
||||
|
||||
shell_args = shlex.split(OPTIONS.shell_args)
|
||||
|
||||
try:
|
||||
ok = run_tests(job_list, test_dir, lib_dir, shell_args)
|
||||
if not ok:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
var Q = 0;
|
||||
var thrown = false;
|
||||
try {
|
||||
(function f(i) { Q = i; if (i == 100000) return; f(i+1); })(1)
|
||||
(function f(i) { Q = i; if (i == 200000) return; f(i+1); })(1)
|
||||
} catch (e) {
|
||||
thrown = true;
|
||||
}
|
||||
|
||||
// Exact behavior of recursion check depends on which JIT we use.
|
||||
var ok = (Q == 3000 || Q == 3001);
|
||||
assertEq(ok, true);
|
||||
assertEq(thrown && Q > 10000, true);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ try {
|
|||
Function("\
|
||||
(function f() {\
|
||||
({x:{b}}=x);\
|
||||
f()\
|
||||
f.apply(null, new Array(100))\
|
||||
})()\
|
||||
")()
|
||||
} catch (e) {
|
||||
|
|
|
@ -3,7 +3,7 @@ try {
|
|||
Function("\
|
||||
(function f() {\
|
||||
({x}=x);\
|
||||
f()\
|
||||
f.apply(null, new Array(100))\
|
||||
})()\
|
||||
")()
|
||||
} catch (e) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
function Foo() {
|
||||
u = 0;
|
||||
}
|
||||
|
||||
var x = new Foo();
|
||||
assertEq(Object.getPrototypeOf(x) === Foo.prototype, true);
|
||||
assertEq(Object.getPrototypeOf(x) === Object.prototype, false);
|
|
@ -1,5 +1,3 @@
|
|||
// |jit-test| error: InternalError: regular expression too complex
|
||||
|
||||
var sText = "s";
|
||||
|
||||
for (var i = 0; i < 250000; ++i)
|
||||
|
@ -12,6 +10,5 @@ var match = sText.match(/s(\s|.)*?e/gi);
|
|||
//var match = sText.match(/s([\s\S]*?)e/gi);
|
||||
//var match = sText.match(/s(?:[\s\S]*?)e/gi);
|
||||
var end = new Date();
|
||||
print(end - start);
|
||||
|
||||
assertEq(match.length, 1);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
function build_getter(i) {
|
||||
var x = [i];
|
||||
return function f() { return x; }
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
var N = internalConst("OBJECT_MARK_STACK_LENGTH") + 2;
|
||||
var o = {};
|
||||
var descriptor = { enumerable: true};
|
||||
for (var i = 0; i != N; ++i) {
|
||||
descriptor.get = build_getter(i);
|
||||
Object.defineProperty(o, i, descriptor);
|
||||
}
|
||||
|
||||
// At this point we have an object o with N getters. Each getter in turn
|
||||
// is a closure storing an array. During the GC we push to the object
|
||||
// marking stack all the getters found in an object after we mark it. As N
|
||||
// exceeds the size of the object marking stack, this requires to run the
|
||||
// dealyed scanning for some closures to mark the array objects stored in
|
||||
// them.
|
||||
//
|
||||
// We run the GC twice to make sure that the background finalization
|
||||
// finishes before we access the objects.
|
||||
gc();
|
||||
gc();
|
||||
for (var i = 0; i != N; ++i)
|
||||
assertEq(o[i][0], i);
|
||||
}
|
||||
|
||||
test();
|
|
@ -0,0 +1,14 @@
|
|||
function f(x) {
|
||||
if (x == 0)
|
||||
return;
|
||||
arguments[0]--;
|
||||
f.apply(null, arguments);
|
||||
}
|
||||
|
||||
// When the apply-optimization isn't on, each recursive call chews up the C
|
||||
// stack, so don't push it.
|
||||
a = [20];
|
||||
|
||||
for (var i = 0; i < 2000; ++i)
|
||||
a.push(i);
|
||||
f.apply(null, a);
|
|
@ -0,0 +1,741 @@
|
|||
function test1 (x) {
|
||||
assertEq(x | -1, -1);
|
||||
assertEq(-1 | x, -1);
|
||||
assertEq(x & -1, 1);
|
||||
assertEq(-1 & x, 1);
|
||||
assertEq(x ^ -1, -2);
|
||||
assertEq(-1 ^ x, -2);
|
||||
assertEq(x >> -1, 0);
|
||||
assertEq(-1 >> x, -1);
|
||||
assertEq(x >>> -1, 0);
|
||||
assertEq(-1 >>> x, 2147483647);
|
||||
assertEq(x << -1, -2147483648);
|
||||
assertEq(-1 << x, -2);
|
||||
assertEq(x | 1, 1);
|
||||
assertEq(1 | x, 1);
|
||||
assertEq(x & 1, 1);
|
||||
assertEq(1 & x, 1);
|
||||
assertEq(x ^ 1, 0);
|
||||
assertEq(1 ^ x, 0);
|
||||
assertEq(x >> 1, 0);
|
||||
assertEq(1 >> x, 0);
|
||||
assertEq(x >>> 1, 0);
|
||||
assertEq(1 >>> x, 0);
|
||||
assertEq(x << 1, 2);
|
||||
assertEq(1 << x, 2);
|
||||
assertEq(x | 0, 1);
|
||||
assertEq(0 | x, 1);
|
||||
assertEq(x & 0, 0);
|
||||
assertEq(0 & x, 0);
|
||||
assertEq(x ^ 0, 1);
|
||||
assertEq(0 ^ x, 1);
|
||||
assertEq(x >> 0, 1);
|
||||
assertEq(0 >> x, 0);
|
||||
assertEq(x >>> 0, 1);
|
||||
assertEq(0 >>> x, 0);
|
||||
assertEq(x << 0, 1);
|
||||
assertEq(0 << x, 0);
|
||||
assertEq(x | 0xffffffff, -1);
|
||||
assertEq(0xffffffff | x, -1);
|
||||
assertEq(x & 0xffffffff, 1);
|
||||
assertEq(0xffffffff & x, 1);
|
||||
assertEq(x ^ 0xffffffff, -2);
|
||||
assertEq(0xffffffff ^ x, -2);
|
||||
assertEq(x >> 0xffffffff, 0);
|
||||
assertEq(0xffffffff >> x, -1);
|
||||
assertEq(x >>> 0xffffffff, 0);
|
||||
assertEq(0xffffffff >>> x, 2147483647);
|
||||
assertEq(x << 0xffffffff, -2147483648);
|
||||
assertEq(0xffffffff << x, -2);
|
||||
assertEq(x | "10.6", 11);
|
||||
assertEq("10.6" | x, 11);
|
||||
assertEq(x & "10.6", 0);
|
||||
assertEq("10.6" & x, 0);
|
||||
assertEq(x ^ "10.6", 11);
|
||||
assertEq("10.6" ^ x, 11);
|
||||
assertEq(x >> "10.6", 0);
|
||||
assertEq("10.6" >> x, 5);
|
||||
assertEq(x >>> "10.6", 0);
|
||||
assertEq("10.6" >>> x, 5);
|
||||
assertEq(x << "10.6", 1024);
|
||||
assertEq("10.6" << x, 20);
|
||||
assertEq(x | 2147483648, -2147483647);
|
||||
assertEq(2147483648 | x, -2147483647);
|
||||
assertEq(x & 2147483648, 0);
|
||||
assertEq(2147483648 & x, 0);
|
||||
assertEq(x ^ 2147483648, -2147483647);
|
||||
assertEq(2147483648 ^ x, -2147483647);
|
||||
assertEq(x >> 2147483648, 1);
|
||||
assertEq(2147483648 >> x, -1073741824);
|
||||
assertEq(x >>> 2147483648, 1);
|
||||
assertEq(2147483648 >>> x, 1073741824);
|
||||
assertEq(x << 2147483648, 1);
|
||||
assertEq(2147483648 << x, 0);
|
||||
assertEq(x | 4294967296, 1);
|
||||
assertEq(4294967296 | x, 1);
|
||||
assertEq(x & 4294967296, 0);
|
||||
assertEq(4294967296 & x, 0);
|
||||
assertEq(x ^ 4294967296, 1);
|
||||
assertEq(4294967296 ^ x, 1);
|
||||
assertEq(x >> 4294967296, 1);
|
||||
assertEq(4294967296 >> x, 0);
|
||||
assertEq(x >>> 4294967296, 1);
|
||||
assertEq(4294967296 >>> x, 0);
|
||||
assertEq(x << 4294967296, 1);
|
||||
assertEq(4294967296 << x, 0);
|
||||
assertEq(x | undefined, 1);
|
||||
assertEq(undefined | x, 1);
|
||||
assertEq(x & undefined, 0);
|
||||
assertEq(undefined & x, 0);
|
||||
assertEq(x ^ undefined, 1);
|
||||
assertEq(undefined ^ x, 1);
|
||||
assertEq(x >> undefined, 1);
|
||||
assertEq(undefined >> x, 0);
|
||||
assertEq(x >>> undefined, 1);
|
||||
assertEq(undefined >>> x, 0);
|
||||
assertEq(x << undefined, 1);
|
||||
assertEq(undefined << x, 0);
|
||||
assertEq(x | null, 1);
|
||||
assertEq(null | x, 1);
|
||||
assertEq(x & null, 0);
|
||||
assertEq(null & x, 0);
|
||||
assertEq(x ^ null, 1);
|
||||
assertEq(null ^ x, 1);
|
||||
assertEq(x >> null, 1);
|
||||
assertEq(null >> x, 0);
|
||||
assertEq(x >>> null, 1);
|
||||
assertEq(null >>> x, 0);
|
||||
assertEq(x << null, 1);
|
||||
assertEq(null << x, 0);
|
||||
assertEq(x | false, 1);
|
||||
assertEq(false | x, 1);
|
||||
assertEq(x & false, 0);
|
||||
assertEq(false & x, 0);
|
||||
assertEq(x ^ false, 1);
|
||||
assertEq(false ^ x, 1);
|
||||
assertEq(x >> false, 1);
|
||||
assertEq(false >> x, 0);
|
||||
assertEq(x >>> false, 1);
|
||||
assertEq(false >>> x, 0);
|
||||
assertEq(x << false, 1);
|
||||
assertEq(false << x, 0);
|
||||
assertEq(x | true, 1);
|
||||
assertEq(true | x, 1);
|
||||
assertEq(x & true, 1);
|
||||
assertEq(true & x, 1);
|
||||
assertEq(x ^ true, 0);
|
||||
assertEq(true ^ x, 0);
|
||||
assertEq(x >> true, 0);
|
||||
assertEq(true >> x, 0);
|
||||
assertEq(x >>> true, 0);
|
||||
assertEq(true >>> x, 0);
|
||||
assertEq(x << true, 2);
|
||||
assertEq(true << x, 2);
|
||||
assertEq(x | -1.5, -1);
|
||||
assertEq(-1.5 | x, -1);
|
||||
assertEq(x & -1.5, 1);
|
||||
assertEq(-1.5 & x, 1);
|
||||
assertEq(x ^ -1.5, -2);
|
||||
assertEq(-1.5 ^ x, -2);
|
||||
assertEq(x >> -1.5, 0);
|
||||
assertEq(-1.5 >> x, -1);
|
||||
assertEq(x >>> -1.5, 0);
|
||||
assertEq(-1.5 >>> x, 2147483647);
|
||||
assertEq(x << -1.5, -2147483648);
|
||||
assertEq(-1.5 << x, -2);
|
||||
}
|
||||
test1(1)
|
||||
|
||||
function test2 (x) {
|
||||
assertEq(x | -1, -1);
|
||||
assertEq(-1 | x, -1);
|
||||
assertEq(x & -1, 0);
|
||||
assertEq(-1 & x, 0);
|
||||
assertEq(x ^ -1, -1);
|
||||
assertEq(-1 ^ x, -1);
|
||||
assertEq(x >> -1, 0);
|
||||
assertEq(-1 >> x, -1);
|
||||
assertEq(x >>> -1, 0);
|
||||
assertEq(-1 >>> x, 4294967295);
|
||||
assertEq(x << -1, 0);
|
||||
assertEq(-1 << x, -1);
|
||||
assertEq(x | 1, 1);
|
||||
assertEq(1 | x, 1);
|
||||
assertEq(x & 1, 0);
|
||||
assertEq(1 & x, 0);
|
||||
assertEq(x ^ 1, 1);
|
||||
assertEq(1 ^ x, 1);
|
||||
assertEq(x >> 1, 0);
|
||||
assertEq(1 >> x, 1);
|
||||
assertEq(x >>> 1, 0);
|
||||
assertEq(1 >>> x, 1);
|
||||
assertEq(x << 1, 0);
|
||||
assertEq(1 << x, 1);
|
||||
assertEq(x | 0, 0);
|
||||
assertEq(0 | x, 0);
|
||||
assertEq(x & 0, 0);
|
||||
assertEq(0 & x, 0);
|
||||
assertEq(x ^ 0, 0);
|
||||
assertEq(0 ^ x, 0);
|
||||
assertEq(x >> 0, 0);
|
||||
assertEq(0 >> x, 0);
|
||||
assertEq(x >>> 0, 0);
|
||||
assertEq(0 >>> x, 0);
|
||||
assertEq(x << 0, 0);
|
||||
assertEq(0 << x, 0);
|
||||
assertEq(x | 0xffffffff, -1);
|
||||
assertEq(0xffffffff | x, -1);
|
||||
assertEq(x & 0xffffffff, 0);
|
||||
assertEq(0xffffffff & x, 0);
|
||||
assertEq(x ^ 0xffffffff, -1);
|
||||
assertEq(0xffffffff ^ x, -1);
|
||||
assertEq(x >> 0xffffffff, 0);
|
||||
assertEq(0xffffffff >> x, -1);
|
||||
assertEq(x >>> 0xffffffff, 0);
|
||||
assertEq(0xffffffff >>> x, 4294967295);
|
||||
assertEq(x << 0xffffffff, 0);
|
||||
assertEq(0xffffffff << x, -1);
|
||||
assertEq(x | "10.6", 10);
|
||||
assertEq("10.6" | x, 10);
|
||||
assertEq(x & "10.6", 0);
|
||||
assertEq("10.6" & x, 0);
|
||||
assertEq(x ^ "10.6", 10);
|
||||
assertEq("10.6" ^ x, 10);
|
||||
assertEq(x >> "10.6", 0);
|
||||
assertEq("10.6" >> x, 10);
|
||||
assertEq(x >>> "10.6", 0);
|
||||
assertEq("10.6" >>> x, 10);
|
||||
assertEq(x << "10.6", 0);
|
||||
assertEq("10.6" << x, 10);
|
||||
assertEq(x | 2147483648, -2147483648);
|
||||
assertEq(2147483648 | x, -2147483648);
|
||||
assertEq(x & 2147483648, 0);
|
||||
assertEq(2147483648 & x, 0);
|
||||
assertEq(x ^ 2147483648, -2147483648);
|
||||
assertEq(2147483648 ^ x, -2147483648);
|
||||
assertEq(x >> 2147483648, 0);
|
||||
assertEq(2147483648 >> x, -2147483648);
|
||||
assertEq(x >>> 2147483648, 0);
|
||||
assertEq(2147483648 >>> x, 2147483648);
|
||||
assertEq(x << 2147483648, 0);
|
||||
assertEq(2147483648 << x, -2147483648);
|
||||
assertEq(x | 4294967296, 0);
|
||||
assertEq(4294967296 | x, 0);
|
||||
assertEq(x & 4294967296, 0);
|
||||
assertEq(4294967296 & x, 0);
|
||||
assertEq(x ^ 4294967296, 0);
|
||||
assertEq(4294967296 ^ x, 0);
|
||||
assertEq(x >> 4294967296, 0);
|
||||
assertEq(4294967296 >> x, 0);
|
||||
assertEq(x >>> 4294967296, 0);
|
||||
assertEq(4294967296 >>> x, 0);
|
||||
assertEq(x << 4294967296, 0);
|
||||
assertEq(4294967296 << x, 0);
|
||||
assertEq(x | undefined, 0);
|
||||
assertEq(undefined | x, 0);
|
||||
assertEq(x & undefined, 0);
|
||||
assertEq(undefined & x, 0);
|
||||
assertEq(x ^ undefined, 0);
|
||||
assertEq(undefined ^ x, 0);
|
||||
assertEq(x >> undefined, 0);
|
||||
assertEq(undefined >> x, 0);
|
||||
assertEq(x >>> undefined, 0);
|
||||
assertEq(undefined >>> x, 0);
|
||||
assertEq(x << undefined, 0);
|
||||
assertEq(undefined << x, 0);
|
||||
assertEq(x | null, 0);
|
||||
assertEq(null | x, 0);
|
||||
assertEq(x & null, 0);
|
||||
assertEq(null & x, 0);
|
||||
assertEq(x ^ null, 0);
|
||||
assertEq(null ^ x, 0);
|
||||
assertEq(x >> null, 0);
|
||||
assertEq(null >> x, 0);
|
||||
assertEq(x >>> null, 0);
|
||||
assertEq(null >>> x, 0);
|
||||
assertEq(x << null, 0);
|
||||
assertEq(null << x, 0);
|
||||
assertEq(x | false, 0);
|
||||
assertEq(false | x, 0);
|
||||
assertEq(x & false, 0);
|
||||
assertEq(false & x, 0);
|
||||
assertEq(x ^ false, 0);
|
||||
assertEq(false ^ x, 0);
|
||||
assertEq(x >> false, 0);
|
||||
assertEq(false >> x, 0);
|
||||
assertEq(x >>> false, 0);
|
||||
assertEq(false >>> x, 0);
|
||||
assertEq(x << false, 0);
|
||||
assertEq(false << x, 0);
|
||||
assertEq(x | true, 1);
|
||||
assertEq(true | x, 1);
|
||||
assertEq(x & true, 0);
|
||||
assertEq(true & x, 0);
|
||||
assertEq(x ^ true, 1);
|
||||
assertEq(true ^ x, 1);
|
||||
assertEq(x >> true, 0);
|
||||
assertEq(true >> x, 1);
|
||||
assertEq(x >>> true, 0);
|
||||
assertEq(true >>> x, 1);
|
||||
assertEq(x << true, 0);
|
||||
assertEq(true << x, 1);
|
||||
assertEq(x | -1.5, -1);
|
||||
assertEq(-1.5 | x, -1);
|
||||
assertEq(x & -1.5, 0);
|
||||
assertEq(-1.5 & x, 0);
|
||||
assertEq(x ^ -1.5, -1);
|
||||
assertEq(-1.5 ^ x, -1);
|
||||
assertEq(x >> -1.5, 0);
|
||||
assertEq(-1.5 >> x, -1);
|
||||
assertEq(x >>> -1.5, 0);
|
||||
assertEq(-1.5 >>> x, 4294967295);
|
||||
assertEq(x << -1.5, 0);
|
||||
assertEq(-1.5 << x, -1);
|
||||
}
|
||||
test2(0)
|
||||
|
||||
function test3 (x) {
|
||||
assertEq(x | -1, -1);
|
||||
assertEq(-1 | x, -1);
|
||||
assertEq(x & -1, -1);
|
||||
assertEq(-1 & x, -1);
|
||||
assertEq(x ^ -1, 0);
|
||||
assertEq(-1 ^ x, 0);
|
||||
assertEq(x >> -1, -1);
|
||||
assertEq(-1 >> x, -1);
|
||||
assertEq(x >>> -1, 1);
|
||||
assertEq(-1 >>> x, 1);
|
||||
assertEq(x << -1, -2147483648);
|
||||
assertEq(-1 << x, -2147483648);
|
||||
assertEq(x | 1, -1);
|
||||
assertEq(1 | x, -1);
|
||||
assertEq(x & 1, 1);
|
||||
assertEq(1 & x, 1);
|
||||
assertEq(x ^ 1, -2);
|
||||
assertEq(1 ^ x, -2);
|
||||
assertEq(x >> 1, -1);
|
||||
assertEq(1 >> x, 0);
|
||||
assertEq(x >>> 1, 2147483647);
|
||||
assertEq(1 >>> x, 0);
|
||||
assertEq(x << 1, -2);
|
||||
assertEq(1 << x, -2147483648);
|
||||
assertEq(x | 0, -1);
|
||||
assertEq(0 | x, -1);
|
||||
assertEq(x & 0, 0);
|
||||
assertEq(0 & x, 0);
|
||||
assertEq(x ^ 0, -1);
|
||||
assertEq(0 ^ x, -1);
|
||||
assertEq(x >> 0, -1);
|
||||
assertEq(0 >> x, 0);
|
||||
assertEq(x >>> 0, 4294967295);
|
||||
assertEq(0 >>> x, 0);
|
||||
assertEq(x << 0, -1);
|
||||
assertEq(0 << x, 0);
|
||||
assertEq(x | 0xffffffff, -1);
|
||||
assertEq(0xffffffff | x, -1);
|
||||
assertEq(x & 0xffffffff, -1);
|
||||
assertEq(0xffffffff & x, -1);
|
||||
assertEq(x ^ 0xffffffff, 0);
|
||||
assertEq(0xffffffff ^ x, 0);
|
||||
assertEq(x >> 0xffffffff, -1);
|
||||
assertEq(0xffffffff >> x, -1);
|
||||
assertEq(x >>> 0xffffffff, 1);
|
||||
assertEq(0xffffffff >>> x, 1);
|
||||
assertEq(x << 0xffffffff, -2147483648);
|
||||
assertEq(0xffffffff << x, -2147483648);
|
||||
assertEq(x | "10.6", -1);
|
||||
assertEq("10.6" | x, -1);
|
||||
assertEq(x & "10.6", 10);
|
||||
assertEq("10.6" & x, 10);
|
||||
assertEq(x ^ "10.6", -11);
|
||||
assertEq("10.6" ^ x, -11);
|
||||
assertEq(x >> "10.6", -1);
|
||||
assertEq("10.6" >> x, 0);
|
||||
assertEq(x >>> "10.6", 4194303);
|
||||
assertEq("10.6" >>> x, 0);
|
||||
assertEq(x << "10.6", -1024);
|
||||
assertEq("10.6" << x, 0);
|
||||
assertEq(x | 2147483648, -1);
|
||||
assertEq(2147483648 | x, -1);
|
||||
assertEq(x & 2147483648, -2147483648);
|
||||
assertEq(2147483648 & x, -2147483648);
|
||||
assertEq(x ^ 2147483648, 2147483647);
|
||||
assertEq(2147483648 ^ x, 2147483647);
|
||||
assertEq(x >> 2147483648, -1);
|
||||
assertEq(2147483648 >> x, -1);
|
||||
assertEq(x >>> 2147483648, 4294967295);
|
||||
assertEq(2147483648 >>> x, 1);
|
||||
assertEq(x << 2147483648, -1);
|
||||
assertEq(2147483648 << x, 0);
|
||||
assertEq(x | 4294967296, -1);
|
||||
assertEq(4294967296 | x, -1);
|
||||
assertEq(x & 4294967296, 0);
|
||||
assertEq(4294967296 & x, 0);
|
||||
assertEq(x ^ 4294967296, -1);
|
||||
assertEq(4294967296 ^ x, -1);
|
||||
assertEq(x >> 4294967296, -1);
|
||||
assertEq(4294967296 >> x, 0);
|
||||
assertEq(x >>> 4294967296, 4294967295);
|
||||
assertEq(4294967296 >>> x, 0);
|
||||
assertEq(x << 4294967296, -1);
|
||||
assertEq(4294967296 << x, 0);
|
||||
assertEq(x | undefined, -1);
|
||||
assertEq(undefined | x, -1);
|
||||
assertEq(x & undefined, 0);
|
||||
assertEq(undefined & x, 0);
|
||||
assertEq(x ^ undefined, -1);
|
||||
assertEq(undefined ^ x, -1);
|
||||
assertEq(x >> undefined, -1);
|
||||
assertEq(undefined >> x, 0);
|
||||
assertEq(x >>> undefined, 4294967295);
|
||||
assertEq(undefined >>> x, 0);
|
||||
assertEq(x << undefined, -1);
|
||||
assertEq(undefined << x, 0);
|
||||
assertEq(x | null, -1);
|
||||
assertEq(null | x, -1);
|
||||
assertEq(x & null, 0);
|
||||
assertEq(null & x, 0);
|
||||
assertEq(x ^ null, -1);
|
||||
assertEq(null ^ x, -1);
|
||||
assertEq(x >> null, -1);
|
||||
assertEq(null >> x, 0);
|
||||
assertEq(x >>> null, 4294967295);
|
||||
assertEq(null >>> x, 0);
|
||||
assertEq(x << null, -1);
|
||||
assertEq(null << x, 0);
|
||||
assertEq(x | false, -1);
|
||||
assertEq(false | x, -1);
|
||||
assertEq(x & false, 0);
|
||||
assertEq(false & x, 0);
|
||||
assertEq(x ^ false, -1);
|
||||
assertEq(false ^ x, -1);
|
||||
assertEq(x >> false, -1);
|
||||
assertEq(false >> x, 0);
|
||||
assertEq(x >>> false, 4294967295);
|
||||
assertEq(false >>> x, 0);
|
||||
assertEq(x << false, -1);
|
||||
assertEq(false << x, 0);
|
||||
assertEq(x | true, -1);
|
||||
assertEq(true | x, -1);
|
||||
assertEq(x & true, 1);
|
||||
assertEq(true & x, 1);
|
||||
assertEq(x ^ true, -2);
|
||||
assertEq(true ^ x, -2);
|
||||
assertEq(x >> true, -1);
|
||||
assertEq(true >> x, 0);
|
||||
assertEq(x >>> true, 2147483647);
|
||||
assertEq(true >>> x, 0);
|
||||
assertEq(x << true, -2);
|
||||
assertEq(true << x, -2147483648);
|
||||
assertEq(x | -1.5, -1);
|
||||
assertEq(-1.5 | x, -1);
|
||||
assertEq(x & -1.5, -1);
|
||||
assertEq(-1.5 & x, -1);
|
||||
assertEq(x ^ -1.5, 0);
|
||||
assertEq(-1.5 ^ x, 0);
|
||||
assertEq(x >> -1.5, -1);
|
||||
assertEq(-1.5 >> x, -1);
|
||||
assertEq(x >>> -1.5, 1);
|
||||
assertEq(-1.5 >>> x, 1);
|
||||
assertEq(x << -1.5, -2147483648);
|
||||
assertEq(-1.5 << x, -2147483648);
|
||||
}
|
||||
test3(-1)
|
||||
|
||||
function test4 (x) {
|
||||
assertEq(x | -1, -1);
|
||||
assertEq(-1 | x, -1);
|
||||
assertEq(x & -1, -2147483648);
|
||||
assertEq(-1 & x, -2147483648);
|
||||
assertEq(x ^ -1, 2147483647);
|
||||
assertEq(-1 ^ x, 2147483647);
|
||||
assertEq(x >> -1, -1);
|
||||
assertEq(-1 >> x, -1);
|
||||
assertEq(x >>> -1, 1);
|
||||
assertEq(-1 >>> x, 4294967295);
|
||||
assertEq(x << -1, 0);
|
||||
assertEq(-1 << x, -1);
|
||||
assertEq(x | 1, -2147483647);
|
||||
assertEq(1 | x, -2147483647);
|
||||
assertEq(x & 1, 0);
|
||||
assertEq(1 & x, 0);
|
||||
assertEq(x ^ 1, -2147483647);
|
||||
assertEq(1 ^ x, -2147483647);
|
||||
assertEq(x >> 1, -1073741824);
|
||||
assertEq(1 >> x, 1);
|
||||
assertEq(x >>> 1, 1073741824);
|
||||
assertEq(1 >>> x, 1);
|
||||
assertEq(x << 1, 0);
|
||||
assertEq(1 << x, 1);
|
||||
assertEq(x | 0, -2147483648);
|
||||
assertEq(0 | x, -2147483648);
|
||||
assertEq(x & 0, 0);
|
||||
assertEq(0 & x, 0);
|
||||
assertEq(x ^ 0, -2147483648);
|
||||
assertEq(0 ^ x, -2147483648);
|
||||
assertEq(x >> 0, -2147483648);
|
||||
assertEq(0 >> x, 0);
|
||||
assertEq(x >>> 0, 2147483648);
|
||||
assertEq(0 >>> x, 0);
|
||||
assertEq(x << 0, -2147483648);
|
||||
assertEq(0 << x, 0);
|
||||
assertEq(x | 0xffffffff, -1);
|
||||
assertEq(0xffffffff | x, -1);
|
||||
assertEq(x & 0xffffffff, -2147483648);
|
||||
assertEq(0xffffffff & x, -2147483648);
|
||||
assertEq(x ^ 0xffffffff, 2147483647);
|
||||
assertEq(0xffffffff ^ x, 2147483647);
|
||||
assertEq(x >> 0xffffffff, -1);
|
||||
assertEq(0xffffffff >> x, -1);
|
||||
assertEq(x >>> 0xffffffff, 1);
|
||||
assertEq(0xffffffff >>> x, 4294967295);
|
||||
assertEq(x << 0xffffffff, 0);
|
||||
assertEq(0xffffffff << x, -1);
|
||||
assertEq(x | "10.6", -2147483638);
|
||||
assertEq("10.6" | x, -2147483638);
|
||||
assertEq(x & "10.6", 0);
|
||||
assertEq("10.6" & x, 0);
|
||||
assertEq(x ^ "10.6", -2147483638);
|
||||
assertEq("10.6" ^ x, -2147483638);
|
||||
assertEq(x >> "10.6", -2097152);
|
||||
assertEq("10.6" >> x, 10);
|
||||
assertEq(x >>> "10.6", 2097152);
|
||||
assertEq("10.6" >>> x, 10);
|
||||
assertEq(x << "10.6", 0);
|
||||
assertEq("10.6" << x, 10);
|
||||
assertEq(x | 2147483648, -2147483648);
|
||||
assertEq(2147483648 | x, -2147483648);
|
||||
assertEq(x & 2147483648, -2147483648);
|
||||
assertEq(2147483648 & x, -2147483648);
|
||||
assertEq(x ^ 2147483648, 0);
|
||||
assertEq(2147483648 ^ x, 0);
|
||||
assertEq(x >> 2147483648, -2147483648);
|
||||
assertEq(2147483648 >> x, -2147483648);
|
||||
assertEq(x >>> 2147483648, 2147483648);
|
||||
assertEq(2147483648 >>> x, 2147483648);
|
||||
assertEq(x << 2147483648, -2147483648);
|
||||
assertEq(2147483648 << x, -2147483648);
|
||||
assertEq(x | 4294967296, -2147483648);
|
||||
assertEq(4294967296 | x, -2147483648);
|
||||
assertEq(x & 4294967296, 0);
|
||||
assertEq(4294967296 & x, 0);
|
||||
assertEq(x ^ 4294967296, -2147483648);
|
||||
assertEq(4294967296 ^ x, -2147483648);
|
||||
assertEq(x >> 4294967296, -2147483648);
|
||||
assertEq(4294967296 >> x, 0);
|
||||
assertEq(x >>> 4294967296, 2147483648);
|
||||
assertEq(4294967296 >>> x, 0);
|
||||
assertEq(x << 4294967296, -2147483648);
|
||||
assertEq(4294967296 << x, 0);
|
||||
assertEq(x | undefined, -2147483648);
|
||||
assertEq(undefined | x, -2147483648);
|
||||
assertEq(x & undefined, 0);
|
||||
assertEq(undefined & x, 0);
|
||||
assertEq(x ^ undefined, -2147483648);
|
||||
assertEq(undefined ^ x, -2147483648);
|
||||
assertEq(x >> undefined, -2147483648);
|
||||
assertEq(undefined >> x, 0);
|
||||
assertEq(x >>> undefined, 2147483648);
|
||||
assertEq(undefined >>> x, 0);
|
||||
assertEq(x << undefined, -2147483648);
|
||||
assertEq(undefined << x, 0);
|
||||
assertEq(x | null, -2147483648);
|
||||
assertEq(null | x, -2147483648);
|
||||
assertEq(x & null, 0);
|
||||
assertEq(null & x, 0);
|
||||
assertEq(x ^ null, -2147483648);
|
||||
assertEq(null ^ x, -2147483648);
|
||||
assertEq(x >> null, -2147483648);
|
||||
assertEq(null >> x, 0);
|
||||
assertEq(x >>> null, 2147483648);
|
||||
assertEq(null >>> x, 0);
|
||||
assertEq(x << null, -2147483648);
|
||||
assertEq(null << x, 0);
|
||||
assertEq(x | false, -2147483648);
|
||||
assertEq(false | x, -2147483648);
|
||||
assertEq(x & false, 0);
|
||||
assertEq(false & x, 0);
|
||||
assertEq(x ^ false, -2147483648);
|
||||
assertEq(false ^ x, -2147483648);
|
||||
assertEq(x >> false, -2147483648);
|
||||
assertEq(false >> x, 0);
|
||||
assertEq(x >>> false, 2147483648);
|
||||
assertEq(false >>> x, 0);
|
||||
assertEq(x << false, -2147483648);
|
||||
assertEq(false << x, 0);
|
||||
assertEq(x | true, -2147483647);
|
||||
assertEq(true | x, -2147483647);
|
||||
assertEq(x & true, 0);
|
||||
assertEq(true & x, 0);
|
||||
assertEq(x ^ true, -2147483647);
|
||||
assertEq(true ^ x, -2147483647);
|
||||
assertEq(x >> true, -1073741824);
|
||||
assertEq(true >> x, 1);
|
||||
assertEq(x >>> true, 1073741824);
|
||||
assertEq(true >>> x, 1);
|
||||
assertEq(x << true, 0);
|
||||
assertEq(true << x, 1);
|
||||
assertEq(x | -1.5, -1);
|
||||
assertEq(-1.5 | x, -1);
|
||||
assertEq(x & -1.5, -2147483648);
|
||||
assertEq(-1.5 & x, -2147483648);
|
||||
assertEq(x ^ -1.5, 2147483647);
|
||||
assertEq(-1.5 ^ x, 2147483647);
|
||||
assertEq(x >> -1.5, -1);
|
||||
assertEq(-1.5 >> x, -1);
|
||||
assertEq(x >>> -1.5, 1);
|
||||
assertEq(-1.5 >>> x, 4294967295);
|
||||
assertEq(x << -1.5, 0);
|
||||
assertEq(-1.5 << x, -1);
|
||||
}
|
||||
test4(2147483648)
|
||||
|
||||
function test5 (x) {
|
||||
assertEq(x | -1, -1);
|
||||
assertEq(-1 | x, -1);
|
||||
assertEq(x & -1, -2147483648);
|
||||
assertEq(-1 & x, -2147483648);
|
||||
assertEq(x ^ -1, 2147483647);
|
||||
assertEq(-1 ^ x, 2147483647);
|
||||
assertEq(x >> -1, -1);
|
||||
assertEq(-1 >> x, -1);
|
||||
assertEq(x >>> -1, 1);
|
||||
assertEq(-1 >>> x, 4294967295);
|
||||
assertEq(x << -1, 0);
|
||||
assertEq(-1 << x, -1);
|
||||
assertEq(x | 1, -2147483647);
|
||||
assertEq(1 | x, -2147483647);
|
||||
assertEq(x & 1, 0);
|
||||
assertEq(1 & x, 0);
|
||||
assertEq(x ^ 1, -2147483647);
|
||||
assertEq(1 ^ x, -2147483647);
|
||||
assertEq(x >> 1, -1073741824);
|
||||
assertEq(1 >> x, 1);
|
||||
assertEq(x >>> 1, 1073741824);
|
||||
assertEq(1 >>> x, 1);
|
||||
assertEq(x << 1, 0);
|
||||
assertEq(1 << x, 1);
|
||||
assertEq(x | 0, -2147483648);
|
||||
assertEq(0 | x, -2147483648);
|
||||
assertEq(x & 0, 0);
|
||||
assertEq(0 & x, 0);
|
||||
assertEq(x ^ 0, -2147483648);
|
||||
assertEq(0 ^ x, -2147483648);
|
||||
assertEq(x >> 0, -2147483648);
|
||||
assertEq(0 >> x, 0);
|
||||
assertEq(x >>> 0, 2147483648);
|
||||
assertEq(0 >>> x, 0);
|
||||
assertEq(x << 0, -2147483648);
|
||||
assertEq(0 << x, 0);
|
||||
assertEq(x | 0xffffffff, -1);
|
||||
assertEq(0xffffffff | x, -1);
|
||||
assertEq(x & 0xffffffff, -2147483648);
|
||||
assertEq(0xffffffff & x, -2147483648);
|
||||
assertEq(x ^ 0xffffffff, 2147483647);
|
||||
assertEq(0xffffffff ^ x, 2147483647);
|
||||
assertEq(x >> 0xffffffff, -1);
|
||||
assertEq(0xffffffff >> x, -1);
|
||||
assertEq(x >>> 0xffffffff, 1);
|
||||
assertEq(0xffffffff >>> x, 4294967295);
|
||||
assertEq(x << 0xffffffff, 0);
|
||||
assertEq(0xffffffff << x, -1);
|
||||
assertEq(x | "10.6", -2147483638);
|
||||
assertEq("10.6" | x, -2147483638);
|
||||
assertEq(x & "10.6", 0);
|
||||
assertEq("10.6" & x, 0);
|
||||
assertEq(x ^ "10.6", -2147483638);
|
||||
assertEq("10.6" ^ x, -2147483638);
|
||||
assertEq(x >> "10.6", -2097152);
|
||||
assertEq("10.6" >> x, 10);
|
||||
assertEq(x >>> "10.6", 2097152);
|
||||
assertEq("10.6" >>> x, 10);
|
||||
assertEq(x << "10.6", 0);
|
||||
assertEq("10.6" << x, 10);
|
||||
assertEq(x | 2147483648, -2147483648);
|
||||
assertEq(2147483648 | x, -2147483648);
|
||||
assertEq(x & 2147483648, -2147483648);
|
||||
assertEq(2147483648 & x, -2147483648);
|
||||
assertEq(x ^ 2147483648, 0);
|
||||
assertEq(2147483648 ^ x, 0);
|
||||
assertEq(x >> 2147483648, -2147483648);
|
||||
assertEq(2147483648 >> x, -2147483648);
|
||||
assertEq(x >>> 2147483648, 2147483648);
|
||||
assertEq(2147483648 >>> x, 2147483648);
|
||||
assertEq(x << 2147483648, -2147483648);
|
||||
assertEq(2147483648 << x, -2147483648);
|
||||
assertEq(x | 4294967296, -2147483648);
|
||||
assertEq(4294967296 | x, -2147483648);
|
||||
assertEq(x & 4294967296, 0);
|
||||
assertEq(4294967296 & x, 0);
|
||||
assertEq(x ^ 4294967296, -2147483648);
|
||||
assertEq(4294967296 ^ x, -2147483648);
|
||||
assertEq(x >> 4294967296, -2147483648);
|
||||
assertEq(4294967296 >> x, 0);
|
||||
assertEq(x >>> 4294967296, 2147483648);
|
||||
assertEq(4294967296 >>> x, 0);
|
||||
assertEq(x << 4294967296, -2147483648);
|
||||
assertEq(4294967296 << x, 0);
|
||||
assertEq(x | undefined, -2147483648);
|
||||
assertEq(undefined | x, -2147483648);
|
||||
assertEq(x & undefined, 0);
|
||||
assertEq(undefined & x, 0);
|
||||
assertEq(x ^ undefined, -2147483648);
|
||||
assertEq(undefined ^ x, -2147483648);
|
||||
assertEq(x >> undefined, -2147483648);
|
||||
assertEq(undefined >> x, 0);
|
||||
assertEq(x >>> undefined, 2147483648);
|
||||
assertEq(undefined >>> x, 0);
|
||||
assertEq(x << undefined, -2147483648);
|
||||
assertEq(undefined << x, 0);
|
||||
assertEq(x | null, -2147483648);
|
||||
assertEq(null | x, -2147483648);
|
||||
assertEq(x & null, 0);
|
||||
assertEq(null & x, 0);
|
||||
assertEq(x ^ null, -2147483648);
|
||||
assertEq(null ^ x, -2147483648);
|
||||
assertEq(x >> null, -2147483648);
|
||||
assertEq(null >> x, 0);
|
||||
assertEq(x >>> null, 2147483648);
|
||||
assertEq(null >>> x, 0);
|
||||
assertEq(x << null, -2147483648);
|
||||
assertEq(null << x, 0);
|
||||
assertEq(x | false, -2147483648);
|
||||
assertEq(false | x, -2147483648);
|
||||
assertEq(x & false, 0);
|
||||
assertEq(false & x, 0);
|
||||
assertEq(x ^ false, -2147483648);
|
||||
assertEq(false ^ x, -2147483648);
|
||||
assertEq(x >> false, -2147483648);
|
||||
assertEq(false >> x, 0);
|
||||
assertEq(x >>> false, 2147483648);
|
||||
assertEq(false >>> x, 0);
|
||||
assertEq(x << false, -2147483648);
|
||||
assertEq(false << x, 0);
|
||||
assertEq(x | true, -2147483647);
|
||||
assertEq(true | x, -2147483647);
|
||||
assertEq(x & true, 0);
|
||||
assertEq(true & x, 0);
|
||||
assertEq(x ^ true, -2147483647);
|
||||
assertEq(true ^ x, -2147483647);
|
||||
assertEq(x >> true, -1073741824);
|
||||
assertEq(true >> x, 1);
|
||||
assertEq(x >>> true, 1073741824);
|
||||
assertEq(true >>> x, 1);
|
||||
assertEq(x << true, 0);
|
||||
assertEq(true << x, 1);
|
||||
assertEq(x | -1.5, -1);
|
||||
assertEq(-1.5 | x, -1);
|
||||
assertEq(x & -1.5, -2147483648);
|
||||
assertEq(-1.5 & x, -2147483648);
|
||||
assertEq(x ^ -1.5, 2147483647);
|
||||
assertEq(-1.5 ^ x, 2147483647);
|
||||
assertEq(x >> -1.5, -1);
|
||||
assertEq(-1.5 >> x, -1);
|
||||
assertEq(x >>> -1.5, 1);
|
||||
assertEq(-1.5 >>> x, 4294967295);
|
||||
assertEq(x << -1.5, 0);
|
||||
assertEq(-1.5 << x, -1);
|
||||
}
|
||||
test5(-2147483648)
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
/* Bug 614653 - This test .2 seconds with the fix, 20 minutes without. */
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
var arr = [];
|
||||
var s = "abcdefghijklmnop";
|
||||
for (var i = 0; i < 50000; ++i) {
|
||||
for (var j = 0; j < 50000; ++j) {
|
||||
s = "<" + s + ">";
|
||||
arr.push(s);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
for (var i = 0; i < 10; ++i) {
|
||||
var arr = [];
|
||||
var s = "abcdefghijklmnop";
|
||||
for (var j = 0; j < 5000; ++j) {
|
||||
s = "<" + s + ">";
|
||||
arr.push(s);
|
||||
}
|
||||
gc();
|
||||
for (var j = 0; j < 5000; ++j) {
|
||||
arr[j].search("a");
|
||||
}
|
||||
gc();
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
const numFatArgs = Math.pow(2,19) - 1024;
|
||||
|
||||
function fun(x) {
|
||||
if (x <= 0)
|
||||
return 0;
|
||||
return fun(x-1);
|
||||
}
|
||||
|
||||
function fatStack() {
|
||||
return fun(10000);
|
||||
}
|
||||
|
||||
function assertRightFailure(e) {
|
||||
assertEq(e.toString() == "InternalError: script stack space quota is exhausted" ||
|
||||
e.toString() == "InternalError: too much recursion",
|
||||
true);
|
||||
}
|
||||
|
||||
exception = false;
|
||||
try {
|
||||
fatStack.apply(null, new Array(numFatArgs));
|
||||
} catch (e) {
|
||||
assertRightFailure(e);
|
||||
exception = true;
|
||||
}
|
||||
assertEq(exception, true);
|
||||
|
||||
// No more trace recursion w/ JM
|
||||
checkStats({traceCompleted:0});
|
|
@ -0,0 +1,4 @@
|
|||
// |jit-test| debug
|
||||
function f() { eval(''); }
|
||||
trap(f, 6, '');
|
||||
f();
|
|
@ -0,0 +1,13 @@
|
|||
function f(){
|
||||
var tarr = [];
|
||||
var elemArray = [
|
||||
{name: "C0", checked: true},
|
||||
{name: "C1", checked: false},
|
||||
];
|
||||
for (var i = 0; i < elemArray.length; i++) {
|
||||
var element = elemArray[i];
|
||||
tarr[i] = (element.checked == true) ? 1 : 2;
|
||||
}
|
||||
assertEq(tarr.join(""), "12");
|
||||
}
|
||||
f();
|
|
@ -0,0 +1,11 @@
|
|||
this.name = "outer";
|
||||
|
||||
var sb = evalcx('');
|
||||
sb.name = "inner";
|
||||
sb.parent = this;
|
||||
|
||||
function f() {
|
||||
assertEq(this.name, "inner");
|
||||
}
|
||||
|
||||
evalcx('with(this) { ff = parent.f; }; (function() { eval(""); for(var i=0; i<10; i++) { ff() } })()', sb);
|
|
@ -0,0 +1,25 @@
|
|||
this.name = "outer";
|
||||
|
||||
var sb = evalcx('');
|
||||
sb.name = "inner";
|
||||
sb.parent = this;
|
||||
|
||||
var res = 0;
|
||||
|
||||
function f() {
|
||||
assertEq(this.name, "inner");
|
||||
res++;
|
||||
}
|
||||
|
||||
// ff is a property of the inner global object. Generate a CALLNAME IC, then
|
||||
// change ff to a function on the outer global. It should get the inner this
|
||||
// value.
|
||||
evalcx('this.ff = function() {};' +
|
||||
'(function() { ' +
|
||||
'eval("");' +
|
||||
'for(var i=0; i<10; i++) {' +
|
||||
'ff();' +
|
||||
'if (i == 5) ff = parent.f;' +
|
||||
'}' +
|
||||
'})()', sb);
|
||||
assertEq(res, 4);
|
|
@ -0,0 +1,35 @@
|
|||
// Check that the implicit-this logic needed for CALLNAME global stubs
|
||||
// handles non-function values correctly.
|
||||
var self = this;
|
||||
var count = 0;
|
||||
function g1() {
|
||||
assertEq(this, self);
|
||||
this.count++;
|
||||
}
|
||||
function g2() {
|
||||
this.count += 10;
|
||||
}
|
||||
function f() {
|
||||
function f1(other) {
|
||||
eval("gc(); h = g1");
|
||||
try {
|
||||
for(var i=0; i<20; i++) {
|
||||
h();
|
||||
if (i === 9) {
|
||||
h = other;
|
||||
}
|
||||
}
|
||||
assertEq(typeof other, "function");
|
||||
} catch(e) {
|
||||
assertEq(typeof other !== "function", true);
|
||||
assertEq(e instanceof TypeError, true);
|
||||
}
|
||||
}
|
||||
f1(3);
|
||||
f1(null);
|
||||
f1({});
|
||||
f1(Math.abs);
|
||||
f1(g2);
|
||||
}
|
||||
f();
|
||||
assertEq(count, 150);
|
|
@ -0,0 +1,15 @@
|
|||
g0 = function(i) {
|
||||
this["g"+(i+1)] = g0;
|
||||
return "g"+(i+1);
|
||||
}
|
||||
function f() {
|
||||
a = eval("g0");
|
||||
for(var i=0; i<40; i++) {
|
||||
a = this[a(i)];
|
||||
if (i === 30) {
|
||||
gc();
|
||||
}
|
||||
assertEq(this["g" + i], g0);
|
||||
}
|
||||
}
|
||||
f();
|
|
@ -0,0 +1,15 @@
|
|||
var res;
|
||||
var x = 0;
|
||||
|
||||
function f() {
|
||||
x = {x: 1, f: function() { res = this.x; }};
|
||||
with(x) {
|
||||
g = function() {
|
||||
eval("");
|
||||
f();
|
||||
}
|
||||
g();
|
||||
}
|
||||
}
|
||||
f();
|
||||
assertEq(res, 1);
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче