| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 #ifdef V8_SHARED | 43 #ifdef V8_SHARED |
| 44 #include <assert.h> | 44 #include <assert.h> |
| 45 #endif // V8_SHARED | 45 #endif // V8_SHARED |
| 46 | 46 |
| 47 #ifndef V8_SHARED | 47 #ifndef V8_SHARED |
| 48 #include <algorithm> | 48 #include <algorithm> |
| 49 #endif // !V8_SHARED | 49 #endif // !V8_SHARED |
| 50 | 50 |
| 51 #ifdef V8_SHARED | 51 #ifdef V8_SHARED |
| 52 #include "../include/v8-defaults.h" |
| 52 #include "../include/v8-testing.h" | 53 #include "../include/v8-testing.h" |
| 53 #endif // V8_SHARED | 54 #endif // V8_SHARED |
| 54 | 55 |
| 55 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 56 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 56 #include "third_party/vtune/v8-vtune.h" | 57 #include "third_party/vtune/v8-vtune.h" |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 #include "d8.h" | 60 #include "d8.h" |
| 60 | 61 |
| 61 #ifndef V8_SHARED | 62 #ifndef V8_SHARED |
| 62 #include "api.h" | 63 #include "api.h" |
| 63 #include "checks.h" | 64 #include "checks.h" |
| 64 #include "d8-debug.h" | 65 #include "d8-debug.h" |
| 65 #include "debug.h" | 66 #include "debug.h" |
| 66 #include "natives.h" | 67 #include "natives.h" |
| 67 #include "platform.h" | 68 #include "platform.h" |
| 68 #include "v8.h" | 69 #include "v8.h" |
| 70 #include "v8-defaults.h" |
| 69 #endif // V8_SHARED | 71 #endif // V8_SHARED |
| 70 | 72 |
| 71 #if !defined(_WIN32) && !defined(_WIN64) | 73 #if !defined(_WIN32) && !defined(_WIN64) |
| 72 #include <unistd.h> // NOLINT | 74 #include <unistd.h> // NOLINT |
| 73 #endif | 75 #endif |
| 74 | 76 |
| 75 #ifndef ASSERT | 77 #ifndef ASSERT |
| 76 #define ASSERT(condition) assert(condition) | 78 #define ASSERT(condition) assert(condition) |
| 77 #endif | 79 #endif |
| 78 | 80 |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 const int kLongIdlePauseInMs = 1000; | 1521 const int kLongIdlePauseInMs = 1000; |
| 1520 V8::ContextDisposedNotification(); | 1522 V8::ContextDisposedNotification(); |
| 1521 V8::IdleNotification(kLongIdlePauseInMs); | 1523 V8::IdleNotification(kLongIdlePauseInMs); |
| 1522 } | 1524 } |
| 1523 } | 1525 } |
| 1524 | 1526 |
| 1525 #ifndef V8_SHARED | 1527 #ifndef V8_SHARED |
| 1526 // Start preemption if threads have been created and preemption is enabled. | 1528 // Start preemption if threads have been created and preemption is enabled. |
| 1527 if (threads.length() > 0 | 1529 if (threads.length() > 0 |
| 1528 && options.use_preemption) { | 1530 && options.use_preemption) { |
| 1529 Locker::StartPreemption(options.preemption_interval); | 1531 Locker::StartPreemption(isolate, options.preemption_interval); |
| 1530 } | 1532 } |
| 1531 #endif // V8_SHARED | 1533 #endif // V8_SHARED |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 #ifndef V8_SHARED | 1536 #ifndef V8_SHARED |
| 1535 for (int i = 1; i < options.num_isolates; ++i) { | 1537 for (int i = 1; i < options.num_isolates; ++i) { |
| 1536 options.isolate_sources[i].WaitForThread(); | 1538 options.isolate_sources[i].WaitForThread(); |
| 1537 } | 1539 } |
| 1538 | 1540 |
| 1539 for (int i = 0; i < threads.length(); i++) { | 1541 for (int i = 0; i < threads.length(); i++) { |
| 1540 i::Thread* thread = threads[i]; | 1542 i::Thread* thread = threads[i]; |
| 1541 thread->Join(); | 1543 thread->Join(); |
| 1542 delete thread; | 1544 delete thread; |
| 1543 } | 1545 } |
| 1544 | 1546 |
| 1545 if (threads.length() > 0 && options.use_preemption) { | 1547 if (threads.length() > 0 && options.use_preemption) { |
| 1546 Locker lock(isolate); | 1548 Locker lock(isolate); |
| 1547 Locker::StopPreemption(); | 1549 Locker::StopPreemption(isolate); |
| 1548 } | 1550 } |
| 1549 #endif // V8_SHARED | 1551 #endif // V8_SHARED |
| 1550 return 0; | 1552 return 0; |
| 1551 } | 1553 } |
| 1552 | 1554 |
| 1553 | 1555 |
| 1554 #ifdef V8_SHARED | 1556 #ifdef V8_SHARED |
| 1555 static void SetStandaloneFlagsViaCommandLine() { | 1557 static void SetStandaloneFlagsViaCommandLine() { |
| 1556 int fake_argc = 2; | 1558 int fake_argc = 2; |
| 1557 char **fake_argv = new char*[2]; | 1559 char **fake_argv = new char*[2]; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 | 1644 |
| 1643 | 1645 |
| 1644 int Shell::Main(int argc, char* argv[]) { | 1646 int Shell::Main(int argc, char* argv[]) { |
| 1645 if (!SetOptions(argc, argv)) return 1; | 1647 if (!SetOptions(argc, argv)) return 1; |
| 1646 v8::V8::InitializeICU(); | 1648 v8::V8::InitializeICU(); |
| 1647 #ifndef V8_SHARED | 1649 #ifndef V8_SHARED |
| 1648 i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; | 1650 i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; |
| 1649 #else | 1651 #else |
| 1650 SetStandaloneFlagsViaCommandLine(); | 1652 SetStandaloneFlagsViaCommandLine(); |
| 1651 #endif | 1653 #endif |
| 1654 v8::SetDefaultResourceConstraintsForCurrentPlatform(); |
| 1652 ShellArrayBufferAllocator array_buffer_allocator; | 1655 ShellArrayBufferAllocator array_buffer_allocator; |
| 1653 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | 1656 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
| 1654 int result = 0; | 1657 int result = 0; |
| 1655 Isolate* isolate = Isolate::GetCurrent(); | 1658 Isolate* isolate = Isolate::GetCurrent(); |
| 1656 DumbLineEditor dumb_line_editor(isolate); | 1659 DumbLineEditor dumb_line_editor(isolate); |
| 1657 { | 1660 { |
| 1658 Initialize(isolate); | 1661 Initialize(isolate); |
| 1659 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1662 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 1660 vTune::InitializeVtuneForV8(); | 1663 vTune::InitializeVtuneForV8(); |
| 1661 #endif | 1664 #endif |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 } | 1729 } |
| 1727 | 1730 |
| 1728 } // namespace v8 | 1731 } // namespace v8 |
| 1729 | 1732 |
| 1730 | 1733 |
| 1731 #ifndef GOOGLE3 | 1734 #ifndef GOOGLE3 |
| 1732 int main(int argc, char* argv[]) { | 1735 int main(int argc, char* argv[]) { |
| 1733 return v8::Shell::Main(argc, argv); | 1736 return v8::Shell::Main(argc, argv); |
| 1734 } | 1737 } |
| 1735 #endif | 1738 #endif |
| OLD | NEW |