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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 1843983002: [wasm] Fixed float-to-int conversion tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 1230
1231 Node* WasmGraphBuilder::BuildI32UConvertF64(Node* input) { 1231 Node* WasmGraphBuilder::BuildI32UConvertF64(Node* input) {
1232 MachineOperatorBuilder* m = jsgraph()->machine(); 1232 MachineOperatorBuilder* m = jsgraph()->machine();
1233 if (module_ && module_->asm_js()) { 1233 if (module_ && module_->asm_js()) {
1234 // asm.js must use the wacky JS semantics. 1234 // asm.js must use the wacky JS semantics.
1235 return graph()->NewNode( 1235 return graph()->NewNode(
1236 m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input); 1236 m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input);
1237 } 1237 }
1238 // Truncation of the input value is needed for the overflow check later. 1238 // Truncation of the input value is needed for the overflow check later.
1239 Node* trunc = Unop(wasm::kExprF64Trunc, input); 1239 Node* trunc = Unop(wasm::kExprF64Trunc, input);
1240 Node* result = graph()->NewNode(m->ChangeFloat64ToUint32(), trunc); 1240 Node* result = graph()->NewNode(m->TruncateFloat64ToUint32(), trunc);
1241 1241
1242 // Convert the result back to f64. If we end up at a different value than the 1242 // Convert the result back to f64. If we end up at a different value than the
1243 // truncated input value, then there has been an overflow and we trap. 1243 // truncated input value, then there has been an overflow and we trap.
1244 Node* check = Unop(wasm::kExprF64UConvertI32, result); 1244 Node* check = Unop(wasm::kExprF64UConvertI32, result);
1245 Node* overflow = Binop(wasm::kExprF64Ne, trunc, check); 1245 Node* overflow = Binop(wasm::kExprF64Ne, trunc, check);
1246 trap_->AddTrapIfTrue(kTrapFloatUnrepresentable, overflow); 1246 trap_->AddTrapIfTrue(kTrapFloatUnrepresentable, overflow);
1247 1247
1248 return result; 1248 return result;
1249 } 1249 }
1250 1250
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 static_cast<int>(function.code_end_offset - function.code_start_offset), 2804 static_cast<int>(function.code_end_offset - function.code_start_offset),
2805 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); 2805 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms);
2806 } 2806 }
2807 return code; 2807 return code;
2808 } 2808 }
2809 2809
2810 2810
2811 } // namespace compiler 2811 } // namespace compiler
2812 } // namespace internal 2812 } // namespace internal
2813 } // namespace v8 2813 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698