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

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

Issue 1894063002: [Interpreter] Remove register file register and replace with LoadParentFramePointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc Created 4 years, 8 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
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index f664349dd44b9952326bef8d8688a5297337bebe..15e553bcf87b6b3b48ec80b4c6efb736eae10e40 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -259,7 +259,7 @@ void BytecodeArrayBuilder::OutputScaled(Bytecode bytecode,
BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op,
Register reg) {
- OperandScale operand_scale = OperandSizesToScale(SizeForRegisterOperand(reg));
+ OperandScale operand_scale = OperandSizesToScale(reg.SizeOfOperand());
OutputScaled(BytecodeForBinaryOperation(op), operand_scale,
RegisterOperand(reg));
return *this;
@@ -284,7 +284,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::TypeOf() {
BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(Token::Value op,
Register reg) {
- OperandScale operand_scale = OperandSizesToScale(SizeForRegisterOperand(reg));
+ OperandScale operand_scale = OperandSizesToScale(reg.SizeOfOperand());
OutputScaled(BytecodeForCompareOperation(op), operand_scale,
RegisterOperand(reg));
return *this;
@@ -347,8 +347,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadFalse() {
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadAccumulatorWithRegister(
Register reg) {
if (!IsRegisterInAccumulator(reg)) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(reg));
+ OperandScale operand_scale = OperandSizesToScale(reg.SizeOfOperand());
OutputScaled(Bytecode::kLdar, operand_scale, RegisterOperand(reg));
}
return *this;
@@ -358,8 +357,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadAccumulatorWithRegister(
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
Register reg) {
if (!IsRegisterInAccumulator(reg)) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(reg));
+ OperandScale operand_scale = OperandSizesToScale(reg.SizeOfOperand());
OutputScaled(Bytecode::kStar, operand_scale, RegisterOperand(reg));
}
return *this;
@@ -369,8 +367,8 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
BytecodeArrayBuilder& BytecodeArrayBuilder::MoveRegister(Register from,
Register to) {
DCHECK(from != to);
- OperandScale operand_scale = OperandSizesToScale(SizeForRegisterOperand(from),
- SizeForRegisterOperand(to));
+ OperandScale operand_scale =
+ OperandSizesToScale(from.SizeOfOperand(), to.SizeOfOperand());
OutputScaled(Bytecode::kMov, operand_scale, RegisterOperand(from),
RegisterOperand(to));
return *this;
@@ -406,7 +404,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
int slot_index) {
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(context), SizeForUnsignedOperand(slot_index));
+ context.SizeOfOperand(), SizeForUnsignedOperand(slot_index));
OutputScaled(Bytecode::kLdaContextSlot, operand_scale,
RegisterOperand(context), UnsignedOperand(slot_index));
return *this;
@@ -416,7 +414,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context,
int slot_index) {
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(context), SizeForUnsignedOperand(slot_index));
+ context.SizeOfOperand(), SizeForUnsignedOperand(slot_index));
OutputScaled(Bytecode::kStaContextSlot, operand_scale,
RegisterOperand(context), UnsignedOperand(slot_index));
return *this;
@@ -448,7 +446,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
Register object, const Handle<Name> name, int feedback_slot) {
size_t name_index = GetConstantPoolEntry(name);
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(object), SizeForUnsignedOperand(name_index),
+ object.SizeOfOperand(), SizeForUnsignedOperand(name_index),
SizeForUnsignedOperand(feedback_slot));
OutputScaled(Bytecode::kLoadIC, operand_scale, RegisterOperand(object),
UnsignedOperand(name_index), UnsignedOperand(feedback_slot));
@@ -458,7 +456,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
Register object, int feedback_slot) {
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(object), SizeForUnsignedOperand(feedback_slot));
+ object.SizeOfOperand(), SizeForUnsignedOperand(feedback_slot));
OutputScaled(Bytecode::kKeyedLoadIC, operand_scale, RegisterOperand(object),
UnsignedOperand(feedback_slot));
return *this;
@@ -470,7 +468,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
Bytecode bytecode = BytecodeForStoreIC(language_mode);
size_t name_index = GetConstantPoolEntry(name);
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(object), SizeForUnsignedOperand(name_index),
+ object.SizeOfOperand(), SizeForUnsignedOperand(name_index),
SizeForUnsignedOperand(feedback_slot));
OutputScaled(bytecode, operand_scale, RegisterOperand(object),
UnsignedOperand(name_index), UnsignedOperand(feedback_slot));
@@ -482,9 +480,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
Register object, Register key, int feedback_slot,
LanguageMode language_mode) {
Bytecode bytecode = BytecodeForKeyedStoreIC(language_mode);
- OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(object), SizeForRegisterOperand(key),
- SizeForUnsignedOperand(feedback_slot));
+ OperandScale operand_scale =
+ OperandSizesToScale(object.SizeOfOperand(), key.SizeOfOperand(),
+ SizeForUnsignedOperand(feedback_slot));
OutputScaled(bytecode, operand_scale, RegisterOperand(object),
RegisterOperand(key), UnsignedOperand(feedback_slot));
return *this;
@@ -553,16 +551,14 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral(
BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(context));
+ OperandScale operand_scale = OperandSizesToScale(context.SizeOfOperand());
OutputScaled(Bytecode::kPushContext, operand_scale, RegisterOperand(context));
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(context));
+ OperandScale operand_scale = OperandSizesToScale(context.SizeOfOperand());
OutputScaled(Bytecode::kPopContext, operand_scale, RegisterOperand(context));
return *this;
}
@@ -909,7 +905,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Debugger() {
BytecodeArrayBuilder& BytecodeArrayBuilder::ForInPrepare(
Register cache_info_triple) {
OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(cache_info_triple));
+ OperandSizesToScale(cache_info_triple.SizeOfOperand());
OutputScaled(Bytecode::kForInPrepare, operand_scale,
RegisterOperand(cache_info_triple));
return *this;
@@ -917,8 +913,8 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInPrepare(
BytecodeArrayBuilder& BytecodeArrayBuilder::ForInDone(Register index,
Register cache_length) {
- OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(index), SizeForRegisterOperand(cache_length));
+ OperandScale operand_scale =
+ OperandSizesToScale(index.SizeOfOperand(), cache_length.SizeOfOperand());
OutputScaled(Bytecode::kForInDone, operand_scale, RegisterOperand(index),
RegisterOperand(cache_length));
return *this;
@@ -927,10 +923,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInDone(Register index,
BytecodeArrayBuilder& BytecodeArrayBuilder::ForInNext(
Register receiver, Register index, Register cache_type_array_pair,
int feedback_slot) {
- OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(receiver), SizeForRegisterOperand(index),
- SizeForRegisterOperand(cache_type_array_pair),
- SizeForUnsignedOperand(feedback_slot));
+ OperandScale operand_scale =
+ OperandSizesToScale(receiver.SizeOfOperand(), index.SizeOfOperand(),
+ cache_type_array_pair.SizeOfOperand(),
+ SizeForUnsignedOperand(feedback_slot));
OutputScaled(Bytecode::kForInNext, operand_scale, RegisterOperand(receiver),
RegisterOperand(index), RegisterOperand(cache_type_array_pair),
UnsignedOperand(feedback_slot));
@@ -939,8 +935,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInNext(
BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(index));
+ OperandScale operand_scale = OperandSizesToScale(index.SizeOfOperand());
OutputScaled(Bytecode::kForInStep, operand_scale, RegisterOperand(index));
return *this;
}
@@ -988,7 +983,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
TailCallMode tail_call_mode) {
Bytecode bytecode = BytecodeForCall(tail_call_mode);
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(callable), SizeForRegisterOperand(receiver_args),
+ callable.SizeOfOperand(), receiver_args.SizeOfOperand(),
SizeForUnsignedOperand(receiver_args_count),
SizeForUnsignedOperand(feedback_slot));
OutputScaled(bytecode, operand_scale, RegisterOperand(callable),
@@ -1006,7 +1001,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
first_arg = Register(0);
}
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(constructor), SizeForRegisterOperand(first_arg),
+ constructor.SizeOfOperand(), first_arg.SizeOfOperand(),
SizeForUnsignedOperand(arg_count));
OutputScaled(Bytecode::kNew, operand_scale, RegisterOperand(constructor),
RegisterOperand(first_arg), UnsignedOperand(arg_count));
@@ -1026,7 +1021,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
? Bytecode::kInvokeIntrinsic
: Bytecode::kCallRuntime;
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(first_arg), SizeForUnsignedOperand(arg_count));
+ first_arg.SizeOfOperand(), SizeForUnsignedOperand(arg_count));
OutputScaled(bytecode, operand_scale, static_cast<uint16_t>(function_id),
RegisterOperand(first_arg), UnsignedOperand(arg_count));
return *this;
@@ -1043,8 +1038,8 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair(
first_arg = Register(0);
}
OperandScale operand_scale = OperandSizesToScale(
- SizeForRegisterOperand(first_arg), SizeForUnsignedOperand(arg_count),
- SizeForRegisterOperand(first_return));
+ first_arg.SizeOfOperand(), SizeForUnsignedOperand(arg_count),
+ first_return.SizeOfOperand());
OutputScaled(Bytecode::kCallRuntimeForPair, operand_scale,
static_cast<uint16_t>(function_id), RegisterOperand(first_arg),
UnsignedOperand(arg_count), RegisterOperand(first_return));
@@ -1053,10 +1048,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair(
BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(
int context_index, Register receiver_args, size_t receiver_args_count) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForUnsignedOperand(context_index),
- SizeForRegisterOperand(receiver_args),
- SizeForUnsignedOperand(receiver_args_count));
+ OperandScale operand_scale = OperandSizesToScale(
+ SizeForUnsignedOperand(context_index), receiver_args.SizeOfOperand(),
+ SizeForUnsignedOperand(receiver_args_count));
OutputScaled(Bytecode::kCallJSRuntime, operand_scale,
UnsignedOperand(context_index), RegisterOperand(receiver_args),
UnsignedOperand(receiver_args_count));
@@ -1066,8 +1060,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(
BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
LanguageMode language_mode) {
- OperandScale operand_scale =
- OperandSizesToScale(SizeForRegisterOperand(object));
+ OperandScale operand_scale = OperandSizesToScale(object.SizeOfOperand());
OutputScaled(BytecodeForDelete(language_mode), operand_scale,
RegisterOperand(object));
return *this;
@@ -1137,7 +1130,7 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode,
return SizeForUnsignedOperand(unsigned_value) <= operand_size;
}
case OperandType::kMaybeReg:
- if (operand_value == 0) {
+ if (RegisterFromOperand(operand_value) == Register(0)) {
return true;
}
// Fall-through to kReg case.
@@ -1174,7 +1167,7 @@ bool BytecodeArrayBuilder::RegisterIsValid(Register reg,
return false;
}
- if (SizeForRegisterOperand(reg) > reg_size) {
+ if (reg.SizeOfOperand() > reg_size) {
return false;
}
@@ -1392,17 +1385,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForCall(TailCallMode tail_call_mode) {
}
// static
-OperandSize BytecodeArrayBuilder::SizeForRegisterOperand(Register value) {
- if (value.is_byte_operand()) {
- return OperandSize::kByte;
- } else if (value.is_short_operand()) {
- return OperandSize::kShort;
- } else {
- return OperandSize::kQuad;
- }
-}
-
-// static
OperandSize BytecodeArrayBuilder::SizeForSignedOperand(int value) {
if (kMinInt8 <= value && value <= kMaxInt8) {
return OperandSize::kByte;
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698