Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Issue 604033 JIT compiler not preserving method behavior
Starred by 27 users Reported by gilbert....@gmail.com, Apr 15 2016 Back to list
Status: Fixed
Owner:
Closed: Jun 2016
Cc:
Components:
NextAction: ----
OS: Windows
Pri: 2
Type: Bug


Sign in to add a comment
UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36

Steps to reproduce the problem:
Consider the following object definition:

```
var MyObj = function () { };
MyObj.prototype = {
    constructor: MyObj,

    tooltip: function (text) {

        if (typeof text === "undefined")
            return "UNDEF_ARG_GIVEN";
        else
            return this;
    },

    otherFunction: function (cnt) {
        return true;
    }
};
```

Now consider the following loop:

```
    for (var i = 0; i < 100000; i++) {
        (new MyObj()).tooltip(null).otherFunction(i);
        console.log(i);
    }

```

The above loop crashes after a few thousand iterations, with an error saying "otherFunction is not a function".

What is the expected behavior?
I expect the loop to go through all the way to 100,000 iterations.

What went wrong?
It crashes after a certain number of iterations (appears random).

Did this work before? Yes It worked fine in chrome v49.

Chrome version: 50.0.2661.75  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 21.0 r0

See attached HTML file for how to reproduce.  Simply click the "Launch Test" button.

If I change `if` condition in the tooltip method to avoid keyword `typeof` then things work fine.  For instance, if I use `if (text === undefined)` or `if (arguments.length < 1)`, the code behaves as expected.

Also, if I put a breakpoint at `return "UNDEF_ARG_GIVEN"` in the tooltip using the Dev Tools, then it works fine too.

I suspect the JIT compiler is being tripped by the `typeof` keyword.
 
chrome-v50_bug.htm
879 bytes View Download
Comment 1 by cingarfi...@lim.com, Apr 15 2016
I can confirm same behavior on OS X 10.11.4 (15E65) Chrome 50.0.2661.75 (64-bit)
Components: -Blink Blink>JavaScript
Cc: bmeu...@chromium.org jarin@chromium.org verwa...@chromium.org
Status: Available
Components: -Blink>JavaScript Blink>JavaScript>Compiler
Comment 5 by jarin@chromium.org, Apr 21 2016
Owner: jarin@chromium.org
Status: Assigned
Comment 6 by jarin@chromium.org, Apr 21 2016
Owner: verwa...@chromium.org
Repro in d8:

-------

function f() {
  return typeof null === "undefined";
};

%OptimizeFunctionOnNextCall(f);
print(f());

--------

$ d8 a.js --allow-natives-syntax --nocrankshaft
false

