Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 TFNode* DefaultValue(LocalType type) { | 515 TFNode* DefaultValue(LocalType type) { |
| 516 switch (type) { | 516 switch (type) { |
| 517 case kAstI32: | 517 case kAstI32: |
| 518 return builder_->Int32Constant(0); | 518 return builder_->Int32Constant(0); |
| 519 case kAstI64: | 519 case kAstI64: |
| 520 return builder_->Int64Constant(0); | 520 return builder_->Int64Constant(0); |
| 521 case kAstF32: | 521 case kAstF32: |
| 522 return builder_->Float32Constant(0); | 522 return builder_->Float32Constant(0); |
| 523 case kAstF64: | 523 case kAstF64: |
| 524 return builder_->Float64Constant(0); | 524 return builder_->Float64Constant(0); |
| 525 case kAstS128: | |
| 526 return builder_->DefaultS128Value(); | |
| 525 default: | 527 default: |
| 526 UNREACHABLE(); | 528 UNREACHABLE(); |
| 527 return nullptr; | 529 return nullptr; |
| 528 } | 530 } |
| 529 } | 531 } |
| 530 | 532 |
| 531 char* indentation() { | 533 char* indentation() { |
| 532 static const int kMaxIndent = 64; | 534 static const int kMaxIndent = 64; |
| 533 static char bytes[kMaxIndent + 1]; | 535 static char bytes[kMaxIndent + 1]; |
| 534 for (int i = 0; i < kMaxIndent; ++i) bytes[i] = ' '; | 536 for (int i = 0; i < kMaxIndent; ++i) bytes[i] = ' '; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 582 TRACE("wasm-decode %p...%p (module+%d, %d bytes) %s\n", | 584 TRACE("wasm-decode %p...%p (module+%d, %d bytes) %s\n", |
| 583 reinterpret_cast<const void*>(start_), | 585 reinterpret_cast<const void*>(start_), |
| 584 reinterpret_cast<const void*>(limit_), baserel(pc_), | 586 reinterpret_cast<const void*>(limit_), baserel(pc_), |
| 585 static_cast<int>(limit_ - start_), builder_ ? "graph building" : ""); | 587 static_cast<int>(limit_ - start_), builder_ ? "graph building" : ""); |
| 586 | 588 |
| 587 if (pc_ >= limit_) return; // Nothing to do. | 589 if (pc_ >= limit_) return; // Nothing to do. |
| 588 | 590 |
| 589 while (true) { // decoding loop. | 591 while (true) { // decoding loop. |
| 590 unsigned len = 1; | 592 unsigned len = 1; |
| 591 WasmOpcode opcode = static_cast<WasmOpcode>(*pc_); | 593 WasmOpcode opcode = static_cast<WasmOpcode>(*pc_); |
| 594 if (opcode == kSimdPrefix) { | |
|
titzer
2016/07/08 14:16:03
Is it possible to make the prefix part of the main
gdeepti
2016/07/11 09:50:34
Done.
| |
| 595 // TODO(gdeepti): Piggybacking on unop/binop works for now, but this | |
| 596 // should be its own function to be able to parse more complex opcodes. | |
| 597 len++; | |
| 598 byte simd_index = *(pc_ + 1); | |
| 599 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); | |
| 600 } | |
| 601 | |
| 592 TRACE(" @%-6d #%02x:%-20s|", startrel(pc_), opcode, | 602 TRACE(" @%-6d #%02x:%-20s|", startrel(pc_), opcode, |
| 593 WasmOpcodes::ShortOpcodeName(opcode)); | 603 WasmOpcodes::ShortOpcodeName(opcode)); |
| 594 | 604 |
| 595 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 605 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
| 596 if (sig) { | 606 if (sig) { |
| 597 // Fast case of a simple operator. | 607 // Fast case of a simple operator. |
| 598 TFNode* node; | 608 TFNode* node; |
| 599 switch (sig->parameter_count()) { | 609 switch (sig->parameter_count()) { |
| 600 case 1: { | 610 case 1: { |
| 601 Value val = Pop(0, sig->GetParam(0)); | 611 Value val = Pop(0, sig->GetParam(0)); |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1630 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1640 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 1631 const byte* start, const byte* end) { | 1641 const byte* start, const byte* end) { |
| 1632 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1642 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 1633 WasmFullDecoder decoder(zone, nullptr, body); | 1643 WasmFullDecoder decoder(zone, nullptr, body); |
| 1634 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1644 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 1635 } | 1645 } |
| 1636 | 1646 |
| 1637 } // namespace wasm | 1647 } // namespace wasm |
| 1638 } // namespace internal | 1648 } // namespace internal |
| 1639 } // namespace v8 | 1649 } // namespace v8 |
| OLD | NEW |