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 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 Write(index); | 1571 Write(index); |
1572 } | 1572 } |
1573 | 1573 |
1574 | 1574 |
1575 SerializationTag SerializationData::ReadTag(int* offset) const { | 1575 SerializationTag SerializationData::ReadTag(int* offset) const { |
1576 return static_cast<SerializationTag>(Read<uint8_t>(offset)); | 1576 return static_cast<SerializationTag>(Read<uint8_t>(offset)); |
1577 } | 1577 } |
1578 | 1578 |
1579 | 1579 |
1580 void SerializationData::ReadMemory(void* p, int length, int* offset) const { | 1580 void SerializationData::ReadMemory(void* p, int length, int* offset) const { |
1581 memcpy(p, &data[*offset], length); | 1581 if (length > 0) { |
1582 (*offset) += length; | 1582 memcpy(p, &data[*offset], length); |
| 1583 (*offset) += length; |
| 1584 } |
1583 } | 1585 } |
1584 | 1586 |
1585 | 1587 |
1586 void SerializationData::ReadArrayBufferContents(ArrayBuffer::Contents* contents, | 1588 void SerializationData::ReadArrayBufferContents(ArrayBuffer::Contents* contents, |
1587 int* offset) const { | 1589 int* offset) const { |
1588 int index = Read<int>(offset); | 1590 int index = Read<int>(offset); |
1589 DCHECK(index < array_buffer_contents.length()); | 1591 DCHECK(index < array_buffer_contents.length()); |
1590 *contents = array_buffer_contents[index]; | 1592 *contents = array_buffer_contents[index]; |
1591 } | 1593 } |
1592 | 1594 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 } | 2434 } |
2433 | 2435 |
2434 } // namespace v8 | 2436 } // namespace v8 |
2435 | 2437 |
2436 | 2438 |
2437 #ifndef GOOGLE3 | 2439 #ifndef GOOGLE3 |
2438 int main(int argc, char* argv[]) { | 2440 int main(int argc, char* argv[]) { |
2439 return v8::Shell::Main(argc, argv); | 2441 return v8::Shell::Main(argc, argv); |
2440 } | 2442 } |
2441 #endif | 2443 #endif |
OLD | NEW |