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

Side by Side Diff: src/asmjs/asm-typer.cc

Issue 2565343002: [wasm][asm.js] Require a number for fround literals. (Closed)
Patch Set: git cl try Created 4 years 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 | « no previous file | test/mjsunit/asm/asm-validation.js » ('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 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 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 "Invalid float type annotation - expected literal argument for call " 2847 "Invalid float type annotation - expected literal argument for call "
2848 "to fround."); 2848 "to fround.");
2849 } 2849 }
2850 2850
2851 // ERRATA: 5.4 2851 // ERRATA: 5.4
2852 // According to the spec: float constants must contain dots in local, 2852 // According to the spec: float constants must contain dots in local,
2853 // but not in globals. 2853 // but not in globals.
2854 // However, the errata doc (and actual programs), use integer values 2854 // However, the errata doc (and actual programs), use integer values
2855 // with fround(..). 2855 // with fround(..).
2856 // Skipping the check that would go here to enforce this. 2856 // Skipping the check that would go here to enforce this.
2857 // Checking instead the literal expression is at least a number.
2858 if (!src_expr->raw_value()->IsNumber()) {
2859 FAIL(initializer,
2860 "Invalid float type annotation - expected numeric literal for call "
2861 "to fround.");
2862 }
2857 2863
2858 return AsmType::Float(); 2864 return AsmType::Float();
2859 } 2865 }
2860 2866
2861 // 5.5 GlobalVariableTypeAnnotations 2867 // 5.5 GlobalVariableTypeAnnotations
2862 AsmType* AsmTyper::NewHeapView(CallNew* new_heap_view) { 2868 AsmType* AsmTyper::NewHeapView(CallNew* new_heap_view) {
2863 auto* heap_type = new_heap_view->expression()->AsProperty(); 2869 auto* heap_type = new_heap_view->expression()->AsProperty();
2864 if (heap_type == nullptr) { 2870 if (heap_type == nullptr) {
2865 FAIL(new_heap_view, "Invalid type after new."); 2871 FAIL(new_heap_view, "Invalid type after new.");
2866 } 2872 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 return true; 2916 return true;
2911 } 2917 }
2912 2918
2913 *error_message = typer.error_message(); 2919 *error_message = typer.error_message();
2914 return false; 2920 return false;
2915 } 2921 }
2916 2922
2917 } // namespace wasm 2923 } // namespace wasm
2918 } // namespace internal 2924 } // namespace internal
2919 } // namespace v8 2925 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698