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

Side by Side Diff: test/cctest/wasm/wasm-run-utils.h

Issue 1704033002: [wasm] WasmRunner can run tests with I64 parameters and return value. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@new_wasm_runner
Patch Set: Removed const CallDescriptor changes again. Created 4 years, 10 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
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 #ifndef WASM_RUN_UTILS_H 5 #ifndef WASM_RUN_UTILS_H
6 #define WASM_RUN_UTILS_H 6 #define WASM_RUN_UTILS_H
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 TreeResult result = BuildTFGraph(&builder, env, start, end); 238 TreeResult result = BuildTFGraph(&builder, env, start, end);
239 if (result.failed()) { 239 if (result.failed()) {
240 ptrdiff_t pc = result.error_pc - result.start; 240 ptrdiff_t pc = result.error_pc - result.start;
241 ptrdiff_t pt = result.error_pt - result.start; 241 ptrdiff_t pt = result.error_pt - result.start;
242 std::ostringstream str; 242 std::ostringstream str;
243 str << "Verification failed: " << result.error_code << " pc = +" << pc; 243 str << "Verification failed: " << result.error_code << " pc = +" << pc;
244 if (result.error_pt) str << ", pt = +" << pt; 244 if (result.error_pt) str << ", pt = +" << pt;
245 str << ", msg = " << result.error_msg.get(); 245 str << ", msg = " << result.error_msg.get();
246 FATAL(str.str().c_str()); 246 FATAL(str.str().c_str());
247 } 247 }
248 builder.Int64LoweringForTesting(); 248 builder.Int64LoweringForTesting(env->sig);
249 if (FLAG_trace_turbo_graph) { 249 if (FLAG_trace_turbo_graph) {
250 OFStream os(stdout); 250 OFStream os(stdout);
251 os << AsRPO(*jsgraph->graph()); 251 os << AsRPO(*jsgraph->graph());
252 } 252 }
253 } 253 }
254 254
255 template <typename ReturnType> 255 template <typename ReturnType>
256 class WasmFunctionWrapper : public HandleAndZoneScope, 256 class WasmFunctionWrapper : public HandleAndZoneScope,
257 private GraphAndBuilders { 257 private GraphAndBuilders {
258 public: 258 public:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 common()->HeapConstant(code_handle)); 344 common()->HeapConstant(code_handle));
345 } 345 }
346 346
347 Handle<Code> GetWrapperCode() { 347 Handle<Code> GetWrapperCode() {
348 if (code_.is_null()) { 348 if (code_.is_null()) {
349 Isolate* isolate = CcTest::InitIsolateOnce(); 349 Isolate* isolate = CcTest::InitIsolateOnce();
350 350
351 CallDescriptor* descriptor = 351 CallDescriptor* descriptor =
352 Linkage::GetSimplifiedCDescriptor(zone(), signature_, true); 352 Linkage::GetSimplifiedCDescriptor(zone(), signature_, true);
353 353
354 #if !WASM_64
titzer 2016/02/18 12:06:22 I don't understand what this signature is for. See
ahaas 2016/02/18 13:00:18 I need the signature of the wrapper as Signature<M
355
356 Signature<MachineRepresentation>::Builder rep_builder(zone(), 1, 4);
ahaas 2016/02/18 13:00:18 I introduced a new #define for the maximum number
357
358 rep_builder.AddReturn(MachineRepresentation::kWord32);
359 for (int i = 0; i < 4; i++) {
360 rep_builder.AddParam(MachineRepresentation::kWord32);
361 }
362 Int64Lowering r(graph(), machine(), common(), zone(),
363 rep_builder.Build());
364 r.LowerGraph();
365 #endif
366
354 CompilationInfo info("testing", isolate, graph()->zone()); 367 CompilationInfo info("testing", isolate, graph()->zone());
355 code_ = 368 code_ =
356 Pipeline::GenerateCodeForTesting(&info, descriptor, graph(), nullptr); 369 Pipeline::GenerateCodeForTesting(&info, descriptor, graph(), nullptr);
357 CHECK(!code_.is_null()); 370 CHECK(!code_.is_null());
358 #ifdef ENABLE_DISASSEMBLER 371 #ifdef ENABLE_DISASSEMBLER
359 if (FLAG_print_opt_code) { 372 if (FLAG_print_opt_code) {
360 OFStream os(stdout); 373 OFStream os(stdout);
361 code_->Disassemble("wasm wrapper", os); 374 code_->Disassemble("wasm wrapper", os);
362 } 375 }
363 #endif 376 #endif
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 byte AllocateLocal(LocalType type) { 424 byte AllocateLocal(LocalType type) {
412 int result = static_cast<int>(env.total_locals); 425 int result = static_cast<int>(env.total_locals);
413 env.AddLocals(type, 1); 426 env.AddLocals(type, 1);
414 byte b = static_cast<byte>(result); 427 byte b = static_cast<byte>(result);
415 CHECK_EQ(result, b); 428 CHECK_EQ(result, b);
416 return b; 429 return b;
417 } 430 }
418 431
419 Handle<Code> Compile(ModuleEnv* module) { 432 Handle<Code> Compile(ModuleEnv* module) {
420 InitializeDescriptor(); 433 InitializeDescriptor();
434 CallDescriptor* desc = descriptor_;
435 #if !WASM_64
436 desc = module->GetI32WasmCallDescriptor(this->zone(), desc);
titzer 2016/02/18 12:06:23 Same here. You need to use kPointerSize == 4
ahaas 2016/02/18 13:00:18 Done.
437 #endif
421 CompilationInfo info("wasm compile", this->isolate(), this->zone()); 438 CompilationInfo info("wasm compile", this->isolate(), this->zone());
422 Handle<Code> result = 439 Handle<Code> result =
423 Pipeline::GenerateCodeForTesting(&info, descriptor_, this->graph()); 440 Pipeline::GenerateCodeForTesting(&info, desc, this->graph());
424 #ifdef ENABLE_DISASSEMBLER 441 #ifdef ENABLE_DISASSEMBLER
425 if (!result.is_null() && FLAG_print_opt_code) { 442 if (!result.is_null() && FLAG_print_opt_code) {
426 OFStream os(stdout); 443 OFStream os(stdout);
427 result->Disassemble("wasm code", os); 444 result->Disassemble("wasm code", os);
428 } 445 }
429 #endif 446 #endif
430 447
431 return result; 448 return result;
432 } 449 }
433 450
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 if (p1 == MachineType::None()) return 1; 558 if (p1 == MachineType::None()) return 1;
542 if (p2 == MachineType::None()) return 2; 559 if (p2 == MachineType::None()) return 2;
543 if (p3 == MachineType::None()) return 3; 560 if (p3 == MachineType::None()) return 3;
544 return 4; 561 return 4;
545 } 562 }
546 }; 563 };
547 564
548 } // namespace 565 } // namespace
549 566
550 #endif 567 #endif
OLDNEW
« test/cctest/wasm/test-run-wasm.cc ('K') | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698