Chromium Code Reviews| 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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1564 char **fake_argv = new char*[2]; | 1564 char **fake_argv = new char*[2]; |
| 1565 fake_argv[0] = NULL; | 1565 fake_argv[0] = NULL; |
| 1566 fake_argv[1] = strdup("--harmony-typed-arrays"); | 1566 fake_argv[1] = strdup("--harmony-typed-arrays"); |
| 1567 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); | 1567 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); |
| 1568 free(fake_argv[1]); | 1568 free(fake_argv[1]); |
| 1569 delete[] fake_argv; | 1569 delete[] fake_argv; |
| 1570 } | 1570 } |
| 1571 #endif | 1571 #endif |
| 1572 | 1572 |
| 1573 | 1573 |
| 1574 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | |
| 1575 public: | |
| 1576 virtual void* Allocate(size_t length) { return malloc(length); } | |
| 1577 virtual void Free(void* data) { free(data); } | |
| 1578 }; | |
| 1579 | |
| 1580 | |
| 1574 int Shell::Main(int argc, char* argv[]) { | 1581 int Shell::Main(int argc, char* argv[]) { |
| 1575 if (!SetOptions(argc, argv)) return 1; | 1582 if (!SetOptions(argc, argv)) return 1; |
| 1576 #ifndef V8_SHARED | 1583 #ifndef V8_SHARED |
| 1577 i::FLAG_harmony_array_buffer = true; | 1584 i::FLAG_harmony_array_buffer = true; |
| 1578 i::FLAG_harmony_typed_arrays = true; | 1585 i::FLAG_harmony_typed_arrays = true; |
| 1579 #else | 1586 #else |
| 1580 EnableHarmonyTypedArraysViaCommandLine(); | 1587 EnableHarmonyTypedArraysViaCommandLine(); |
| 1581 #endif | 1588 #endif |
| 1589 static ShellArrayBufferAllocator array_buffer_allocator; | |
|
Sven Panne
2013/06/11 09:54:37
Why do we need "static"?
Dmitry Lomov (no reviews)
2013/06/11 10:40:09
Done.
| |
| 1590 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); | |
| 1582 int result = 0; | 1591 int result = 0; |
| 1583 Isolate* isolate = Isolate::GetCurrent(); | 1592 Isolate* isolate = Isolate::GetCurrent(); |
| 1584 DumbLineEditor dumb_line_editor(isolate); | 1593 DumbLineEditor dumb_line_editor(isolate); |
| 1585 { | 1594 { |
| 1586 Initialize(isolate); | 1595 Initialize(isolate); |
| 1587 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1596 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| 1588 vTune::InitializeVtuneForV8(); | 1597 vTune::InitializeVtuneForV8(); |
| 1589 #endif | 1598 #endif |
| 1590 PerIsolateData data(isolate); | 1599 PerIsolateData data(isolate); |
| 1591 InitializeDebugger(isolate); | 1600 InitializeDebugger(isolate); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1647 } | 1656 } |
| 1648 | 1657 |
| 1649 } // namespace v8 | 1658 } // namespace v8 |
| 1650 | 1659 |
| 1651 | 1660 |
| 1652 #ifndef GOOGLE3 | 1661 #ifndef GOOGLE3 |
| 1653 int main(int argc, char* argv[]) { | 1662 int main(int argc, char* argv[]) { |
| 1654 return v8::Shell::Main(argc, argv); | 1663 return v8::Shell::Main(argc, argv); |
| 1655 } | 1664 } |
| 1656 #endif | 1665 #endif |
| OLD | NEW |