Skip to content

Commit

Permalink
Merge r176972 - CFA wrongly assumes that a speculation for SlowPutArr…
Browse files Browse the repository at this point in the history
…ayStorageShape disallows ArrayStorageShape arrays.

<https://webkit.org/b/139327>

Reviewed by Michael Saboff.

Source/JavaScriptCore:

The code generator and runtime slow paths expects otherwise.  This patch fixes
CFA to match the code generator's expectation.

* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::arrayModesThatPassFiltering):
(JSC::DFG::ArrayMode::arrayModesWithIndexingShapes):

LayoutTests:

* js/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage-expected.txt: Added.
* js/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage.html: Added.
* js/script-tests/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage.js: Added.
(foo):
(test):

Canonical link: https://commits.webkit.org/154760.265@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@178334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Mark Lam authored and carlosgcampos committed Jan 13, 2015
1 parent 462be38 commit ee513bf
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 1 deletion.
13 changes: 13 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
2014-12-08 Mark Lam <mark.lam@apple.com>

CFA wrongly assumes that a speculation for SlowPutArrayStorageShape disallows ArrayStorageShape arrays.
<https://webkit.org/b/139327>

Reviewed by Michael Saboff.

* js/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage-expected.txt: Added.
* js/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage.html: Added.
* js/script-tests/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage.js: Added.
(foo):
(test):

2014-12-07 Youenn Fablet <youenn.fablet@crf.canon.fr>

[Soup][Curl] HTTP header values should be treated as latin1, not UTF-8
Expand Down
@@ -0,0 +1,9 @@
This tests that DFG generated code speculating SlowPutArrayStorageShape doesn't crash when seeing fast ArrayStorageShapes.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/dfg-slow-put-array-storage-spec-should-allow-fast-array-storage.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,38 @@
description(
"This tests that DFG generated code speculating SlowPutArrayStorageShape doesn't crash when seeing fast ArrayStorageShapes."
);

var slowPutArrayStorageArray = [ "slow" ];
var fastArrayStorageArray = [ "fast" ];
fastArrayStorageArray[1000] = 50;

var o = { a: 10 };
Object.defineProperties(o, {
"0": {
set: function(x) { this.a = x; },
},
});

slowPutArrayStorageArray.__proto__ = o;

function foo(a, isFast) {
var result = 10;
if (!a)
return result;

var doStuff = a[0] && isFast;
if (doStuff)
result = a[0] + 10;
return result;
}

function test() {
for (var k = 0; k < 5000; k++) {
foo(slowPutArrayStorageArray, false);
foo(fastArrayStorageArray, true);
}
}

test();

var successfullyParsed = true;
14 changes: 14 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
2014-12-08 Mark Lam <mark.lam@apple.com>

CFA wrongly assumes that a speculation for SlowPutArrayStorageShape disallows ArrayStorageShape arrays.
<https://webkit.org/b/139327>

Reviewed by Michael Saboff.

The code generator and runtime slow paths expects otherwise. This patch fixes
CFA to match the code generator's expectation.

* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::arrayModesThatPassFiltering):
(JSC::DFG::ArrayMode::arrayModesWithIndexingShapes):

2014-12-04 Andreas Kling <akling@apple.com>

REGRESSION(r173188): Text inserted when trying to delete a word from the Twitter message box.
Expand Down
9 changes: 8 additions & 1 deletion Source/JavaScriptCore/dfg/DFGArrayMode.h
Expand Up @@ -406,7 +406,7 @@ class ArrayMode {
case Array::ArrayStorage:
return arrayModesWithIndexingShape(ArrayStorageShape);
case Array::SlowPutArrayStorage:
return arrayModesWithIndexingShape(SlowPutArrayStorageShape);
return arrayModesWithIndexingShapes(SlowPutArrayStorageShape, ArrayStorageShape);
default:
return asArrayModes(NonArray);
}
Expand Down Expand Up @@ -462,6 +462,13 @@ class ArrayMode {
}
}

ArrayModes arrayModesWithIndexingShapes(IndexingType shape1, IndexingType shape2) const
{
ArrayModes arrayMode1 = arrayModesWithIndexingShape(shape1);
ArrayModes arrayMode2 = arrayModesWithIndexingShape(shape2);
return arrayMode1 | arrayMode2;
}

bool alreadyChecked(Graph&, Node*, AbstractValue&, IndexingType shape) const;

union {
Expand Down

0 comments on commit ee513bf

Please sign in to comment.