| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 23600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23611 }; | 23611 }; |
| 23612 | 23612 |
| 23613 | 23613 |
| 23614 Local<Object> ApiCallOptimizationChecker::data; | 23614 Local<Object> ApiCallOptimizationChecker::data; |
| 23615 Local<Object> ApiCallOptimizationChecker::receiver; | 23615 Local<Object> ApiCallOptimizationChecker::receiver; |
| 23616 Local<Object> ApiCallOptimizationChecker::holder; | 23616 Local<Object> ApiCallOptimizationChecker::holder; |
| 23617 Local<Object> ApiCallOptimizationChecker::callee; | 23617 Local<Object> ApiCallOptimizationChecker::callee; |
| 23618 int ApiCallOptimizationChecker::count = 0; | 23618 int ApiCallOptimizationChecker::count = 0; |
| 23619 | 23619 |
| 23620 | 23620 |
| 23621 TEST(TestFunctionCallOptimization) { | 23621 TEST(FunctionCallOptimization) { |
| 23622 i::FLAG_allow_natives_syntax = true; | 23622 i::FLAG_allow_natives_syntax = true; |
| 23623 ApiCallOptimizationChecker checker; | 23623 ApiCallOptimizationChecker checker; |
| 23624 checker.RunAll(); | 23624 checker.RunAll(); |
| 23625 } | 23625 } |
| 23626 | 23626 |
| 23627 | 23627 |
| 23628 static void EmptyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {} |
| 23629 |
| 23630 |
| 23631 TEST(FunctionCallOptimizationMultipleArgs) { |
| 23632 i::FLAG_allow_natives_syntax = true; |
| 23633 LocalContext context; |
| 23634 v8::Isolate* isolate = context->GetIsolate(); |
| 23635 v8::HandleScope scope(isolate); |
| 23636 Handle<Object> global = context->Global(); |
| 23637 Local<v8::Function> function = Function::New(isolate, EmptyCallback); |
| 23638 global->Set(v8_str("x"), function); |
| 23639 CompileRun( |
| 23640 "function x_wrap() {\n" |
| 23641 " for (var i = 0; i < 5; i++) {\n" |
| 23642 " x(1,2,3);\n" |
| 23643 " }\n" |
| 23644 "}\n" |
| 23645 "x_wrap();\n" |
| 23646 "%OptimizeFunctionOnNextCall(x_wrap);" |
| 23647 "x_wrap();\n"); |
| 23648 } |
| 23649 |
| 23650 |
| 23628 static const char* last_event_message; | 23651 static const char* last_event_message; |
| 23629 static int last_event_status; | 23652 static int last_event_status; |
| 23630 void StoringEventLoggerCallback(const char* message, int status) { | 23653 void StoringEventLoggerCallback(const char* message, int status) { |
| 23631 last_event_message = message; | 23654 last_event_message = message; |
| 23632 last_event_status = status; | 23655 last_event_status = status; |
| 23633 } | 23656 } |
| 23634 | 23657 |
| 23635 | 23658 |
| 23636 TEST(EventLogging) { | 23659 TEST(EventLogging) { |
| 23637 v8::Isolate* isolate = CcTest::isolate(); | 23660 v8::Isolate* isolate = CcTest::isolate(); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24674 "bar2.js"); | 24697 "bar2.js"); |
| 24675 } | 24698 } |
| 24676 | 24699 |
| 24677 | 24700 |
| 24678 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24701 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
| 24679 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24702 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
| 24680 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24703 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
| 24681 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24704 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
| 24682 "bar2.js"); | 24705 "bar2.js"); |
| 24683 } | 24706 } |
| OLD | NEW |