1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15var x = 7; 16var y = 3; 17var count = 1000000; 18 19function cse_opt(x, y) 20{ 21 var tmp1 = x * x; 22 var tmp2 = y * y; 23 var tmp3 = tmp1 * tmp1; 24 var tmp4 = tmp2 * tmp2; 25 26 for (var i = 0; i < count; i++) { 27 var cached1 = tmp3 * x 28 var cached2 = tmp4 * y; 29 var cached_n_cached = cached1 + cached2; 30 var ret_val = cached_n_cached + cached_n_cached; 31 } 32 33 return ret_val + ret_val; 34}; 35 36cse_opt(x, y);