| 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 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "src/ast.h" | 10 #include "src/ast.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 Handle<BytecodeArray> ToBytecodeArray(); | 28 Handle<BytecodeArray> ToBytecodeArray(); |
| 29 | 29 |
| 30 // Set number of parameters expected by function. | 30 // Set number of parameters expected by function. |
| 31 void set_parameter_count(int number_of_params); | 31 void set_parameter_count(int number_of_params); |
| 32 int parameter_count() const; | 32 int parameter_count() const; |
| 33 | 33 |
| 34 // Set number of locals required for bytecode array. | 34 // Set number of locals required for bytecode array. |
| 35 void set_locals_count(int number_of_locals); | 35 void set_locals_count(int number_of_locals); |
| 36 int locals_count() const; | 36 int locals_count() const; |
| 37 | 37 |
| 38 // Returns true if the bytecode has an explicit return at the end. |
| 39 bool HasExplicitReturn(); |
| 40 |
| 38 Register Parameter(int parameter_index); | 41 Register Parameter(int parameter_index); |
| 39 | 42 |
| 40 // Constant loads to accumulator. | 43 // Constant loads to accumulator. |
| 41 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); | 44 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); |
| 42 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 45 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
| 43 BytecodeArrayBuilder& LoadUndefined(); | 46 BytecodeArrayBuilder& LoadUndefined(); |
| 44 BytecodeArrayBuilder& LoadNull(); | 47 BytecodeArrayBuilder& LoadNull(); |
| 45 BytecodeArrayBuilder& LoadTheHole(); | 48 BytecodeArrayBuilder& LoadTheHole(); |
| 46 BytecodeArrayBuilder& LoadTrue(); | 49 BytecodeArrayBuilder& LoadTrue(); |
| 47 BytecodeArrayBuilder& LoadFalse(); | 50 BytecodeArrayBuilder& LoadFalse(); |
| 48 | 51 |
| 49 // Register-accumulator transfers. | 52 // Register-accumulator transfers. |
| 50 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); | 53 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); |
| 51 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); | 54 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); |
| 52 | 55 |
| 53 // Load properties. The property name should be in the accumulator. | 56 // Load properties. The property name should be in the accumulator. |
| 54 BytecodeArrayBuilder& LoadNamedProperty(Register object, int feedback_slot, | 57 BytecodeArrayBuilder& LoadNamedProperty(Register object, int feedback_slot, |
| 55 LanguageMode language_mode); | 58 LanguageMode language_mode); |
| 56 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot, | 59 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot, |
| 57 LanguageMode language_mode); | 60 LanguageMode language_mode); |
| 58 | 61 |
| 62 // Store properties. The value to be stored should be in the accumulator. |
| 63 BytecodeArrayBuilder& StoreNamedProperty(Register object, Register name, |
| 64 int feedback_slot, |
| 65 LanguageMode language_mode); |
| 66 BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key, |
| 67 int feedback_slot, |
| 68 LanguageMode language_mode); |
| 69 |
| 59 // Operators. | 70 // Operators. |
| 60 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg); | 71 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg); |
| 61 | 72 |
| 62 // Flow Control. | 73 // Flow Control. |
| 63 BytecodeArrayBuilder& Return(); | 74 BytecodeArrayBuilder& Return(); |
| 64 | 75 |
| 65 private: | 76 private: |
| 66 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 77 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
| 67 static bool FitsInByteOperand(int value); | 78 static bool FitsInByteOperand(int value); |
| 68 static bool FitsInByteOperand(size_t value); | 79 static bool FitsInByteOperand(size_t value); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 125 |
| 115 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 126 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
| 116 }; | 127 }; |
| 117 | 128 |
| 118 | 129 |
| 119 } // namespace interpreter | 130 } // namespace interpreter |
| 120 } // namespace internal | 131 } // namespace internal |
| 121 } // namespace v8 | 132 } // namespace v8 |
| 122 | 133 |
| 123 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 134 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |