| 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 } | 1605 } |
| 1606 printf("}\n"); | 1606 printf("}\n"); |
| 1607 #undef ROOT_LIST_CASE | 1607 #undef ROOT_LIST_CASE |
| 1608 } | 1608 } |
| 1609 #endif // !V8_SHARED | 1609 #endif // !V8_SHARED |
| 1610 | 1610 |
| 1611 | 1611 |
| 1612 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 1612 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
| 1613 public: | 1613 public: |
| 1614 virtual void* Allocate(size_t length) { | 1614 virtual void* Allocate(size_t length) { |
| 1615 void* result = malloc(length); | 1615 return memset(AllocateUninitialized(length), 0, length); |
| 1616 memset(result, 0, length); | |
| 1617 return result; | |
| 1618 } | 1616 } |
| 1619 virtual void* AllocateUninitialized(size_t length) { | 1617 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
| 1620 return malloc(length); | |
| 1621 } | |
| 1622 virtual void Free(void* data, size_t) { free(data); } | 1618 virtual void Free(void* data, size_t) { free(data); } |
| 1623 // TODO(dslomov): Remove when v8:2823 is fixed. | |
| 1624 virtual void Free(void* data) { | |
| 1625 #ifndef V8_SHARED | |
| 1626 UNREACHABLE(); | |
| 1627 #endif | |
| 1628 } | |
| 1629 }; | 1619 }; |
| 1630 | 1620 |
| 1631 | 1621 |
| 1632 class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 1622 class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
| 1633 public: | 1623 public: |
| 1634 virtual void* Allocate(size_t) V8_OVERRIDE { | 1624 virtual void* Allocate(size_t) V8_OVERRIDE { |
| 1635 return malloc(0); | 1625 return malloc(0); |
| 1636 } | 1626 } |
| 1637 virtual void* AllocateUninitialized(size_t length) V8_OVERRIDE { | 1627 virtual void* AllocateUninitialized(size_t length) V8_OVERRIDE { |
| 1638 return malloc(0); | 1628 return malloc(0); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 } | 1730 } |
| 1741 | 1731 |
| 1742 } // namespace v8 | 1732 } // namespace v8 |
| 1743 | 1733 |
| 1744 | 1734 |
| 1745 #ifndef GOOGLE3 | 1735 #ifndef GOOGLE3 |
| 1746 int main(int argc, char* argv[]) { | 1736 int main(int argc, char* argv[]) { |
| 1747 return v8::Shell::Main(argc, argv); | 1737 return v8::Shell::Main(argc, argv); |
| 1748 } | 1738 } |
| 1749 #endif | 1739 #endif |
| OLD | NEW |