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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 1991143002: Convert SIMD wasm ops to runtime function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Bill's review Created 4 years, 7 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 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/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 TFNode* DefaultValue(LocalType type) { 527 TFNode* DefaultValue(LocalType type) {
528 switch (type) { 528 switch (type) {
529 case kAstI32: 529 case kAstI32:
530 return builder_->Int32Constant(0); 530 return builder_->Int32Constant(0);
531 case kAstI64: 531 case kAstI64:
532 return builder_->Int64Constant(0); 532 return builder_->Int64Constant(0);
533 case kAstF32: 533 case kAstF32:
534 return builder_->Float32Constant(0); 534 return builder_->Float32Constant(0);
535 case kAstF64: 535 case kAstF64:
536 return builder_->Float64Constant(0); 536 return builder_->Float64Constant(0);
537 case kAstS128:
538 return builder_->DefaultS128Value();
537 default: 539 default:
538 UNREACHABLE(); 540 UNREACHABLE();
539 return nullptr; 541 return nullptr;
540 } 542 }
541 } 543 }
542 544
543 char* indentation() { 545 char* indentation() {
544 static const int kMaxIndent = 64; 546 static const int kMaxIndent = 64;
545 static char bytes[kMaxIndent + 1]; 547 static char bytes[kMaxIndent + 1];
546 for (int i = 0; i < kMaxIndent; i++) bytes[i] = ' '; 548 for (int i = 0; i < kMaxIndent; i++) bytes[i] = ' ';
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 TRACE("wasm-decode %p...%p (module+%d, %d bytes) %s\n", 597 TRACE("wasm-decode %p...%p (module+%d, %d bytes) %s\n",
596 reinterpret_cast<const void*>(start_), 598 reinterpret_cast<const void*>(start_),
597 reinterpret_cast<const void*>(limit_), baserel(pc_), 599 reinterpret_cast<const void*>(limit_), baserel(pc_),
598 static_cast<int>(limit_ - start_), builder_ ? "graph building" : ""); 600 static_cast<int>(limit_ - start_), builder_ ? "graph building" : "");
599 601
600 if (pc_ >= limit_) return; // Nothing to do. 602 if (pc_ >= limit_) return; // Nothing to do.
601 603
602 while (true) { // decoding loop. 604 while (true) { // decoding loop.
603 int len = 1; 605 int len = 1;
604 WasmOpcode opcode = static_cast<WasmOpcode>(*pc_); 606 WasmOpcode opcode = static_cast<WasmOpcode>(*pc_);
607 if (builder_) builder_->set_is_simd_function(WasmOpcodes::IsSimd(opcode));
titzer 2016/05/19 09:43:27 That's too expensive to do for every bytecode.
gdeepti 2016/07/01 22:24:48 Converted to check if the opcode byte is a prefix.
605 TRACE(" @%-6d #%02x:%-20s|", startrel(pc_), opcode, 608 TRACE(" @%-6d #%02x:%-20s|", startrel(pc_), opcode,
606 WasmOpcodes::ShortOpcodeName(opcode)); 609 WasmOpcodes::ShortOpcodeName(opcode));
607 610
608 FunctionSig* sig = WasmOpcodes::Signature(opcode); 611 FunctionSig* sig = WasmOpcodes::Signature(opcode);
609 if (sig) { 612 if (sig) {
610 // Fast case of a simple operator. 613 // Fast case of a simple operator.
611 TFNode* node; 614 TFNode* node;
612 switch (sig->parameter_count()) { 615 switch (sig->parameter_count()) {
613 case 1: { 616 case 1: {
614 Value val = Pop(0, sig->GetParam(0)); 617 Value val = Pop(0, sig->GetParam(0));
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1649 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1647 const byte* start, const byte* end) { 1650 const byte* start, const byte* end) {
1648 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1651 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1649 SR_WasmDecoder decoder(zone, nullptr, body); 1652 SR_WasmDecoder decoder(zone, nullptr, body);
1650 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1653 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1651 } 1654 }
1652 1655
1653 } // namespace wasm 1656 } // namespace wasm
1654 } // namespace internal 1657 } // namespace internal
1655 } // namespace v8 1658 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698