• franzih's avatar
    [type profile] Collect return types. · de04df74
    franzih authored
    Collect type information of return values.
    
    Use *one* feedback slot per function for all its return
    statements. For assignments, we currently use
    several slots per function, because not all
    assignments refer to the same variable.
    
    Instead of the variable names, pass the
    source location and print the function name.
    
    Add an integration test for --type-profile that checks
    for crashes.
    
    Remove type feedback for assignments for now as it convolutes the output.
    
    ************ Function with 2 return statements ********
    function testFunction(param, flag) {
      // We want to test 2 different return positions in one function.
      if (flag) {
        var first_var = param;
        return first_var;
      }
      var second_var = param;
      return second_var;
    }
    
    testFunction({});
    testFunction(123, true);
    testFunction('hello');
    testFunction(undefined);
    *******************************************************
    
    ************* Sample Output ***************************
    Function: testFunction
    424: Object
    374: number
    424: string
    424: undefined
    *******************************************************
    
    Missing work:
    * Handle fall-off returns
    * Collect types for parameters
    * Remove duplicates from the list of collected types and use a common base class.
    
    BUG=v8:5935
    
    Review-Url: https://codereview.chromium.org/2755973002
    Cr-Commit-Position: refs/heads/master@{#43956}
    de04df74
type-profile.js 14.4 KB