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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/wasm/asm-wasm-builder.h" | 7 #include "src/wasm/asm-wasm-builder.h" |
| 8 #include "src/wasm/wasm-macro-gen.h" | 8 #include "src/wasm/wasm-macro-gen.h" |
| 9 #include "src/wasm/wasm-opcodes.h" | 9 #include "src/wasm/wasm-opcodes.h" |
| 10 | 10 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 return true; | 615 return true; |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 return false; | 618 return false; |
| 619 } | 619 } |
| 620 | 620 |
| 621 enum ConvertOperation { kNone, kAsIs, kToInt, kToDouble }; | 621 enum ConvertOperation { kNone, kAsIs, kToInt, kToDouble }; |
| 622 | 622 |
| 623 ConvertOperation MatchOr(BinaryOperation* expr) { | 623 ConvertOperation MatchOr(BinaryOperation* expr) { |
| 624 if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0)) { | 624 if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0)) { |
| 625 DCHECK(TypeOf(expr->left()) == kAstI32); | 625 return (TypeOf(expr->left()) == kAstI32) ? kAsIs : kToInt; |
|
ahaas
2016/01/12 13:35:09
Why is this change only required for MatchOr and M
| |
| 626 DCHECK(TypeOf(expr->right()) == kAstI32); | |
| 627 return kAsIs; | |
| 628 } else { | 626 } else { |
| 629 return kNone; | 627 return kNone; |
| 630 } | 628 } |
| 631 } | 629 } |
| 632 | 630 |
| 633 ConvertOperation MatchShr(BinaryOperation* expr) { | 631 ConvertOperation MatchShr(BinaryOperation* expr) { |
| 634 if (MatchIntBinaryOperation(expr, Token::SHR, 0)) { | 632 if (MatchIntBinaryOperation(expr, Token::SHR, 0)) { |
| 635 DCHECK(TypeOf(expr->left()) == kAstI32); | 633 // TODO(titzer): this probably needs to be kToUint |
| 636 DCHECK(TypeOf(expr->right()) == kAstI32); | 634 return (TypeOf(expr->left()) == kAstI32) ? kAsIs : kToInt; |
| 637 return kAsIs; | |
| 638 } else { | 635 } else { |
| 639 return kNone; | 636 return kNone; |
| 640 } | 637 } |
| 641 } | 638 } |
| 642 | 639 |
| 643 ConvertOperation MatchXor(BinaryOperation* expr) { | 640 ConvertOperation MatchXor(BinaryOperation* expr) { |
| 644 if (MatchIntBinaryOperation(expr, Token::BIT_XOR, 0xffffffff)) { | 641 if (MatchIntBinaryOperation(expr, Token::BIT_XOR, 0xffffffff)) { |
| 645 DCHECK(TypeOf(expr->left()) == kAstI32); | 642 DCHECK(TypeOf(expr->left()) == kAstI32); |
| 646 DCHECK(TypeOf(expr->right()) == kAstI32); | 643 DCHECK(TypeOf(expr->right()) == kAstI32); |
| 647 BinaryOperation* op = expr->left()->AsBinaryOperation(); | 644 BinaryOperation* op = expr->left()->AsBinaryOperation(); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1033 // that zone in constructor may be thrown away once wasm module is written. | 1030 // that zone in constructor may be thrown away once wasm module is written. |
| 1034 WasmModuleIndex* AsmWasmBuilder::Run() { | 1031 WasmModuleIndex* AsmWasmBuilder::Run() { |
| 1035 AsmWasmBuilderImpl impl(isolate_, zone_, literal_); | 1032 AsmWasmBuilderImpl impl(isolate_, zone_, literal_); |
| 1036 impl.Compile(); | 1033 impl.Compile(); |
| 1037 WasmModuleWriter* writer = impl.builder_->Build(zone_); | 1034 WasmModuleWriter* writer = impl.builder_->Build(zone_); |
| 1038 return writer->WriteTo(zone_); | 1035 return writer->WriteTo(zone_); |
| 1039 } | 1036 } |
| 1040 } // namespace wasm | 1037 } // namespace wasm |
| 1041 } // namespace internal | 1038 } // namespace internal |
| 1042 } // namespace v8 | 1039 } // namespace v8 |
| OLD | NEW |