Skip to content

Conversation

@meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Jan 31, 2018

function inlineCall(tnum) {
  return {x : tnum};  // InitFld
}
function foo (obj) {
  var tnum = num;
  var sum = 0;
  while (tnum >= 0) {
    var retObj = inlineCall(tnum);
    if (tnum > 10) {
      sum += retObj.x;  // missed copy prop opportunity
    }
    tnum--;
  }
  return sum;
}

var obj = {};
foo(obj);
foo(obj);
foo(obj)

We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.

This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping "done" and "value" fields of the iterator object.

meg-gupta added 2 commits January 31, 2018 11:44
var num = 50;
function inlineCall(tnum) {
  return {x : tnum};  // InitFld
}
function foo (obj) {
  var tnum = num;
  var sum = 0;
  while (tnum >= 0) {
    var retObj = inlineCall(tnum);
    if (tnum > 10) {
      sum += retObj.x;  // missed copy prop opportunity
    }
    tnum--;
  }
  return sum;
}

var obj = {};
foo(obj);
foo(obj);
foo(obj)

We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.

This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping "done" and "value" fields of the iterator object.
Copy link
Contributor

@sigatrev sigatrev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chakrabot chakrabot merged commit 33765a1 into chakra-core:release/1.8 Feb 1, 2018
chakrabot pushed a commit that referenced this pull request Feb 1, 2018
…dled InitFld case

Merge pull request #4627 from meg-gupta:fixopt

```var num = 50;
function inlineCall(tnum) {
  return {x : tnum};  // InitFld
}
function foo (obj) {
  var tnum = num;
  var sum = 0;
  while (tnum >= 0) {
    var retObj = inlineCall(tnum);
    if (tnum > 10) {
      sum += retObj.x;  // missed copy prop opportunity
    }
    tnum--;
  }
  return sum;
}

var obj = {};
foo(obj);
foo(obj);
foo(obj)
```
We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.

This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping "done" and "value" fields of the iterator object.
chakrabot pushed a commit that referenced this pull request Feb 1, 2018
…e to unhandled InitFld case

Merge pull request #4627 from meg-gupta:fixopt

```var num = 50;
function inlineCall(tnum) {
  return {x : tnum};  // InitFld
}
function foo (obj) {
  var tnum = num;
  var sum = 0;
  while (tnum >= 0) {
    var retObj = inlineCall(tnum);
    if (tnum > 10) {
      sum += retObj.x;  // missed copy prop opportunity
    }
    tnum--;
  }
  return sum;
}

var obj = {};
foo(obj);
foo(obj);
foo(obj)
```
We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.

This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping "done" and "value" fields of the iterator object.
chakrabot pushed a commit that referenced this pull request Feb 1, 2018
…pportunity due to unhandled InitFld case

Merge pull request #4627 from meg-gupta:fixopt

```var num = 50;
function inlineCall(tnum) {
  return {x : tnum};  // InitFld
}
function foo (obj) {
  var tnum = num;
  var sum = 0;
  while (tnum >= 0) {
    var retObj = inlineCall(tnum);
    if (tnum > 10) {
      sum += retObj.x;  // missed copy prop opportunity
    }
    tnum--;
  }
  return sum;
}

var obj = {};
foo(obj);
foo(obj);
foo(obj)
```
We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.

This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping "done" and "value" fields of the iterator object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants