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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 static const int kArgc = 3; | 619 static const int kArgc = 3; |
620 v8::Local<v8::Context> evaluation_context = | 620 v8::Local<v8::Context> evaluation_context = |
621 v8::Local<v8::Context>::New(isolate, evaluation_context_); | 621 v8::Local<v8::Context>::New(isolate, evaluation_context_); |
622 Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full }; | 622 Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full }; |
623 Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv); | 623 Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv); |
624 return handle_scope.Escape(Local<Array>::Cast(val)); | 624 return handle_scope.Escape(Local<Array>::Cast(val)); |
625 } | 625 } |
626 | 626 |
627 | 627 |
628 #ifdef ENABLE_DEBUGGER_SUPPORT | 628 #ifdef ENABLE_DEBUGGER_SUPPORT |
629 Handle<Object> Shell::DebugMessageDetails(Isolate* isolate, | 629 Local<Object> Shell::DebugMessageDetails(Isolate* isolate, |
630 Handle<String> message) { | 630 Handle<String> message) { |
631 HandleScope handle_scope(isolate); | 631 EscapableHandleScope handle_scope(isolate); |
632 v8::Local<v8::Context> context = | 632 v8::Local<v8::Context> context = |
633 v8::Local<v8::Context>::New(isolate, utility_context_); | 633 v8::Local<v8::Context>::New(isolate, utility_context_); |
634 v8::Context::Scope context_scope(context); | 634 v8::Context::Scope context_scope(context); |
635 Handle<Object> global = context->Global(); | 635 Handle<Object> global = context->Global(); |
636 Handle<Value> fun = | 636 Handle<Value> fun = |
637 global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails")); | 637 global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails")); |
638 static const int kArgc = 1; | 638 static const int kArgc = 1; |
639 Handle<Value> argv[kArgc] = { message }; | 639 Handle<Value> argv[kArgc] = { message }; |
640 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); | 640 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); |
641 return Handle<Object>::Cast(val); | 641 return handle_scope.Escape(Local<Object>(Handle<Object>::Cast(val))); |
642 } | 642 } |
643 | 643 |
644 | 644 |
645 Handle<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate, | 645 Local<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate, |
646 Handle<String> command) { | 646 Handle<String> command) { |
647 HandleScope handle_scope(isolate); | 647 EscapableHandleScope handle_scope(isolate); |
648 v8::Local<v8::Context> context = | 648 v8::Local<v8::Context> context = |
649 v8::Local<v8::Context>::New(isolate, utility_context_); | 649 v8::Local<v8::Context>::New(isolate, utility_context_); |
650 v8::Context::Scope context_scope(context); | 650 v8::Context::Scope context_scope(context); |
651 Handle<Object> global = context->Global(); | 651 Handle<Object> global = context->Global(); |
652 Handle<Value> fun = | 652 Handle<Value> fun = |
653 global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest")); | 653 global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest")); |
654 static const int kArgc = 1; | 654 static const int kArgc = 1; |
655 Handle<Value> argv[kArgc] = { command }; | 655 Handle<Value> argv[kArgc] = { command }; |
656 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); | 656 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); |
657 return val; | 657 return handle_scope.Escape(Local<Value>(val)); |
658 } | 658 } |
659 | 659 |
660 | 660 |
661 void Shell::DispatchDebugMessages() { | 661 void Shell::DispatchDebugMessages() { |
662 Isolate* isolate = v8::Isolate::GetCurrent(); | 662 Isolate* isolate = v8::Isolate::GetCurrent(); |
663 HandleScope handle_scope(isolate); | 663 HandleScope handle_scope(isolate); |
664 v8::Local<v8::Context> context = | 664 v8::Local<v8::Context> context = |
665 v8::Local<v8::Context>::New(isolate, Shell::evaluation_context_); | 665 v8::Local<v8::Context>::New(isolate, Shell::evaluation_context_); |
666 v8::Context::Scope context_scope(context); | 666 v8::Context::Scope context_scope(context); |
667 v8::Debug::ProcessDebugMessages(); | 667 v8::Debug::ProcessDebugMessages(); |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 } | 1763 } |
1764 | 1764 |
1765 } // namespace v8 | 1765 } // namespace v8 |
1766 | 1766 |
1767 | 1767 |
1768 #ifndef GOOGLE3 | 1768 #ifndef GOOGLE3 |
1769 int main(int argc, char* argv[]) { | 1769 int main(int argc, char* argv[]) { |
1770 return v8::Shell::Main(argc, argv); | 1770 return v8::Shell::Main(argc, argv); |
1771 } | 1771 } |
1772 #endif | 1772 #endif |
OLD | NEW |