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

Side by Side Diff: test/cctest/asmjs/test-asm-typer.cc

Issue 2526703002: [wasm] [asmjs] Route asm.js warnings to the dev console. (Closed)
Patch Set: merge 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 | « src/objects-inl.h ('k') | test/cctest/test-api.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 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 <cstring> 5 #include <cstring>
6 #include <functional> 6 #include <functional>
7 #include <iostream> 7 #include <iostream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-typer.h" 10 #include "src/asmjs/asm-typer.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 AsmTyperHarnessBuilder* WithUndefinedGlobal( 121 AsmTyperHarnessBuilder* WithUndefinedGlobal(
122 VariableName var_name, std::function<AsmType*(Zone*)> type_creator) { 122 VariableName var_name, std::function<AsmType*(Zone*)> type_creator) {
123 auto* type = type_creator(zone_); 123 auto* type = type_creator(zone_);
124 CHECK(type->AsFunctionType() != nullptr || 124 CHECK(type->AsFunctionType() != nullptr ||
125 type->AsFunctionTableType() != nullptr); 125 type->AsFunctionTableType() != nullptr);
126 WithGlobal(var_name, type); 126 WithGlobal(var_name, type);
127 auto* var_info = typer_->Lookup(DeclareVariable(var_name)); 127 auto* var_info = typer_->Lookup(DeclareVariable(var_name));
128 CHECK(var_info); 128 CHECK(var_info);
129 var_info->SetFirstForwardUse(-1); 129 MessageLocation location;
130 var_info->SetFirstForwardUse(location);
130 return this; 131 return this;
131 } 132 }
132 133
133 AsmTyperHarnessBuilder* WithImport(VariableName var_name, 134 AsmTyperHarnessBuilder* WithImport(VariableName var_name,
134 AsmTyper::StandardMember standard_member) { 135 AsmTyper::StandardMember standard_member) {
135 auto* var = DeclareVariable(var_name); 136 auto* var = DeclareVariable(var_name);
136 AsmTyper::VariableInfo* var_info = nullptr; 137 AsmTyper::VariableInfo* var_info = nullptr;
137 auto* stdlib_map = &typer_->stdlib_math_types_; 138 auto* stdlib_map = &typer_->stdlib_math_types_;
138 switch (standard_member) { 139 switch (standard_member) {
139 case AsmTyper::kHeap: 140 case AsmTyper::kHeap:
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 success = ValidateExpressionStatment(fun_decl_) != AsmType::None(); 254 success = ValidateExpressionStatment(fun_decl_) != AsmType::None();
254 } else { 255 } else {
255 success = typer_->Validate(); 256 success = typer_->Validate();
256 } 257 }
257 258
258 if (success) { 259 if (success) {
259 std::cerr << "Asm validation succeeded\n"; 260 std::cerr << "Asm validation succeeded\n";
260 return false; 261 return false;
261 } 262 }
262 263
263 if (std::strstr(typer_->error_message(), error_message) == nullptr) { 264 std::unique_ptr<char[]> msg = i::MessageHandler::GetLocalizedMessage(
265 isolate_, typer_->error_message());
266 if (std::strstr(msg.get(), error_message) == nullptr) {
264 std::cerr << "Asm validation failed with the wrong error message:\n" 267 std::cerr << "Asm validation failed with the wrong error message:\n"
265 "Expected to contain '" 268 "Expected to contain '"
266 << error_message << "'\n" 269 << error_message << "'\n"
267 " Actually is '" 270 " Actually is '"
268 << typer_->error_message() << "'\n"; 271 << msg.get() << "'\n";
269 return false; 272 return false;
270 } 273 }
271 274
272 return true; 275 return true;
273 } 276 }
274 277
275 private: 278 private:
276 Variable* DeclareVariable(VariableName var_name) { 279 Variable* DeclareVariable(VariableName var_name) {
277 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); 280 auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_);
278 ast_value_factory_.Internalize(isolate_); 281 ast_value_factory_.Internalize(isolate_);
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 if (!ValidationOf(Module(kTests[ii])) 2050 if (!ValidationOf(Module(kTests[ii]))
2048 ->FailsWithMessage( 2051 ->FailsWithMessage(
2049 "Constant in return must be signed, float, or double.")) { 2052 "Constant in return must be signed, float, or double.")) {
2050 std::cerr << "Test:\n" << kTests[ii]; 2053 std::cerr << "Test:\n" << kTests[ii];
2051 CHECK(false); 2054 CHECK(false);
2052 } 2055 }
2053 } 2056 }
2054 } 2057 }
2055 2058
2056 } // namespace 2059 } // namespace
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698