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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 Context::Scope context_scope(realm); | 340 Context::Scope context_scope(realm); |
341 Handle<Script> script = Shell::CompileString( | 341 Handle<Script> script = Shell::CompileString( |
342 isolate, source, name, options.compile_options, source_type); | 342 isolate, source, name, options.compile_options, source_type); |
343 if (script.IsEmpty()) { | 343 if (script.IsEmpty()) { |
344 // Print errors that happened during compilation. | 344 // Print errors that happened during compilation. |
345 if (report_exceptions && !FLAG_debugger) | 345 if (report_exceptions && !FLAG_debugger) |
346 ReportException(isolate, &try_catch); | 346 ReportException(isolate, &try_catch); |
347 return false; | 347 return false; |
348 } | 348 } |
349 result = script->Run(); | 349 result = script->Run(); |
| 350 EmptyMessageQueues(isolate); |
350 data->realm_current_ = data->realm_switch_; | 351 data->realm_current_ = data->realm_switch_; |
351 } | 352 } |
352 if (result.IsEmpty()) { | 353 if (result.IsEmpty()) { |
353 DCHECK(try_catch.HasCaught()); | 354 DCHECK(try_catch.HasCaught()); |
354 // Print errors that happened during execution. | 355 // Print errors that happened during execution. |
355 if (report_exceptions && !FLAG_debugger) | 356 if (report_exceptions && !FLAG_debugger) |
356 ReportException(isolate, &try_catch); | 357 ReportException(isolate, &try_catch); |
357 return false; | 358 return false; |
358 } | 359 } |
359 DCHECK(!try_catch.HasCaught()); | 360 DCHECK(!try_catch.HasCaught()); |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 } | 1979 } |
1979 if (options.invoke_weak_callbacks) { | 1980 if (options.invoke_weak_callbacks) { |
1980 // By sending a low memory notifications, we will try hard to collect all | 1981 // By sending a low memory notifications, we will try hard to collect all |
1981 // garbage and will therefore also invoke all weak callbacks of actually | 1982 // garbage and will therefore also invoke all weak callbacks of actually |
1982 // unreachable persistent handles. | 1983 // unreachable persistent handles. |
1983 isolate->LowMemoryNotification(); | 1984 isolate->LowMemoryNotification(); |
1984 } | 1985 } |
1985 } | 1986 } |
1986 | 1987 |
1987 | 1988 |
| 1989 void Shell::EmptyMessageQueues(Isolate* isolate) { |
| 1990 while (v8::platform::PumpMessageLoop(g_platform, isolate)) continue; |
| 1991 } |
| 1992 |
| 1993 |
1988 #ifndef V8_SHARED | 1994 #ifndef V8_SHARED |
1989 bool Shell::SerializeValue(Isolate* isolate, Handle<Value> value, | 1995 bool Shell::SerializeValue(Isolate* isolate, Handle<Value> value, |
1990 const ObjectList& to_transfer, | 1996 const ObjectList& to_transfer, |
1991 ObjectList* seen_objects, | 1997 ObjectList* seen_objects, |
1992 SerializationData* out_data) { | 1998 SerializationData* out_data) { |
1993 DCHECK(out_data); | 1999 DCHECK(out_data); |
1994 Local<Context> context = isolate->GetCurrentContext(); | 2000 Local<Context> context = isolate->GetCurrentContext(); |
1995 | 2001 |
1996 if (value->IsUndefined()) { | 2002 if (value->IsUndefined()) { |
1997 out_data->WriteTag(kSerializationTagUndefined); | 2003 out_data->WriteTag(kSerializationTagUndefined); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 } | 2445 } |
2440 | 2446 |
2441 } // namespace v8 | 2447 } // namespace v8 |
2442 | 2448 |
2443 | 2449 |
2444 #ifndef GOOGLE3 | 2450 #ifndef GOOGLE3 |
2445 int main(int argc, char* argv[]) { | 2451 int main(int argc, char* argv[]) { |
2446 return v8::Shell::Main(argc, argv); | 2452 return v8::Shell::Main(argc, argv); |
2447 } | 2453 } |
2448 #endif | 2454 #endif |
OLD | NEW |