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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg"); | 1555 fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg"); |
1556 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); | 1556 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); |
1557 free(fake_argv[1]); | 1557 free(fake_argv[1]); |
1558 delete[] fake_argv; | 1558 delete[] fake_argv; |
1559 } | 1559 } |
1560 #endif | 1560 #endif |
1561 | 1561 |
1562 | 1562 |
1563 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 1563 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
1564 public: | 1564 public: |
1565 virtual void* Allocate(size_t length) { | 1565 virtual void* Allocate(size_t length) { return malloc(length); } |
1566 void* result = malloc(length); | |
1567 memset(result, 0, length); | |
1568 return result; | |
1569 } | |
1570 virtual void* AllocateUninitialized(size_t length) { | |
1571 return malloc(length); | |
1572 } | |
1573 virtual void Free(void* data) { free(data); } | 1566 virtual void Free(void* data) { free(data); } |
1574 }; | 1567 }; |
1575 | 1568 |
1576 | 1569 |
1577 int Shell::Main(int argc, char* argv[]) { | 1570 int Shell::Main(int argc, char* argv[]) { |
1578 if (!SetOptions(argc, argv)) return 1; | 1571 if (!SetOptions(argc, argv)) return 1; |
1579 v8::V8::InitializeICU(); | 1572 v8::V8::InitializeICU(); |
1580 #ifndef V8_SHARED | 1573 #ifndef V8_SHARED |
1581 i::FLAG_harmony_array_buffer = true; | 1574 i::FLAG_harmony_array_buffer = true; |
1582 i::FLAG_harmony_typed_arrays = true; | 1575 i::FLAG_harmony_typed_arrays = true; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 } | 1647 } |
1655 | 1648 |
1656 } // namespace v8 | 1649 } // namespace v8 |
1657 | 1650 |
1658 | 1651 |
1659 #ifndef GOOGLE3 | 1652 #ifndef GOOGLE3 |
1660 int main(int argc, char* argv[]) { | 1653 int main(int argc, char* argv[]) { |
1661 return v8::Shell::Main(argc, argv); | 1654 return v8::Shell::Main(argc, argv); |
1662 } | 1655 } |
1663 #endif | 1656 #endif |
OLD | NEW |