OLD | NEW |
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 #include "src/asmjs/asm-typer.h" | 5 #include "src/asmjs/asm-typer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 auto* f = AsmType::Float(); | 171 auto* f = AsmType::Float(); |
172 auto* fq = AsmType::FloatQ(); | 172 auto* fq = AsmType::FloatQ(); |
173 auto* fq2f = AsmType::Function(zone_, f); | 173 auto* fq2f = AsmType::Function(zone_, f); |
174 fq2f->AsFunctionType()->AddArgument(fq); | 174 fq2f->AsFunctionType()->AddArgument(fq); |
175 | 175 |
176 auto* s = AsmType::Signed(); | 176 auto* s = AsmType::Signed(); |
177 auto* s2s = AsmType::Function(zone_, s); | 177 auto* s2s = AsmType::Function(zone_, s); |
178 s2s->AsFunctionType()->AddArgument(s); | 178 s2s->AsFunctionType()->AddArgument(s); |
179 | 179 |
180 auto* i = AsmType::Int(); | 180 auto* i = AsmType::Int(); |
| 181 auto* i2s = AsmType::Function(zone_, s); |
| 182 i2s->AsFunctionType()->AddArgument(i); |
| 183 |
181 auto* ii2s = AsmType::Function(zone_, s); | 184 auto* ii2s = AsmType::Function(zone_, s); |
182 ii2s->AsFunctionType()->AddArgument(i); | 185 ii2s->AsFunctionType()->AddArgument(i); |
183 ii2s->AsFunctionType()->AddArgument(i); | 186 ii2s->AsFunctionType()->AddArgument(i); |
184 | 187 |
185 auto* minmax_d = AsmType::MinMaxType(zone_, d, d); | 188 auto* minmax_d = AsmType::MinMaxType(zone_, d, d); |
186 // *VIOLATION* The float variant is not part of the spec, but firefox accepts | 189 // *VIOLATION* The float variant is not part of the spec, but firefox accepts |
187 // it. | 190 // it. |
188 auto* minmax_f = AsmType::MinMaxType(zone_, f, f); | 191 auto* minmax_f = AsmType::MinMaxType(zone_, f, f); |
189 auto* minmax_i = AsmType::MinMaxType(zone_, s, i); | 192 auto* minmax_i = AsmType::MinMaxType(zone_, s, i); |
190 auto* minmax = AsmType::OverloadedFunction(zone_); | 193 auto* minmax = AsmType::OverloadedFunction(zone_); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 {"PI", kMathPI, d}, | 244 {"PI", kMathPI, d}, |
242 {"E", kMathE, d}, | 245 {"E", kMathE, d}, |
243 {"LN2", kMathLN2, d}, | 246 {"LN2", kMathLN2, d}, |
244 {"LN10", kMathLN10, d}, | 247 {"LN10", kMathLN10, d}, |
245 {"LOG2E", kMathLOG2E, d}, | 248 {"LOG2E", kMathLOG2E, d}, |
246 {"LOG10E", kMathLOG10E, d}, | 249 {"LOG10E", kMathLOG10E, d}, |
247 {"SQRT2", kMathSQRT2, d}, | 250 {"SQRT2", kMathSQRT2, d}, |
248 {"SQRT1_2", kMathSQRT1_2, d}, | 251 {"SQRT1_2", kMathSQRT1_2, d}, |
249 {"imul", kMathImul, ii2s}, | 252 {"imul", kMathImul, ii2s}, |
250 {"abs", kMathAbs, abs}, | 253 {"abs", kMathAbs, abs}, |
| 254 // NOTE: clz32 should return fixnum. The current typer can only return |
| 255 // Signed, Float, or Double, so it returns Signed in our version of |
| 256 // asm.js. |
| 257 {"clz32", kMathClz32, i2s}, |
251 {"ceil", kMathCeil, ceil}, | 258 {"ceil", kMathCeil, ceil}, |
252 {"floor", kMathFloor, floor}, | 259 {"floor", kMathFloor, floor}, |
253 {"fround", kMathFround, fround}, | 260 {"fround", kMathFround, fround}, |
254 {"pow", kMathPow, dqdq2d}, | 261 {"pow", kMathPow, dqdq2d}, |
255 {"exp", kMathExp, dq2d}, | 262 {"exp", kMathExp, dq2d}, |
256 {"log", kMathLog, dq2d}, | 263 {"log", kMathLog, dq2d}, |
257 {"min", kMathMin, minmax}, | 264 {"min", kMathMin, minmax}, |
258 {"max", kMathMax, minmax}, | 265 {"max", kMathMax, minmax}, |
259 {"sqrt", kMathSqrt, sqrt}, | 266 {"sqrt", kMathSqrt, sqrt}, |
260 {"cos", kMathCos, dq2d}, | 267 {"cos", kMathCos, dq2d}, |
(...skipping 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 return true; | 2744 return true; |
2738 } | 2745 } |
2739 | 2746 |
2740 *error_message = typer.error_message(); | 2747 *error_message = typer.error_message(); |
2741 return false; | 2748 return false; |
2742 } | 2749 } |
2743 | 2750 |
2744 } // namespace wasm | 2751 } // namespace wasm |
2745 } // namespace internal | 2752 } // namespace internal |
2746 } // namespace v8 | 2753 } // namespace v8 |
OLD | NEW |