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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 v8::Local<v8::Context> context = | 126 v8::Local<v8::Context> context = |
127 v8::Local<v8::Context>::New(isolate, debug_message_context); | 127 v8::Local<v8::Context>::New(isolate, debug_message_context); |
128 v8::Context::Scope scope(context); | 128 v8::Context::Scope scope(context); |
129 | 129 |
130 v8::Debug::ProcessDebugMessages(); | 130 v8::Debug::ProcessDebugMessages(); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 int RunMain(int argc, char* argv[]) { | 134 int RunMain(int argc, char* argv[]) { |
135 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 135 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
136 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 136 v8::Isolate* isolate = v8::Isolate::New(); |
| 137 v8::Isolate::Scope isolate_scope(isolate); |
| 138 v8::Locker locker(isolate); |
137 v8::HandleScope handle_scope(isolate); | 139 v8::HandleScope handle_scope(isolate); |
138 | 140 |
139 v8::Handle<v8::String> script_source; | 141 v8::Handle<v8::String> script_source; |
140 v8::Handle<v8::Value> script_name; | 142 v8::Handle<v8::Value> script_name; |
141 int script_param_counter = 0; | 143 int script_param_counter = 0; |
142 | 144 |
143 int port_number = -1; | 145 int port_number = -1; |
144 bool wait_for_connection = false; | 146 bool wait_for_connection = false; |
145 bool support_callback = false; | 147 bool support_callback = false; |
146 | 148 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 207 } |
206 | 208 |
207 // Create a new execution environment containing the built-in | 209 // Create a new execution environment containing the built-in |
208 // functions | 210 // functions |
209 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); | 211 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); |
210 // Enter the newly created execution environment. | 212 // Enter the newly created execution environment. |
211 v8::Context::Scope context_scope(context); | 213 v8::Context::Scope context_scope(context); |
212 | 214 |
213 debug_message_context.Reset(isolate, context); | 215 debug_message_context.Reset(isolate, context); |
214 | 216 |
215 v8::Locker locker(isolate); | |
216 | |
217 if (support_callback) { | 217 if (support_callback) { |
218 v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); | 218 v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); |
219 } | 219 } |
220 | 220 |
221 if (port_number != -1) { | 221 if (port_number != -1) { |
222 v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); | 222 v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); |
223 } | 223 } |
224 | 224 |
225 bool report_exceptions = true; | 225 bool report_exceptions = true; |
226 | 226 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 433 } |
434 // Remove newline char | 434 // Remove newline char |
435 for (char* pos = buffer; *pos != '\0'; pos++) { | 435 for (char* pos = buffer; *pos != '\0'; pos++) { |
436 if (*pos == '\n') { | 436 if (*pos == '\n') { |
437 *pos = '\0'; | 437 *pos = '\0'; |
438 break; | 438 break; |
439 } | 439 } |
440 } | 440 } |
441 return v8::String::NewFromUtf8(isolate, buffer); | 441 return v8::String::NewFromUtf8(isolate, buffer); |
442 } | 442 } |
OLD | NEW |