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

Side by Side Diff: src/wasm/wasm-macro-gen.h

Issue 1787733002: [wasm] Fix OpcodeLength() calculation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 #ifndef V8_WASM_MACRO_GEN_H_ 5 #ifndef V8_WASM_MACRO_GEN_H_
6 #define V8_WASM_MACRO_GEN_H_ 6 #define V8_WASM_MACRO_GEN_H_
7 7
8 #include "src/wasm/wasm-opcodes.h" 8 #include "src/wasm/wasm-opcodes.h"
9 9
10 #define U32_LE(v) \ 10 #define U32_LE(v) \
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 #define WASM_NO_LOCALS 0 104 #define WASM_NO_LOCALS 0
105 105
106 namespace v8 { 106 namespace v8 {
107 namespace internal { 107 namespace internal {
108 namespace wasm { 108 namespace wasm {
109 109
110 inline void CheckI32v(int32_t value, int length) { 110 inline void CheckI32v(int32_t value, int length) {
111 DCHECK(length >= 1 && length <= 5); 111 DCHECK(length >= 1 && length <= 5);
112 DCHECK(length == 5 || I32V_IN_RANGE(value, length)); 112 DCHECK(length == 5 || I32V_IN_RANGE(value, length));
113 DCHECK(length == 1 || !I32V_IN_RANGE(value, length - 1));
binji 2016/03/11 18:10:03 yeah, probably better this way.
114 } 113 }
115 114
116 inline void CheckI64v(int64_t value, int length) { 115 inline void CheckI64v(int64_t value, int length) {
117 DCHECK(length >= 1 && length <= 10); 116 DCHECK(length >= 1 && length <= 10);
118 DCHECK(length == 10 || I64V_IN_RANGE(value, length)); 117 DCHECK(length == 10 || I64V_IN_RANGE(value, length));
119 DCHECK(length == 1 || !I64V_IN_RANGE(value, length - 1));
120 } 118 }
121 119
122 // A helper for encoding local declarations prepended to the body of a 120 // A helper for encoding local declarations prepended to the body of a
123 // function. 121 // function.
124 class LocalDeclEncoder { 122 class LocalDeclEncoder {
125 public: 123 public:
126 // Prepend local declarations by creating a new buffer and copying data 124 // Prepend local declarations by creating a new buffer and copying data
127 // over. The new buffer must be delete[]'d by the caller. 125 // over. The new buffer must be delete[]'d by the caller.
128 void Prepend(const byte** start, const byte** end) const { 126 void Prepend(const byte** start, const byte** end) const {
129 size_t size = (*end - *start); 127 size_t size = (*end - *start);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x 503 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x
506 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x 504 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x
507 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x 505 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x
508 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x 506 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x
509 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x 507 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x
510 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x 508 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x
511 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x 509 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x
512 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x 510 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x
513 511
514 #endif // V8_WASM_MACRO_GEN_H_ 512 #endif // V8_WASM_MACRO_GEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698