Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: src/interpreter/bytecode-array-builder.h

Issue 1613163002: [interpreter] Wide register support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added tests, fixed off-by-one error in register indicies. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/interpreter/bytecode-array-builder.h
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h
index 7cdb72fed21ea3d7df0839c851e0a014a89db126..0275f17fe44a9f0e275b43e196441051b3a504d1 100644
--- a/src/interpreter/bytecode-array-builder.h
+++ b/src/interpreter/bytecode-array-builder.h
@@ -9,6 +9,7 @@
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/constant-array-builder.h"
#include "src/interpreter/handler-table-builder.h"
+#include "src/interpreter/register-translator.h"
#include "src/zone-containers.h"
namespace v8 {
@@ -25,7 +26,7 @@ class Register;
// when rest parameters implementation has settled down.
enum class CreateArgumentsType { kMappedArguments, kUnmappedArguments };
-class BytecodeArrayBuilder final {
+class BytecodeArrayBuilder final : private RegisterMover {
public:
BytecodeArrayBuilder(Isolate* isolate, Zone* zone);
~BytecodeArrayBuilder();
@@ -59,6 +60,18 @@ class BytecodeArrayBuilder final {
// Returns the number of fixed (non-temporary) registers.
int fixed_register_count() const { return context_count() + locals_count(); }
+ // Returns the number of fixed and temporary registers.
+ int fixed_and_temporary_register_count() const {
+ return fixed_register_count() + temporary_register_count_;
+ }
+
+ // Returns the number of used for translating wide register operands
rmcilroy 2016/01/22 17:50:56 /s/of used/of registers used
+ // into byte sized register operands..
rmcilroy 2016/01/22 17:50:56 remove extra full-stop.
+ int translation_register_count() const {
+ return RegisterTranslator::RegisterCountAdjustment(
+ fixed_and_temporary_register_count(), parameter_count());
+ }
+
Register Parameter(int parameter_index) const;
// Return true if the register |reg| represents a parameter or a
@@ -240,6 +253,7 @@ class BytecodeArrayBuilder final {
private:
class PreviousBytecodeHelper;
+ class RegisterTranslationScope;
friend class BytecodeRegisterAllocator;
static Bytecode BytecodeForBinaryOperation(Token::Value op);
@@ -263,15 +277,16 @@ class BytecodeArrayBuilder final {
static bool FitsInIdx16Operand(int value);
static bool FitsInIdx16Operand(size_t value);
static bool FitsInReg8Operand(Register value);
+ static bool FitsInReg8OperandUntranslated(Register value);
static bool FitsInReg16Operand(Register value);
+ static bool FitsInReg16OperandUntranslated(Register value);
+
+ bool MoveRegisterUntranslated(Register from, Register to) override;
static Bytecode GetJumpWithConstantOperand(Bytecode jump_smi8_operand);
static Bytecode GetJumpWithConstantWideOperand(Bytecode jump_smi8_operand);
static Bytecode GetJumpWithToBoolean(Bytecode jump_smi8_operand);
- Register MapRegister(Register reg);
- Register MapRegisters(Register reg, Register args_base, int args_length = 1);
-
template <size_t N>
INLINE(void Output(Bytecode bytecode, uint32_t(&operands)[N]));
void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
@@ -296,13 +311,14 @@ class BytecodeArrayBuilder final {
bool OperandIsValid(Bytecode bytecode, int operand_index,
uint32_t operand_value) const;
- bool LastBytecodeInSameBlock() const;
bool RegisterIsValid(Register reg, OperandType reg_type) const;
+ bool LastBytecodeInSameBlock() const;
bool NeedToBooleanCast();
bool IsRegisterInAccumulator(Register reg);
// Temporary register management.
+ void ForgeTemporaryRegister();
int BorrowTemporaryRegister();
int BorrowTemporaryRegisterNotInRange(int start_index, int end_index);
void ReturnTemporaryRegister(int reg_index);
@@ -328,6 +344,13 @@ class BytecodeArrayBuilder final {
HandlerTableBuilder* handler_table_builder() {
return &handler_table_builder_;
}
+ RegisterTranslator* register_translator() { return &register_translator_; }
+ void set_register_translation_scope(RegisterTranslationScope* scope) {
+ register_translation_scope_ = scope;
+ }
+ RegisterTranslationScope* register_translation_scope() const {
+ return register_translation_scope_;
+ }
Isolate* isolate_;
Zone* zone_;
@@ -339,12 +362,13 @@ class BytecodeArrayBuilder final {
size_t last_bytecode_start_;
bool exit_seen_in_block_;
int unbound_jumps_;
-
int parameter_count_;
int local_register_count_;
int context_register_count_;
int temporary_register_count_;
ZoneSet<int> free_temporaries_;
+ RegisterTranslator register_translator_;
+ RegisterTranslationScope* register_translation_scope_;
DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder);
};

Powered by Google App Engine
This is Rietveld 408576698