| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object, | 632 BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object, |
| 627 LanguageMode language_mode) { | 633 LanguageMode language_mode) { |
| 628 Output(BytecodeForDelete(language_mode), RegisterOperand(object)); | 634 Output(BytecodeForDelete(language_mode), RegisterOperand(object)); |
| 629 return *this; | 635 return *this; |
| 630 } | 636 } |
| 631 | 637 |
| 632 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { | 638 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { |
| 633 return constant_array_builder()->Insert(object); | 639 return constant_array_builder()->Insert(object); |
| 634 } | 640 } |
| 635 | 641 |
| 642 size_t BytecodeArrayBuilder::AllocateConstantPoolEntry() { |
| 643 return constant_array_builder()->AllocateEntry(); |
| 644 } |
| 645 |
| 646 void BytecodeArrayBuilder::InsertConstantPoolEntryAt(size_t entry, |
| 647 Handle<Object> object) { |
| 648 constant_array_builder()->InsertAllocatedEntry(entry, object); |
| 649 } |
| 650 |
| 636 void BytecodeArrayBuilder::SetReturnPosition() { | 651 void BytecodeArrayBuilder::SetReturnPosition() { |
| 637 if (return_position_ == kNoSourcePosition) return; | 652 if (return_position_ == kNoSourcePosition) return; |
| 638 latest_source_info_.MakeStatementPosition(return_position_); | 653 latest_source_info_.MakeStatementPosition(return_position_); |
| 639 } | 654 } |
| 640 | 655 |
| 641 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { | 656 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { |
| 642 if (stmt->position() == kNoSourcePosition) return; | 657 if (stmt->position() == kNoSourcePosition) return; |
| 643 latest_source_info_.MakeStatementPosition(stmt->position()); | 658 latest_source_info_.MakeStatementPosition(stmt->position()); |
| 644 } | 659 } |
| 645 | 660 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 return Bytecode::kTailCall; | 948 return Bytecode::kTailCall; |
| 934 default: | 949 default: |
| 935 UNREACHABLE(); | 950 UNREACHABLE(); |
| 936 } | 951 } |
| 937 return Bytecode::kIllegal; | 952 return Bytecode::kIllegal; |
| 938 } | 953 } |
| 939 | 954 |
| 940 } // namespace interpreter | 955 } // namespace interpreter |
| 941 } // namespace internal | 956 } // namespace internal |
| 942 } // namespace v8 | 957 } // namespace v8 |
| OLD | NEW |