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

Unified Diff: test/mjsunit/compiler/stubs/floor-stub.js

Issue 1137703002: Add a MathFloor stub generated with TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM + co. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/stubs/floor-stub.js
diff --git a/test/mjsunit/regress/regress-3976.js b/test/mjsunit/compiler/stubs/floor-stub.js
similarity index 58%
copy from test/mjsunit/regress/regress-3976.js
copy to test/mjsunit/compiler/stubs/floor-stub.js
index efa3ac03bc05a5b1018eb1bdd0db761154f2b664..98932208f36af98dc72d28de0c69aa7d712d35c1 100644
--- a/test/mjsunit/regress/regress-3976.js
+++ b/test/mjsunit/compiler/stubs/floor-stub.js
@@ -25,56 +25,29 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --max-old-space-size=60 --check-handle-count
+// Flags: --allow-natives-syntax --expose-natives-as=builtins --noalways-opt
-table = [];
+const kExtraTypeFeedbackMinusZeroSentinel = 1;
+const kFirstSlotExtraTypeFeedbackIndex = 5;
-for (var i = 0; i < 32; i++) {
- table[i] = String.fromCharCode(i + 0x410);
-}
-
-
-var random = (function() {
- var seed = 10;
- return function() {
- seed = (seed * 1009) % 8831;
- return seed;
- };
-})();
-
-
-function key(length) {
- var s = "";
- for (var i = 0; i < length; i++) {
- s += table[random() % 32];
- }
- return '"' + s + '"';
-}
-
-
-function value() {
- return '[{' + '"field1" : ' + random() + ', "field2" : ' + random() + '}]';
-}
-
-
-function generate(n) {
- var s = '{';
- for (var i = 0; i < n; i++) {
- if (i > 0) s += ', ';
- s += key(random() % 10 + 7);
- s += ':';
- s += value();
+(function(){
+ var floorFunc = function() {
+ Math.floor(NaN);
}
- s += '}';
- return s;
-}
-
-
-print("generating");
-
-var str = generate(50000);
-
-print("parsing " + str.length);
-JSON.parse(str);
-
-print("done");
+ // Execute the function once to make sure it has a type feedback vector.
+ floorFunc(5);
+ assertTrue(kExtraTypeFeedbackMinusZeroSentinel !==
+ %FixedArrayGet(%GetTypeFeedbackVector(floorFunc),
+ kFirstSlotExtraTypeFeedbackIndex));
+ assertEquals(5.0, builtins.MathFloor_STUB(floorFunc, 4, 5.5));
+ assertTrue(kExtraTypeFeedbackMinusZeroSentinel !==
+ %FixedArrayGet(%GetTypeFeedbackVector(floorFunc),
+ kFirstSlotExtraTypeFeedbackIndex));
+ // Executing floor such that it returns -0 should set the proper sentinel in
+ // the feedback vector.
+ assertEquals(-Infinity, 1/builtins.MathFloor_STUB(floorFunc, 4, -0));
+ assertEquals(kExtraTypeFeedbackMinusZeroSentinel,
+ %FixedArrayGet(%GetTypeFeedbackVector(floorFunc),
+ kFirstSlotExtraTypeFeedbackIndex));
+ %ClearFunctionTypeFeedback(floorFunc);
+})();
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698