regress-298269.js 886 Bytes
Newer Older
1
// Copyright 2013 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6 7
// Flags: --allow-natives-syntax

function Cb(a, trigger) {
8 9 10 11 12
  var f, g;
  for(f = a.length; f--;) {
    g = a.charCodeAt(f);
    // This will fail after OSR if Runtime_StringCharCodeAt is modified
    // to iterates optimized frames and visit safepoint pointers.
13 14 15 16
    if (g == "C".charCodeAt(0)) {
      %OptimizeOsr();
      %PrepareFunctionForOptimization(Cb);
    }
17 18 19 20 21 22
  }
  return g;
}

var s1 = "long string to make cons string 1";
var s2 = "long string to make cons string 2";
23
%PrepareFunctionForOptimization(Cb);
24
Cb(s1 + s2);
25
%PrepareFunctionForOptimization(Cb);
26 27
Cb(s1);
var s3 = "string for triggering osr in Cb";
28
%PrepareFunctionForOptimization(Cb);
29
Cb(s3 + s3);
30
%PrepareFunctionForOptimization(Cb);
31
Cb(s1 + s2);