$ d8 a.js --allow-natives-syntax
true
Status: Fixed
When can we expect this fix to be released in stable Chrome channel? This bug makes our HTML5 photo product editor at www.smartphoto.com totally unstable. Thanks, Peter
Comment 9 by vavre...@gmail.com, Jun 20 2016
hey, you can force to preserve behavior by following hack until its in stable channel: if (typeof text === "undefined" + "")
...
Comment 10 by qwel...@gmail.com, Jun 20 2016
As a workaround, you can straight check if ( text === undefined ) 
Status: Assigned
I can still reproduce it. Are you sure this one is fixed?
Still happening in Mac OS X El Capitan 10.11.5 Chrome Version 51.0.2704.103 (64-bit)
Confirmed still happening in Windows 8.1 (6.3.9600) w/ version 51.0.2704.103 (64-bit) as well
Status: Fixed
This is long fixed by https://codereview.chromium.org/1912553002, but was never backmerged to 5.1. Merging now as https://codereview.chromium.org/2088783002.
Please merge issue 621887 and issue 622628 into this one.
Comment 16 by adamk@chromium.org, Jun 23 2016
Issue v8:5146 has been merged into this issue.
Cc: rnimmagadda@chromium.org
Issue 621887 has been merged into this issue.
Comment 18 by hvis...@gmail.com, Today (4 hours ago)
https://bugs.chromium.org/p/monorail/issues/detail?id=2108
http://www.hddom.net/news/specialnyj_reportazh_tramp_biznes_19_01_2017/2017-01-19-5646
http://www.hddom.net/news/doktor_i_opukhol_mozga_19_01_2017/2017-01-19-5645
http://www.hddom.net/news/prjamoj_ehfir_s_borisom_korchevnikovym_19_01_2017/2017-01-19-5618
http://www.hddom.net/news/muzhskoe_zhenskoe_19_01_2017/2017-01-19-5622
http://www.hddom.net/news/doktor_i_opukhol_mozga_18_01_2017/2017-01-19-5644
http://www.hddom.net/news/naedine_so_vsemi_19_01_2017/2017-01-19-5625
http://www.hddom.net/news/modnyj_prigovor_19_01_2017/2017-01-19-5623
http://www.hddom.net/news/o_samom_glavnom_19_01_2017/2017-01-19-5613
http://www.hddom.net/news/zhit_zdorovo_19_01_2017/2017-01-19-5612
http://www.hddom.net/news/dom_2_dnevnoj_vypusk_4637_19_01_2017/2017-01-19-5605
http://www.hddom.net/news/dom_2_svadba_na_million_vypusk_4637_19_01_2017/2017-01-19-5609
http://www.hddom.net/news/pravo_golosa_sosedi_ili_sojuzniki_18_01_2017/2017-01-19-5603
http://www.hddom.net/news/vesti_v_23_00_s_maksimom_kiselevym_18_01_2017/2017-01-19-5643
http://www.hddom.net/news/itogi_dnja_18_01_2017/2017-01-19-5642
http://www.hddom.net/news/sud_prisjazhnykh_18_01_2017/2017-01-19-5560
http://www.hddom.net/news/vse_bude_dobre_952_vypusk_19_01_2017/2017-01-19-5628
http://www.hddom.net/news/zvanyj_uzhin_19_01_2017/2017-01-19-5626
http://www.hddom.net/news/aferisty_v_setjakh_2_sezon_7_vypusk_18_01_2017/2017-01-19-5641
http://www.hddom.net/news/dom_2_nochnoj_vypusk_4637_19_01_2017/2017-01-19-5640
http://www.hddom.net/news/dom_2_vechernij_vypusk_4637_19_01_2017/2017-01-19-5639
http://www.hddom.net/news/grazhdanskij_brak_11_serija_19_01_2017/2017-01-19-5638
http://www.hddom.net/news/vy_vse_menja_besite_12_13_serija_19_01_2017/2017-01-19-5637
http://www.hddom.net/news/vasilisa_17_18_serija_19_01_2017/2017-01-19-5636
http://www.hddom.net/news/rajskoe_mesto_9_serija_19_01_2017/2017-01-19-5635

HDDOM.NET - Онлайн кинотеатр Мы рады Вас видеть в нашем онлайн кинотеатре! Мы работаем с 2012 года и порадовали не один миллион зрителей! Смотреть передачи онлайн в наше время стало намного проще. Мы стараемся каждому зрителю угодить, так как каждый зритель нам дорог! Смотреть сериалы онлайн уже можно не включая телевизора, новое ток-шоу не будет бесить Вас надоедливой рекламой. Жить с hddom.net стало намного проще! Онлайн кинотеатр с радостью Вам предложет посмотреть такие шоу как "Дом 2", "Шоу голос", "Битва экстрасенсов" "Званый ужин" и многое другое! Смотреть онлайн фильмы сможете в хорошем качестве такое как "HD720" и "HD1080" без томозов! С каждым божим днем добавляются Новые серии сериалов как русские "Универ.Новая общага", "Молодежка", "Воронины", "Ольга" так и зарубежные. Есть категория Спорт онлайн в неё входит футбол, хоккей, бокс. Будьте всегда в курсе спортивных событий! Это все, Вы сможете смотреть онлайн на ваших телефонах, смартфонах, планшетах и на смарт тв так как мы имеем мобильный шаблон! Добро пожаловатьв наш онлайн кинотеатр, смотреть передачи онлайн в хорошем качестве.
Sign in to add a comment