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

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, 11 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
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 next = next | 0x80; 583 next = next | 0x80;
584 } 584 }
585 output.push_back(next); 585 output.push_back(next);
586 shift += 7; 586 shift += 7;
587 } while ((next & 0x80) != 0); 587 } while ((next & 0x80) != 0);
588 return output; 588 return output;
589 } 589 }
590 } // namespace wasm 590 } // namespace wasm
591 } // namespace internal 591 } // namespace internal
592 } // namespace v8 592 } // namespace v8
OLDNEW
« src/utils.h ('K') | « src/wasm/ast-decoder.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698