OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 // Required to get M_E etc. in MSVC. | 7 // Required to get M_E etc. in MSVC. |
8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
9 #define _USE_MATH_DEFINES | 9 #define _USE_MATH_DEFINES |
10 #endif | 10 #endif |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 VisitCallArgs(call); | 1078 VisitCallArgs(call); |
1079 if (call_type == kAstF32) { | 1079 if (call_type == kAstF32) { |
1080 current_function_builder_->Emit(kExprF32Sqrt); | 1080 current_function_builder_->Emit(kExprF32Sqrt); |
1081 } else if (call_type == kAstF64) { | 1081 } else if (call_type == kAstF64) { |
1082 current_function_builder_->Emit(kExprF64Sqrt); | 1082 current_function_builder_->Emit(kExprF64Sqrt); |
1083 } else { | 1083 } else { |
1084 UNREACHABLE(); | 1084 UNREACHABLE(); |
1085 } | 1085 } |
1086 break; | 1086 break; |
1087 } | 1087 } |
| 1088 case AsmTyper::kMathClz32: { |
| 1089 VisitCallArgs(call); |
| 1090 DCHECK(call_type == kAstI32); |
| 1091 current_function_builder_->Emit(kExprI32Clz); |
| 1092 break; |
| 1093 } |
1088 case AsmTyper::kMathAbs: { | 1094 case AsmTyper::kMathAbs: { |
1089 if (call_type == kAstI32) { | 1095 if (call_type == kAstI32) { |
1090 uint32_t tmp = current_function_builder_->AddLocal(kAstI32); | 1096 uint32_t tmp = current_function_builder_->AddLocal(kAstI32); |
1091 | 1097 |
1092 // if set_local(tmp, x) < 0 | 1098 // if set_local(tmp, x) < 0 |
1093 Visit(call->arguments()->at(0)); | 1099 Visit(call->arguments()->at(0)); |
1094 current_function_builder_->EmitSetLocal(tmp); | 1100 current_function_builder_->EmitSetLocal(tmp); |
1095 byte code[] = {WASM_I8(0)}; | 1101 byte code[] = {WASM_I8(0)}; |
1096 current_function_builder_->EmitCode(code, sizeof(code)); | 1102 current_function_builder_->EmitCode(code, sizeof(code)); |
1097 current_function_builder_->Emit(kExprI32LtS); | 1103 current_function_builder_->Emit(kExprI32LtS); |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); | 1782 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, typer_); |
1777 impl.Build(); | 1783 impl.Build(); |
1778 *foreign_args = impl.GetForeignArgs(); | 1784 *foreign_args = impl.GetForeignArgs(); |
1779 ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_); | 1785 ZoneBuffer* buffer = new (zone_) ZoneBuffer(zone_); |
1780 impl.builder_->WriteTo(*buffer); | 1786 impl.builder_->WriteTo(*buffer); |
1781 return buffer; | 1787 return buffer; |
1782 } | 1788 } |
1783 } // namespace wasm | 1789 } // namespace wasm |
1784 } // namespace internal | 1790 } // namespace internal |
1785 } // namespace v8 | 1791 } // namespace v8 |
OLD | NEW |