| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 static const char* js_native_js_test_source = | 1305 static const char* js_native_js_test_source = |
| 1306 "%NeverOptimizeFunction(foo);\n" | 1306 "%NeverOptimizeFunction(foo);\n" |
| 1307 "%NeverOptimizeFunction(bar);\n" | 1307 "%NeverOptimizeFunction(bar);\n" |
| 1308 "%NeverOptimizeFunction(start);\n" | 1308 "%NeverOptimizeFunction(start);\n" |
| 1309 "function foo(n) {\n" | 1309 "function foo(n) {\n" |
| 1310 " var s = 0;\n" | 1310 " var s = 0;\n" |
| 1311 " for (var i = 0; i < n; i++) s += i * i * i;\n" | 1311 " for (var i = 0; i < n; i++) s += i * i * i;\n" |
| 1312 " return s;\n" | 1312 " return s;\n" |
| 1313 "}\n" | 1313 "}\n" |
| 1314 "function bar() {\n" | 1314 "function bar() {\n" |
| 1315 " foo(1000);\n" | 1315 " foo(3000);\n" |
| 1316 "}\n" | 1316 "}\n" |
| 1317 "function start() {\n" | 1317 "function start() {\n" |
| 1318 " CallJsFunction(bar);\n" | 1318 " CallJsFunction(bar);\n" |
| 1319 "}"; | 1319 "}"; |
| 1320 | 1320 |
| 1321 static void CallJsFunction(const v8::FunctionCallbackInfo<v8::Value>& info) { | 1321 static void CallJsFunction(const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 1322 v8::Local<v8::Function> function = info[0].As<v8::Function>(); | 1322 v8::Local<v8::Function> function = info[0].As<v8::Function>(); |
| 1323 v8::Local<v8::Value> argv[] = {info[1]}; | 1323 v8::Local<v8::Value> argv[] = {info[1]}; |
| 1324 function->Call(info.GetIsolate()->GetCurrentContext(), info.This(), | 1324 function->Call(info.GetIsolate()->GetCurrentContext(), info.This(), |
| 1325 arraysize(argv), argv) | 1325 arraysize(argv), argv) |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 printf("Profile JSON: %s\n", profile_json.c_str()); | 2181 printf("Profile JSON: %s\n", profile_json.c_str()); |
| 2182 std::string code = profile_checker + profile_json + ")"; | 2182 std::string code = profile_checker + profile_json + ")"; |
| 2183 v8::Local<v8::Value> result = | 2183 v8::Local<v8::Value> result = |
| 2184 CompileRunChecked(CcTest::isolate(), code.c_str()); | 2184 CompileRunChecked(CcTest::isolate(), code.c_str()); |
| 2185 v8::String::Utf8Value value(result); | 2185 v8::String::Utf8Value value(result); |
| 2186 printf("Check result: %*s\n", value.length(), *value); | 2186 printf("Check result: %*s\n", value.length(), *value); |
| 2187 CHECK_EQ(0, value.length()); | 2187 CHECK_EQ(0, value.length()); |
| 2188 | 2188 |
| 2189 i::V8::SetPlatformForTesting(old_platform); | 2189 i::V8::SetPlatformForTesting(old_platform); |
| 2190 } | 2190 } |
| OLD | NEW |