| 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 23630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23641 " for (var i = 0; i < 5; i++) {\n" | 23641 " for (var i = 0; i < 5; i++) {\n" |
| 23642 " x(1,2,3);\n" | 23642 " x(1,2,3);\n" |
| 23643 " }\n" | 23643 " }\n" |
| 23644 "}\n" | 23644 "}\n" |
| 23645 "x_wrap();\n" | 23645 "x_wrap();\n" |
| 23646 "%OptimizeFunctionOnNextCall(x_wrap);" | 23646 "%OptimizeFunctionOnNextCall(x_wrap);" |
| 23647 "x_wrap();\n"); | 23647 "x_wrap();\n"); |
| 23648 } | 23648 } |
| 23649 | 23649 |
| 23650 | 23650 |
| 23651 static void ReturnsSymbolCallback( |
| 23652 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 23653 info.GetReturnValue().Set(v8::Symbol::New(info.GetIsolate())); |
| 23654 } |
| 23655 |
| 23656 |
| 23657 TEST(ApiCallbackCanReturnSymbols) { |
| 23658 i::FLAG_allow_natives_syntax = true; |
| 23659 LocalContext context; |
| 23660 v8::Isolate* isolate = context->GetIsolate(); |
| 23661 v8::HandleScope scope(isolate); |
| 23662 Handle<Object> global = context->Global(); |
| 23663 Local<v8::Function> function = Function::New(isolate, ReturnsSymbolCallback); |
| 23664 global->Set(v8_str("x"), function); |
| 23665 CompileRun( |
| 23666 "function x_wrap() {\n" |
| 23667 " for (var i = 0; i < 5; i++) {\n" |
| 23668 " x();\n" |
| 23669 " }\n" |
| 23670 "}\n" |
| 23671 "x_wrap();\n" |
| 23672 "%OptimizeFunctionOnNextCall(x_wrap);" |
| 23673 "x_wrap();\n"); |
| 23674 } |
| 23675 |
| 23676 |
| 23651 static const char* last_event_message; | 23677 static const char* last_event_message; |
| 23652 static int last_event_status; | 23678 static int last_event_status; |
| 23653 void StoringEventLoggerCallback(const char* message, int status) { | 23679 void StoringEventLoggerCallback(const char* message, int status) { |
| 23654 last_event_message = message; | 23680 last_event_message = message; |
| 23655 last_event_status = status; | 23681 last_event_status = status; |
| 23656 } | 23682 } |
| 23657 | 23683 |
| 23658 | 23684 |
| 23659 TEST(EventLogging) { | 23685 TEST(EventLogging) { |
| 23660 v8::Isolate* isolate = CcTest::isolate(); | 23686 v8::Isolate* isolate = CcTest::isolate(); |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24736 "bar2.js"); | 24762 "bar2.js"); |
| 24737 } | 24763 } |
| 24738 | 24764 |
| 24739 | 24765 |
| 24740 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24766 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
| 24741 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24767 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
| 24742 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24768 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
| 24743 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24769 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
| 24744 "bar2.js"); | 24770 "bar2.js"); |
| 24745 } | 24771 } |
| OLD | NEW |