Commit 87dee75e authored by mythria's avatar mythria Committed by Commit bot

[Interpreter] Updates load/store global and named property to accept variable name.

Changes LoadGlobal, StoreGlobal, LoadNamedProperty, and StoreNamedProperty to accept
the name of variable instead of index into the constant pool entry. Also made
GetConstantPoolEntry as a private function since it is no longer used outside of
BytecodeArrayBuilder.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1546643002

Cr-Commit-Position: refs/heads/master@{#33020}
parent 6eb00e4a
......@@ -380,11 +380,12 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::MoveRegister(Register from,
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
size_t name_index, int feedback_slot, LanguageMode language_mode,
const Handle<String> name, int feedback_slot, LanguageMode language_mode,
TypeofMode typeof_mode) {
// TODO(rmcilroy): Potentially store language and typeof information in an
// operand rather than having extra bytecodes.
Bytecode bytecode = BytecodeForLoadGlobal(language_mode, typeof_mode);
size_t name_index = GetConstantPoolEntry(name);
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
......@@ -400,8 +401,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
size_t name_index, int feedback_slot, LanguageMode language_mode) {
const Handle<String> name, int feedback_slot, LanguageMode language_mode) {
Bytecode bytecode = BytecodeForStoreGlobal(language_mode);
size_t name_index = GetConstantPoolEntry(name);
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
......@@ -471,9 +473,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreLookupSlot(
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
Register object, size_t name_index, int feedback_slot,
Register object, const Handle<String> name, int feedback_slot,
LanguageMode language_mode) {
Bytecode bytecode = BytecodeForLoadIC(language_mode);
size_t name_index = GetConstantPoolEntry(name);
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
......@@ -505,9 +508,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
Register object, size_t name_index, int feedback_slot,
Register object, const Handle<String> name, int feedback_slot,
LanguageMode language_mode) {
Bytecode bytecode = BytecodeForStoreIC(language_mode);
size_t name_index = GetConstantPoolEntry(name);
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
......
......@@ -70,9 +70,6 @@ class BytecodeArrayBuilder final {
// Return true if the register |reg| represents a temporary register.
bool RegisterIsTemporary(Register reg) const;
// Gets a constant pool entry for the |object|.
size_t GetConstantPoolEntry(Handle<Object> object);
// Constant loads to accumulator.
BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value);
BytecodeArrayBuilder& LoadLiteral(Handle<Object> object);
......@@ -84,10 +81,11 @@ class BytecodeArrayBuilder final {
BytecodeArrayBuilder& LoadBooleanConstant(bool value);
// Global loads to the accumulator and stores from the accumulator.
BytecodeArrayBuilder& LoadGlobal(size_t name_index, int feedback_slot,
BytecodeArrayBuilder& LoadGlobal(const Handle<String> name, int feedback_slot,
LanguageMode language_mode,
TypeofMode typeof_mode);
BytecodeArrayBuilder& StoreGlobal(size_t name_index, int feedback_slot,
BytecodeArrayBuilder& StoreGlobal(const Handle<String> name,
int feedback_slot,
LanguageMode language_mode);
// Load the object at |slot_index| in |context| into the accumulator.
......@@ -104,7 +102,8 @@ class BytecodeArrayBuilder final {
BytecodeArrayBuilder& MoveRegister(Register from, Register to);
// Named load property.
BytecodeArrayBuilder& LoadNamedProperty(Register object, size_t name_index,
BytecodeArrayBuilder& LoadNamedProperty(Register object,
const Handle<String> name,
int feedback_slot,
LanguageMode language_mode);
// Keyed load property. The key should be in the accumulator.
......@@ -112,7 +111,8 @@ class BytecodeArrayBuilder final {
LanguageMode language_mode);
// Store properties. The value to be stored should be in the accumulator.
BytecodeArrayBuilder& StoreNamedProperty(Register object, size_t name_index,
BytecodeArrayBuilder& StoreNamedProperty(Register object,
const Handle<String> name,
int feedback_slot,
LanguageMode language_mode);
BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key,
......@@ -289,6 +289,9 @@ class BytecodeArrayBuilder final {
Register first_temporary_register() const;
Register last_temporary_register() const;
// Gets a constant pool entry for the |object|.
size_t GetConstantPoolEntry(Handle<Object> object);
Isolate* isolate_;
Zone* zone_;
ZoneVector<uint8_t> bytecodes_;
......
......@@ -844,9 +844,8 @@ void BytecodeGenerator::VisitForInAssignment(Expression* expr,
Register value = temporary_register_scope.NewRegister();
builder()->StoreAccumulatorInRegister(value);
Register object = VisitForRegisterValue(property->obj());
size_t name_index = builder()->GetConstantPoolEntry(
property->key()->AsLiteral()->AsPropertyName());
builder()->StoreNamedProperty(object, name_index, feedback_index(slot),
Handle<String> name = property->key()->AsLiteral()->AsPropertyName();
builder()->StoreNamedProperty(object, name, feedback_index(slot),
language_mode());
break;
}
......@@ -1064,12 +1063,10 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
// contains computed properties with an uninitialized value.
if (literal_key->value()->IsInternalizedString()) {
if (property->emit_store()) {
size_t name_index =
builder()->GetConstantPoolEntry(literal_key->AsPropertyName());
VisitForAccumulatorValue(property->value());
builder()->StoreNamedProperty(literal, name_index,
feedback_index(property->GetSlot(0)),
language_mode());
builder()->StoreNamedProperty(
literal, literal_key->AsPropertyName(),
feedback_index(property->GetSlot(0)), language_mode());
} else {
VisitForEffect(property->value());
}
......@@ -1291,9 +1288,8 @@ void BytecodeGenerator::VisitVariableLoad(Variable* variable,
}
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED: {
size_t name_index = builder()->GetConstantPoolEntry(variable->name());
builder()->LoadGlobal(name_index, feedback_index(slot), language_mode(),
typeof_mode);
builder()->LoadGlobal(variable->name(), feedback_index(slot),
language_mode(), typeof_mode);
execution_result()->SetResultInAccumulator();
break;
}
......@@ -1372,8 +1368,8 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
}
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED: {
size_t name_index = builder()->GetConstantPoolEntry(variable->name());
builder()->StoreGlobal(name_index, feedback_index(slot), language_mode());
builder()->StoreGlobal(variable->name(), feedback_index(slot),
language_mode());
break;
}
case VariableLocation::CONTEXT: {
......@@ -1416,7 +1412,7 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
void BytecodeGenerator::VisitAssignment(Assignment* expr) {
DCHECK(expr->target()->IsValidReferenceExpression());
Register object, key;
size_t name_index = kMaxUInt32;
Handle<String> name;
// Left-hand side can only be a property, a global or a variable slot.
Property* property = expr->target()->AsProperty();
......@@ -1429,8 +1425,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
break;
case NAMED_PROPERTY: {
object = VisitForRegisterValue(property->obj());
name_index = builder()->GetConstantPoolEntry(
property->key()->AsLiteral()->AsPropertyName());
name = property->key()->AsLiteral()->AsPropertyName();
break;
}
case KEYED_PROPERTY: {
......@@ -1466,7 +1461,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
FeedbackVectorSlot slot = property->PropertyFeedbackSlot();
old_value = execution_result()->NewRegister();
builder()
->LoadNamedProperty(object, name_index, feedback_index(slot),
->LoadNamedProperty(object, name, feedback_index(slot),
language_mode())
.StoreAccumulatorInRegister(old_value);
break;
......@@ -1504,7 +1499,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
break;
}
case NAMED_PROPERTY:
builder()->StoreNamedProperty(object, name_index, feedback_index(slot),
builder()->StoreNamedProperty(object, name, feedback_index(slot),
language_mode());
break;
case KEYED_PROPERTY:
......@@ -1535,10 +1530,9 @@ void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) {
case VARIABLE:
UNREACHABLE();
case NAMED_PROPERTY: {
size_t name_index = builder()->GetConstantPoolEntry(
expr->key()->AsLiteral()->AsPropertyName());
builder()->LoadNamedProperty(obj, name_index, feedback_index(slot),
language_mode());
builder()->LoadNamedProperty(obj,
expr->key()->AsLiteral()->AsPropertyName(),
feedback_index(slot), language_mode());
break;
}
case KEYED_PROPERTY: {
......@@ -1824,7 +1818,7 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
// Evaluate LHS expression and get old value.
Register obj, key, old_value;
size_t name_index = kMaxUInt32;
Handle<String> name;
switch (assign_type) {
case VARIABLE: {
VariableProxy* proxy = expr->expression()->AsVariableProxy();
......@@ -1835,9 +1829,8 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: {
FeedbackVectorSlot slot = property->PropertyFeedbackSlot();
obj = VisitForRegisterValue(property->obj());
name_index = builder()->GetConstantPoolEntry(
property->key()->AsLiteral()->AsPropertyName());
builder()->LoadNamedProperty(obj, name_index, feedback_index(slot),
name = property->key()->AsLiteral()->AsPropertyName();
builder()->LoadNamedProperty(obj, name, feedback_index(slot),
language_mode());
break;
}
......@@ -1880,8 +1873,8 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
break;
}
case NAMED_PROPERTY: {
builder()->StoreNamedProperty(
obj, name_index, feedback_index(feedback_slot), language_mode());
builder()->StoreNamedProperty(obj, name, feedback_index(feedback_slot),
language_mode());
break;
}
case KEYED_PROPERTY: {
......
......@@ -1026,25 +1026,25 @@ TEST(PropertyStores) {
2,
8,
{
B(LdaConstant), U8(1), //
B(StoreICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), //
B(LdaConstant), U8(0), //
B(StoreICSloppy), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), //
B(LdaUndefined), //
B(Return), //
},
2,
{"name", "val"}},
{"val", "name"}},
{"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})",
0,
2,
8,
{
B(LdaConstant), U8(1), //
B(StoreICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), //
B(LdaConstant), U8(0), //
B(StoreICSloppy), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), //
B(LdaUndefined), //
B(Return), //
},
2,
{"key", "val"}},
{"val", "key"}},
{"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})",
kPointerSize,
2,
......@@ -1093,13 +1093,13 @@ TEST(PropertyStores) {
2,
8,
{
B(LdaConstant), U8(1), //
B(StoreICStrict), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), //
B(LdaConstant), U8(0), //
B(StoreICStrict), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), //
B(LdaUndefined), //
B(Return), //
},
2,
{"name", "val"}},
{"val", "name"}},
{"function f(a, b) { \"use strict\"; a[b] = \"val\"; }\n"
"f({arg : \"test\"}, \"arg\")",
0,
......@@ -3334,15 +3334,15 @@ TEST(ObjectLiterals) {
{
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(CreateClosure), U8(2), U8(0), //
B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
B(CreateClosure), U8(1), U8(0), //
B(StoreICSloppy), R(0), U8(2), U8(vector->GetIndex(slot1)), //
B(Ldar), R(0), //
B(Return), //
},
3,
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
{"return { func(a) { return a; } };",
1 * kPointerSize,
1,
......@@ -3350,15 +3350,15 @@ TEST(ObjectLiterals) {
{
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(CreateClosure), U8(2), U8(0), //
B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
B(CreateClosure), U8(1), U8(0), //
B(StoreICSloppy), R(0), U8(2), U8(vector->GetIndex(slot1)), //
B(Ldar), R(0), //
B(Return), //
},
3,
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
{"return { get a() { return 2; } };",
5 * kPointerSize,
1,
......@@ -3659,8 +3659,8 @@ TEST(TopLevelObjectLiterals) {
B(Star), R(2), //
B(CreateObjectLiteral), U8(2), U8(0), U8(has_function_flags), //
B(Star), R(4), //
B(CreateClosure), U8(4), U8(1), //
B(StoreICSloppy), R(4), U8(3), U8(3), //
B(CreateClosure), U8(3), U8(1), //
B(StoreICSloppy), R(4), U8(4), U8(3), //
B(CallRuntime), U16(Runtime::kToFastProperties), R(4), U8(1), //
B(Ldar), R(4), //
B(Star), R(3), //
......@@ -3672,8 +3672,8 @@ TEST(TopLevelObjectLiterals) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
for (size_t i = 0; i < arraysize(snippets); i++) {
......
......@@ -774,9 +774,8 @@ TEST(InterpreterLoadNamedProperty) {
builder.set_locals_count(0);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadNamedProperty(builder.Parameter(0), name_index,
vector->GetIndex(slot), i::SLOPPY)
builder.LoadNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot),
i::SLOPPY)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -876,10 +875,9 @@ TEST(InterpreterStoreNamedProperty) {
builder.set_locals_count(0);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadLiteral(Smi::FromInt(999))
.StoreNamedProperty(builder.Parameter(0), name_index,
vector->GetIndex(slot), i::STRICT)
.StoreNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot),
i::STRICT)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -991,9 +989,7 @@ TEST(InterpreterCall) {
builder.set_locals_count(1);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadNamedProperty(builder.Parameter(0), name_index, slot_index,
i::SLOPPY)
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index, i::SLOPPY)
.StoreAccumulatorInRegister(Register(0))
.Call(Register(0), builder.Parameter(0), 0, 0)
.Return();
......@@ -1014,9 +1010,7 @@ TEST(InterpreterCall) {
builder.set_locals_count(1);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadNamedProperty(builder.Parameter(0), name_index, slot_index,
i::SLOPPY)
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index, i::SLOPPY)
.StoreAccumulatorInRegister(Register(0))
.Call(Register(0), builder.Parameter(0), 0, 0)
.Return();
......@@ -1040,9 +1034,7 @@ TEST(InterpreterCall) {
builder.set_locals_count(4);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadNamedProperty(builder.Parameter(0), name_index, slot_index,
i::SLOPPY)
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index, i::SLOPPY)
.StoreAccumulatorInRegister(Register(0))
.LoadAccumulatorWithRegister(builder.Parameter(0))
.StoreAccumulatorInRegister(Register(1))
......@@ -1071,9 +1063,7 @@ TEST(InterpreterCall) {
builder.set_locals_count(12);
builder.set_context_count(0);
builder.set_parameter_count(1);
size_t name_index = builder.GetConstantPoolEntry(name);
builder.LoadNamedProperty(builder.Parameter(0), name_index, slot_index,
i::SLOPPY)
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index, i::SLOPPY)
.StoreAccumulatorInRegister(Register(0))
.LoadAccumulatorWithRegister(builder.Parameter(0))
.StoreAccumulatorInRegister(Register(1))
......
......@@ -51,21 +51,15 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.MoveRegister(reg, other);
// Emit global load / store operations.
builder.LoadGlobal(0, 1, LanguageMode::SLOPPY, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(0, 1, LanguageMode::STRICT, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(0, 1, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(0, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(0, 1, LanguageMode::SLOPPY)
.StoreGlobal(0, 1, LanguageMode::STRICT);
// Emit wide global load / store operations.
builder.LoadGlobal(0, 1024, LanguageMode::SLOPPY,
Factory* factory = isolate()->factory();
Handle<String> name = factory->NewStringFromStaticChars("var_name");
builder.LoadGlobal(name, 1, LanguageMode::SLOPPY,
TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(1024, 1, LanguageMode::STRICT, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(0, 1024, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(1024, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(0, 1024, LanguageMode::SLOPPY)
.StoreGlobal(1024, 1, LanguageMode::STRICT);
.LoadGlobal(name, 1, LanguageMode::STRICT, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(name, 1, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(name, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(name, 1, LanguageMode::SLOPPY)
.StoreGlobal(name, 1, LanguageMode::STRICT);
// Emit context operations.
builder.PushContext(reg);
......@@ -74,28 +68,16 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.StoreContextSlot(reg, 1);
// Emit load / store property operations.
builder.LoadNamedProperty(reg, 0, 0, LanguageMode::SLOPPY)
builder.LoadNamedProperty(reg, name, 0, LanguageMode::SLOPPY)
.LoadKeyedProperty(reg, 0, LanguageMode::SLOPPY)
.StoreNamedProperty(reg, 0, 0, LanguageMode::SLOPPY)
.StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY)
.StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY)
.LoadNamedProperty(reg, 0, 0, LanguageMode::STRICT)
.LoadNamedProperty(reg, name, 0, LanguageMode::STRICT)
.LoadKeyedProperty(reg, 0, LanguageMode::STRICT)
.StoreNamedProperty(reg, 0, 0, LanguageMode::STRICT)
.StoreNamedProperty(reg, name, 0, LanguageMode::STRICT)
.StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT);
// Emit wide load / store property operations.
builder.LoadNamedProperty(reg, 2056, 0, LanguageMode::SLOPPY)
.LoadKeyedProperty(reg, 2056, LanguageMode::SLOPPY)
.StoreNamedProperty(reg, 0, 2056, LanguageMode::SLOPPY)
.StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY)
.LoadNamedProperty(reg, 2056, 0, LanguageMode::STRICT)
.LoadKeyedProperty(reg, 2056, LanguageMode::STRICT)
.StoreNamedProperty(reg, 0, 2056, LanguageMode::STRICT)
.StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT);
// Emit load / store lookup slots.
Factory* factory = isolate()->factory();
Handle<String> name = factory->NewStringFromStaticChars("var_name");
builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadLookupSlot(name, TypeofMode::INSIDE_TYPEOF)
.StoreLookupSlot(name, LanguageMode::SLOPPY)
......@@ -226,9 +208,30 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Wide constant pool loads
for (int i = 0; i < 256; i++) {
// Emit junk in constant pool to force wide constant pool index.
builder.GetConstantPoolEntry(handle(Smi::FromInt(i), isolate()));
builder.LoadLiteral(factory->NewNumber(2.5321 + i));
}
builder.LoadLiteral(Smi::FromInt(20000000));
Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name");
// Emit wide global load / store operations.
builder.LoadGlobal(name, 1024, LanguageMode::SLOPPY,
TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(wide_name, 1, LanguageMode::STRICT,
TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(name, 1024, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(wide_name, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(name, 1024, LanguageMode::SLOPPY)
.StoreGlobal(wide_name, 1, LanguageMode::STRICT);
// Emit wide load / store property operations.
builder.LoadNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY)
.LoadKeyedProperty(reg, 2056, LanguageMode::SLOPPY)
.StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY)
.StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY)
.LoadNamedProperty(reg, wide_name, 0, LanguageMode::STRICT)
.LoadKeyedProperty(reg, 2056, LanguageMode::STRICT)
.StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT)
.StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT);
// CreateClosureWide
Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo(
......
......@@ -36,7 +36,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
Register reg_0(0);
Register reg_1(1);
Register reg_2 = Register::FromParameterIndex(2, builder.parameter_count());
int name_index = 21;
Handle<String> name = factory->NewStringFromStaticChars("abc");
int name_index = 3;
int feedback_slot = 97;
builder.LoadLiteral(heap_num_0)
......@@ -45,7 +46,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
.LoadLiteral(smi_0)
.LoadLiteral(smi_1)
.LoadAccumulatorWithRegister(reg_0)
.LoadNamedProperty(reg_1, name_index, feedback_slot, LanguageMode::SLOPPY)
.LoadNamedProperty(reg_1, name, feedback_slot, LanguageMode::SLOPPY)
.StoreAccumulatorInRegister(reg_2)
.CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
.Return();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment