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

Side by Side Diff: src/wasm/wasm-external-refs.h

Issue 1804513002: [wasm] Int64Lowering of I64Div and I64Rem. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 WASM_EXTERNAL_REFS_H 5 #ifndef WASM_EXTERNAL_REFS_H
6 #define WASM_EXTERNAL_REFS_H 6 #define WASM_EXTERNAL_REFS_H
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace wasm { 10 namespace wasm {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // We use "<" here to check the upper bound because of rounding problems: With 132 // We use "<" here to check the upper bound because of rounding problems: With
133 // "<=" some inputs would be considered within uint64 range which are actually 133 // "<=" some inputs would be considered within uint64 range which are actually
134 // not within uint64 range. 134 // not within uint64 range.
135 if (*input > -1.0 && 135 if (*input > -1.0 &&
136 *input < static_cast<double>(std::numeric_limits<uint64_t>::max())) { 136 *input < static_cast<double>(std::numeric_limits<uint64_t>::max())) {
137 *output = static_cast<uint64_t>(*input); 137 *output = static_cast<uint64_t>(*input);
138 return 1; 138 return 1;
139 } 139 }
140 return 0; 140 return 0;
141 } 141 }
142
143 static int32_t int64_div_wrapper(int64_t* dst, int64_t* src) {
144 if (*src == 0) {
145 return 0;
146 }
147 if (*src == -1 && *dst == std::numeric_limits<int64_t>::min()) {
148 return -1;
149 }
150 *dst /= *src;
151 return 1;
152 }
153
154 static int32_t int64_mod_wrapper(int64_t* dst, int64_t* src) {
155 if (*src == 0) {
156 return 0;
157 }
158 *dst %= *src;
159 return 1;
160 }
161
162 static int32_t uint64_div_wrapper(uint64_t* dst, uint64_t* src) {
163 if (*src == 0) {
164 return 0;
165 }
166 *dst /= *src;
167 return 1;
168 }
169
170 static int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) {
171 if (*src == 0) {
172 return 0;
173 }
174 *dst %= *src;
175 return 1;
176 }
142 } // namespace wasm 177 } // namespace wasm
143 } // namespace internal 178 } // namespace internal
144 } // namespace v8 179 } // namespace v8
145 180
146 #endif 181 #endif
OLDNEW
« no previous file with comments | « src/snapshot/serializer-common.cc ('k') | test/cctest/compiler/test-run-calls-to-external-references.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698