OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 649 |
650 void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) { | 650 void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) { |
651 for (int i = 0; i < args.Length(); i++) { | 651 for (int i = 0; i < args.Length(); i++) { |
652 HandleScope handle_scope(args.GetIsolate()); | 652 HandleScope handle_scope(args.GetIsolate()); |
653 if (i != 0) { | 653 if (i != 0) { |
654 printf(" "); | 654 printf(" "); |
655 } | 655 } |
656 | 656 |
657 // Explicitly catch potential exceptions in toString(). | 657 // Explicitly catch potential exceptions in toString(). |
658 v8::TryCatch try_catch(args.GetIsolate()); | 658 v8::TryCatch try_catch(args.GetIsolate()); |
| 659 Local<Value> arg = args[i]; |
659 Local<String> str_obj; | 660 Local<String> str_obj; |
660 if (!args[i] | 661 |
661 ->ToString(args.GetIsolate()->GetCurrentContext()) | 662 if (arg->IsSymbol()) { |
| 663 arg = Local<Symbol>::Cast(arg)->Name(); |
| 664 } |
| 665 if (!arg->ToString(args.GetIsolate()->GetCurrentContext()) |
662 .ToLocal(&str_obj)) { | 666 .ToLocal(&str_obj)) { |
663 try_catch.ReThrow(); | 667 try_catch.ReThrow(); |
664 return; | 668 return; |
665 } | 669 } |
666 | 670 |
667 v8::String::Utf8Value str(str_obj); | 671 v8::String::Utf8Value str(str_obj); |
668 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); | 672 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); |
669 if (n != str.length()) { | 673 if (n != str.length()) { |
670 printf("Error in fwrite\n"); | 674 printf("Error in fwrite\n"); |
671 Exit(1); | 675 Exit(1); |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 } | 2555 } |
2552 | 2556 |
2553 } // namespace v8 | 2557 } // namespace v8 |
2554 | 2558 |
2555 | 2559 |
2556 #ifndef GOOGLE3 | 2560 #ifndef GOOGLE3 |
2557 int main(int argc, char* argv[]) { | 2561 int main(int argc, char* argv[]) { |
2558 return v8::Shell::Main(argc, argv); | 2562 return v8::Shell::Main(argc, argv); |
2559 } | 2563 } |
2560 #endif | 2564 #endif |
OLD | NEW |