Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1022)

Side by Side Diff: src/wasm/encoder.cc

Issue 1581223002: MIPS: Fix unaligned read/write operations in wasm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/utils.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/utils.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698