Unreviewed, rolling out r114185.

http://trac.webkit.org/changeset/114185
https://bugs.webkit.org/show_bug.cgi?id=83967

Broke a bunch of JavaScript related tests (Requested by
andersca on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-04-13

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
* runtime/CommonIdentifiers.h:
* tests/mozilla/ecma/Array/15.4.4.2.js:
(getTestCases):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f816bc49
2012-04-13 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r114185.
http://trac.webkit.org/changeset/114185
https://bugs.webkit.org/show_bug.cgi?id=83967
Broke a bunch of JavaScript related tests (Requested by
andersca on #webkit).
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
* runtime/CommonIdentifiers.h:
* tests/mozilla/ecma/Array/15.4.4.2.js:
(getTestCases):
2012-04-13 Gavin Barraclough <barraclough@apple.com> 2012-04-13 Gavin Barraclough <barraclough@apple.com>
Don't rely on fixed offsets to patch calls Don't rely on fixed offsets to patch calls
...@@ -254,25 +254,11 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) ...@@ -254,25 +254,11 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
{ {
JSValue thisValue = exec->hostThisValue(); JSValue thisValue = exec->hostThisValue();
JSObject* thisObject = thisValue.toObject(exec); bool isRealArray = isJSArray(thisValue);
if (exec->hadException()) if (!isRealArray && !thisValue.inherits(&JSArray::s_info))
return JSValue::encode(jsUndefined()); return throwVMTypeError(exec);
JSValue function = JSValue(thisObject).get(exec, exec->propertyNames().join);
if (!function.isCell())
return objectProtoFuncToString(exec);
CallData callData;
CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return objectProtoFuncToString(exec);
if (!isJSArray(thisObject) || callType != CallTypeHost || callData.native.function != arrayProtoFuncJoin)
return JSValue::encode(call(exec, function, callType, callData, thisObject, exec->emptyList()));
ASSERT(isJSArray(thisValue));
JSArray* thisObj = asArray(thisValue); JSArray* thisObj = asArray(thisValue);
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (exec->hadException()) if (exec->hadException())
return JSValue::encode(jsUndefined()); return JSValue::encode(jsUndefined());
...@@ -287,7 +273,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec) ...@@ -287,7 +273,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
for (unsigned k = 0; k < length; k++) { for (unsigned k = 0; k < length; k++) {
JSValue element; JSValue element;
if (thisObj->canGetIndex(k)) if (isRealArray && thisObj->canGetIndex(k))
element = thisObj->getIndex(k); element = thisObj->getIndex(k);
else else
element = thisObj->get(exec, k); element = thisObj->get(exec, k);
...@@ -345,9 +331,9 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) ...@@ -345,9 +331,9 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
{ {
JSValue thisValue = exec->hostThisValue(); JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toObject(exec); if (!thisValue.inherits(&JSArray::s_info))
if (exec->hadException()) return throwVMTypeError(exec);
return JSValue::encode(jsUndefined()); JSObject* thisObj = asArray(thisValue);
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (exec->hadException()) if (exec->hadException())
...@@ -374,12 +360,11 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec) ...@@ -374,12 +360,11 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
if (callType != CallTypeNone) if (callType != CallTypeNone)
str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toUString(exec); str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toUString(exec);
else else
return throwVMTypeError(exec); str = element.toUString(exec);
if (exec->hadException()) if (exec->hadException())
return JSValue::encode(jsUndefined()); return JSValue::encode(jsUndefined());
stringJoiner.append(str); stringJoiner.append(str);
} else }
return JSValue::encode(jsEmptyString(exec));
} }
return JSValue::encode(stringJoiner.build(exec)); return JSValue::encode(stringJoiner.build(exec));
......
...@@ -72,8 +72,7 @@ ...@@ -72,8 +72,7 @@
macro(value) \ macro(value) \
macro(valueOf) \ macro(valueOf) \
macro(writable) \ macro(writable) \
macro(displayName)\ macro(displayName)
macro(join)
#define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \ #define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \
macro(null) \ macro(null) \
......
...@@ -55,31 +55,6 @@ function getTestCases() { ...@@ -55,31 +55,6 @@ function getTestCases() {
array[item++] = new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() ); array[item++] = new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() );
array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() ); array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() );
array[item++] = new TestCase( SECTION,
"{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}.toString()",
"a,b,c",
{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}.toString() );
array[item++] = new TestCase( SECTION,
"{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', join: function() { return 'join' }}.toString()",
"join",
{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', join: function() { return 'join' }}.toString() );
array[item++] = new TestCase( SECTION,
"Array.prototype.toString.call({join: function() { return 'join' }})",
"join",
Array.prototype.toString.call({join: function() { return 'join' }}) );
array[item++] = new TestCase( SECTION,
"Array.prototype.toString.call({sort: function() { return 'sort' }})",
"[object Object]",
Array.prototype.toString.call({sort: function() { return 'sort' }}) );
array[item++] = new TestCase( SECTION,
"Array.prototype.toString.call(new Date)",
"[object Date]",
Array.prototype.toString.call(new Date) );
array[item++] = new TestCase( SECTION,
"Number.prototype.join = function() { return 'number join' }; Array.prototype.toString.call(42)",
"number join",
eval("Number.prototype.join = function() { return 'number join' }; Array.prototype.toString.call(42)") );
var EXPECT_STRING = ""; var EXPECT_STRING = "";
var MYARR = new Array(); var MYARR = new Array();
...@@ -92,10 +67,6 @@ function getTestCases() { ...@@ -92,10 +67,6 @@ function getTestCases() {
array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() ); array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() );
array[item++] = new TestCase( SECTION,
"Array.prototype.join = function() { return 'join' }; [0, 1, 2].toString()",
"join",
eval("Array.prototype.join = function() { return 'join' }; [0, 1, 2].toString()") );
return ( array ); return ( array );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment