| 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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/globals.h" | 8 #include "src/globals.h" |
| 9 #include "src/interpreter/bytecode-array-writer.h" | 9 #include "src/interpreter/bytecode-array-writer.h" |
| 10 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 10 #include "src/interpreter/bytecode-dead-code-optimizer.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Output(Bytecode::kTypeOf); | 172 Output(Bytecode::kTypeOf); |
| 173 return *this; | 173 return *this; |
| 174 } | 174 } |
| 175 | 175 |
| 176 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(Token::Value op, | 176 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(Token::Value op, |
| 177 Register reg) { | 177 Register reg) { |
| 178 Output(BytecodeForCompareOperation(op), RegisterOperand(reg)); | 178 Output(BytecodeForCompareOperation(op), RegisterOperand(reg)); |
| 179 return *this; | 179 return *this; |
| 180 } | 180 } |
| 181 | 181 |
| 182 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadConstantPoolEntry( |
| 183 size_t entry) { |
| 184 Output(Bytecode::kLdaConstant, UnsignedOperand(entry)); |
| 185 return *this; |
| 186 } |
| 187 |
| 182 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral( | 188 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral( |
| 183 v8::internal::Smi* smi) { | 189 v8::internal::Smi* smi) { |
| 184 int32_t raw_smi = smi->value(); | 190 int32_t raw_smi = smi->value(); |
| 185 if (raw_smi == 0) { | 191 if (raw_smi == 0) { |
| 186 Output(Bytecode::kLdaZero); | 192 Output(Bytecode::kLdaZero); |
| 187 } else { | 193 } else { |
| 188 Output(Bytecode::kLdaSmi, SignedOperand(raw_smi)); | 194 Output(Bytecode::kLdaSmi, SignedOperand(raw_smi)); |
| 189 } | 195 } |
| 190 return *this; | 196 return *this; |
| 191 } | 197 } |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object, | 631 BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object, |
| 626 LanguageMode language_mode) { | 632 LanguageMode language_mode) { |
| 627 Output(BytecodeForDelete(language_mode), RegisterOperand(object)); | 633 Output(BytecodeForDelete(language_mode), RegisterOperand(object)); |
| 628 return *this; | 634 return *this; |
| 629 } | 635 } |
| 630 | 636 |
| 631 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { | 637 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { |
| 632 return constant_array_builder()->Insert(object); | 638 return constant_array_builder()->Insert(object); |
| 633 } | 639 } |
| 634 | 640 |
| 641 size_t BytecodeArrayBuilder::ReserveConstantPoolEntry() { |
| 642 return constant_array_builder()->ReserveEntry(); |
| 643 } |
| 644 |
| 645 void BytecodeArrayBuilder::InsertReservedConstantPoolEntry( |
| 646 size_t entry, Handle<Object> object) { |
| 647 constant_array_builder()->InsertReservedEntry(entry, object); |
| 648 } |
| 649 |
| 635 void BytecodeArrayBuilder::SetReturnPosition() { | 650 void BytecodeArrayBuilder::SetReturnPosition() { |
| 636 if (return_position_ == kNoSourcePosition) return; | 651 if (return_position_ == kNoSourcePosition) return; |
| 637 latest_source_info_.MakeStatementPosition(return_position_); | 652 latest_source_info_.MakeStatementPosition(return_position_); |
| 638 } | 653 } |
| 639 | 654 |
| 640 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { | 655 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { |
| 641 if (stmt->position() == kNoSourcePosition) return; | 656 if (stmt->position() == kNoSourcePosition) return; |
| 642 latest_source_info_.MakeStatementPosition(stmt->position()); | 657 latest_source_info_.MakeStatementPosition(stmt->position()); |
| 643 } | 658 } |
| 644 | 659 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 return Bytecode::kTailCall; | 947 return Bytecode::kTailCall; |
| 933 default: | 948 default: |
| 934 UNREACHABLE(); | 949 UNREACHABLE(); |
| 935 } | 950 } |
| 936 return Bytecode::kIllegal; | 951 return Bytecode::kIllegal; |
| 937 } | 952 } |
| 938 | 953 |
| 939 } // namespace interpreter | 954 } // namespace interpreter |
| 940 } // namespace internal | 955 } // namespace internal |
| 941 } // namespace v8 | 956 } // namespace v8 |
| OLD | NEW |