| 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 23681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23692 }; | 23692 }; |
| 23693 | 23693 |
| 23694 | 23694 |
| 23695 Local<Object> ApiCallOptimizationChecker::data; | 23695 Local<Object> ApiCallOptimizationChecker::data; |
| 23696 Local<Object> ApiCallOptimizationChecker::receiver; | 23696 Local<Object> ApiCallOptimizationChecker::receiver; |
| 23697 Local<Object> ApiCallOptimizationChecker::holder; | 23697 Local<Object> ApiCallOptimizationChecker::holder; |
| 23698 Local<Object> ApiCallOptimizationChecker::callee; | 23698 Local<Object> ApiCallOptimizationChecker::callee; |
| 23699 int ApiCallOptimizationChecker::count = 0; | 23699 int ApiCallOptimizationChecker::count = 0; |
| 23700 | 23700 |
| 23701 | 23701 |
| 23702 TEST(TestFunctionCallOptimization) { | 23702 TEST(FunctionCallOptimization) { |
| 23703 i::FLAG_allow_natives_syntax = true; | 23703 i::FLAG_allow_natives_syntax = true; |
| 23704 ApiCallOptimizationChecker checker; | 23704 ApiCallOptimizationChecker checker; |
| 23705 checker.RunAll(); | 23705 checker.RunAll(); |
| 23706 } | 23706 } |
| 23707 | 23707 |
| 23708 | 23708 |
| 23709 static void EmptyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {} |
| 23710 |
| 23711 |
| 23712 TEST(FunctionCallOptimizationMultipleArgs) { |
| 23713 i::FLAG_allow_natives_syntax = true; |
| 23714 LocalContext context; |
| 23715 v8::Isolate* isolate = context->GetIsolate(); |
| 23716 v8::HandleScope scope(isolate); |
| 23717 Handle<Object> global = context->Global(); |
| 23718 Local<v8::Function> function = Function::New(isolate, EmptyCallback); |
| 23719 global->Set(v8_str("x"), function); |
| 23720 CompileRun( |
| 23721 "function x_wrap() {\n" |
| 23722 " for (var i = 0; i < 5; i++) {\n" |
| 23723 " x(1,2,3);\n" |
| 23724 " }\n" |
| 23725 "}\n" |
| 23726 "x_wrap();\n" |
| 23727 "%OptimizeFunctionOnNextCall(x_wrap);" |
| 23728 "x_wrap();\n"); |
| 23729 } |
| 23730 |
| 23731 |
| 23709 static const char* last_event_message; | 23732 static const char* last_event_message; |
| 23710 static int last_event_status; | 23733 static int last_event_status; |
| 23711 void StoringEventLoggerCallback(const char* message, int status) { | 23734 void StoringEventLoggerCallback(const char* message, int status) { |
| 23712 last_event_message = message; | 23735 last_event_message = message; |
| 23713 last_event_status = status; | 23736 last_event_status = status; |
| 23714 } | 23737 } |
| 23715 | 23738 |
| 23716 | 23739 |
| 23717 TEST(EventLogging) { | 23740 TEST(EventLogging) { |
| 23718 v8::Isolate* isolate = CcTest::isolate(); | 23741 v8::Isolate* isolate = CcTest::isolate(); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24755 "bar2.js"); | 24778 "bar2.js"); |
| 24756 } | 24779 } |
| 24757 | 24780 |
| 24758 | 24781 |
| 24759 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24782 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
| 24760 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24783 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
| 24761 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24784 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
| 24762 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24785 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
| 24763 "bar2.js"); | 24786 "bar2.js"); |
| 24764 } | 24787 } |
| OLD | NEW |