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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 if (threads.length() > 0 && options.use_preemption) { | 1540 if (threads.length() > 0 && options.use_preemption) { |
1541 Locker lock(isolate); | 1541 Locker lock(isolate); |
1542 Locker::StopPreemption(); | 1542 Locker::StopPreemption(); |
1543 } | 1543 } |
1544 #endif // V8_SHARED | 1544 #endif // V8_SHARED |
1545 return 0; | 1545 return 0; |
1546 } | 1546 } |
1547 | 1547 |
1548 | 1548 |
1549 #ifdef V8_SHARED | 1549 #ifdef V8_SHARED |
1550 static void EnableHarmonyTypedArraysViaCommandLine() { | 1550 static void SetStandaloneFlagsViaCommandLine() { |
1551 int fake_argc = 2; | 1551 int fake_argc = 3; |
1552 char **fake_argv = new char*[2]; | 1552 char **fake_argv = new char*[3]; |
1553 fake_argv[0] = NULL; | 1553 fake_argv[0] = NULL; |
1554 fake_argv[1] = strdup("--harmony-typed-arrays"); | 1554 fake_argv[1] = strdup("--harmony-typed-arrays"); |
| 1555 fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg"); |
1555 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); | 1556 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); |
1556 free(fake_argv[1]); | 1557 free(fake_argv[1]); |
1557 delete[] fake_argv; | 1558 delete[] fake_argv; |
1558 } | 1559 } |
1559 #endif | 1560 #endif |
1560 | 1561 |
1561 | 1562 |
1562 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 1563 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
1563 public: | 1564 public: |
1564 virtual void* Allocate(size_t length) { return malloc(length); } | 1565 virtual void* Allocate(size_t length) { return malloc(length); } |
1565 virtual void Free(void* data) { free(data); } | 1566 virtual void Free(void* data) { free(data); } |
1566 }; | 1567 }; |
1567 | 1568 |
1568 | 1569 |
1569 int Shell::Main(int argc, char* argv[]) { | 1570 int Shell::Main(int argc, char* argv[]) { |
1570 if (!SetOptions(argc, argv)) return 1; | 1571 if (!SetOptions(argc, argv)) return 1; |
1571 v8::V8::InitializeICU(); | 1572 v8::V8::InitializeICU(); |
1572 #ifndef V8_SHARED | 1573 #ifndef V8_SHARED |
1573 i::FLAG_harmony_array_buffer = true; | 1574 i::FLAG_harmony_array_buffer = true; |
1574 i::FLAG_harmony_typed_arrays = true; | 1575 i::FLAG_harmony_typed_arrays = true; |
| 1576 i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; |
1575 #else | 1577 #else |
1576 EnableHarmonyTypedArraysViaCommandLine(); | 1578 SetStandaloneFlagsViaCommandLine(); |
1577 #endif | 1579 #endif |
1578 ShellArrayBufferAllocator array_buffer_allocator; | 1580 ShellArrayBufferAllocator array_buffer_allocator; |
1579 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | 1581 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
1580 int result = 0; | 1582 int result = 0; |
1581 Isolate* isolate = Isolate::GetCurrent(); | 1583 Isolate* isolate = Isolate::GetCurrent(); |
1582 DumbLineEditor dumb_line_editor(isolate); | 1584 DumbLineEditor dumb_line_editor(isolate); |
1583 { | 1585 { |
1584 Initialize(isolate); | 1586 Initialize(isolate); |
1585 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1587 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
1586 vTune::InitializeVtuneForV8(); | 1588 vTune::InitializeVtuneForV8(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 } | 1647 } |
1646 | 1648 |
1647 } // namespace v8 | 1649 } // namespace v8 |
1648 | 1650 |
1649 | 1651 |
1650 #ifndef GOOGLE3 | 1652 #ifndef GOOGLE3 |
1651 int main(int argc, char* argv[]) { | 1653 int main(int argc, char* argv[]) { |
1652 return v8::Shell::Main(argc, argv); | 1654 return v8::Shell::Main(argc, argv); |
1653 } | 1655 } |
1654 #endif | 1656 #endif |
OLD | NEW |