OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/signature.h" | 5 #include "src/signature.h" |
6 | 6 |
7 #include "src/handles.h" | 7 #include "src/handles.h" |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 indices in body */ | 23 indices in body */ |
24 | 24 |
25 namespace { | 25 namespace { |
26 void EmitUint8(byte** b, uint8_t x) { | 26 void EmitUint8(byte** b, uint8_t x) { |
27 Memory::uint8_at(*b) = x; | 27 Memory::uint8_at(*b) = x; |
28 *b += 1; | 28 *b += 1; |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 void EmitUint16(byte** b, uint16_t x) { | 32 void EmitUint16(byte** b, uint16_t x) { |
33 Memory::uint16_at(*b) = x; | 33 WriteUnalignedUInt16(*b, x); |
34 *b += 2; | 34 *b += 2; |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 void EmitUint32(byte** b, uint32_t x) { | 38 void EmitUint32(byte** b, uint32_t x) { |
39 Memory::uint32_at(*b) = x; | 39 WriteUnalignedUInt32(*b, x); |
40 *b += 4; | 40 *b += 4; |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 void EmitVarInt(byte** b, size_t val) { | 44 void EmitVarInt(byte** b, size_t val) { |
45 while (true) { | 45 while (true) { |
46 size_t next = val >> 7; | 46 size_t next = val >> 7; |
47 byte out = static_cast<byte>(val & 0x7f); | 47 byte out = static_cast<byte>(val & 0x7f); |
48 if (next) { | 48 if (next) { |
49 *((*b)++) = 0x80 | out; | 49 *((*b)++) = 0x80 | out; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 next = next | 0x80; | 577 next = next | 0x80; |
578 } | 578 } |
579 output.push_back(next); | 579 output.push_back(next); |
580 shift += 7; | 580 shift += 7; |
581 } while ((next & 0x80) != 0); | 581 } while ((next & 0x80) != 0); |
582 return output; | 582 return output; |
583 } | 583 } |
584 } // namespace wasm | 584 } // namespace wasm |
585 } // namespace internal | 585 } // namespace internal |
586 } // namespace v8 | 586 } // namespace v8 |
OLD | NEW |