[ic] Pass name to LoadGlobalIC again.

The reasons are:
1) The names dictionaries in the feedback metadata seems to consume a lot of memory
   and the idea didn't payoff.
2) The absence of a name parameter blocks data handlers support in LoadGlobalIC.

This CL reverts a part of r37278 (https://codereview.chromium.org/2096653003/).

BUG=chromium:576312, v8:5561

Review-Url: https://codereview.chromium.org/2510653002
Cr-Commit-Position: refs/heads/master@{#41046}
This commit is contained in:
ishell 2016-11-16 10:17:22 -08:00 committed by Commit bot
parent f718cd1309
commit d3231f5144
26 changed files with 139 additions and 97 deletions

View File

@ -741,27 +741,33 @@ void BytecodeGraphBuilder::VisitMov() {
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value);
}
Node* BytecodeGraphBuilder::BuildLoadGlobal(uint32_t feedback_slot_index,
Node* BytecodeGraphBuilder::BuildLoadGlobal(Handle<Name> name,
uint32_t feedback_slot_index,
TypeofMode typeof_mode) {
VectorSlotPair feedback = CreateVectorSlotPair(feedback_slot_index);
DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
feedback_vector()->GetKind(feedback.slot()));
Handle<Name> name(feedback_vector()->GetName(feedback.slot()));
const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
return NewNode(op, GetFunctionClosure());
}
void BytecodeGraphBuilder::VisitLdaGlobal() {
PrepareEagerCheckpoint();
Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0),
TypeofMode::NOT_INSIDE_TYPEOF);
Handle<Name> name =
Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node =
BuildLoadGlobal(name, feedback_slot_index, TypeofMode::NOT_INSIDE_TYPEOF);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
PrepareEagerCheckpoint();
Node* node = BuildLoadGlobal(bytecode_iterator().GetIndexOperand(0),
TypeofMode::INSIDE_TYPEOF);
Handle<Name> name =
Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node =
BuildLoadGlobal(name, feedback_slot_index, TypeofMode::INSIDE_TYPEOF);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
@ -950,8 +956,10 @@ void BytecodeGraphBuilder::BuildLdaLookupGlobalSlot(TypeofMode typeof_mode) {
// Fast path, do a global load.
{
PrepareEagerCheckpoint();
Node* node =
BuildLoadGlobal(bytecode_iterator().GetIndexOperand(1), typeof_mode);
Handle<Name> name =
Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node = BuildLoadGlobal(name, feedback_slot_index, typeof_mode);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}

View File

@ -136,7 +136,8 @@ class BytecodeGraphBuilder {
void ClearNonLiveSlotsInFrameStates();
void BuildCreateArguments(CreateArgumentsType type);
Node* BuildLoadGlobal(uint32_t feedback_slot_index, TypeofMode typeof_mode);
Node* BuildLoadGlobal(Handle<Name> name, uint32_t feedback_slot_index,
TypeofMode typeof_mode);
void BuildStoreGlobal(LanguageMode language_mode);
void BuildNamedStore(LanguageMode language_mode);
void BuildKeyedStore(LanguageMode language_mode);

View File

@ -219,9 +219,10 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(1, vector);
node->ReplaceInput(4, effect);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(2, vector);
node->ReplaceInput(5, effect);
ReplaceWithStubCall(node, callable, flags);
}

View File

@ -5334,7 +5334,8 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
Callable callable = CodeFactory::LoadGlobalICInOptimizedCode(
isolate(), ast_context()->typeof_mode());
HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {slot_value, vector_value};
HValue* name = Add<HConstant>(variable->name());
HValue* values[] = {name, slot_value, vector_value};
HCallWithDescriptor* instr = New<HCallWithDescriptor>(
Code::LOAD_GLOBAL_IC, stub, 0, callable.descriptor(),
ArrayVector(values));

View File

@ -499,11 +499,11 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
TypeofMode typeof_mode) {
#ifdef DEBUG
Variable* var = proxy->var();
DCHECK(var->IsUnallocated() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
#endif
__ Move(LoadDescriptor::NameRegister(), var->name());
EmitLoadSlot(LoadGlobalDescriptor::SlotRegister(),
proxy->VariableFeedbackSlot());
Handle<Code> code = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code();

View File

@ -1170,8 +1170,7 @@ void AccessorAssemblerImpl::LoadGlobalIC(const LoadICParameters* p) {
Node* native_context = LoadNativeContext(p->context);
Node* receiver =
LoadContextElement(native_context, Context::EXTENSION_INDEX);
Node* fake_name = IntPtrConstant(0);
TailCallStub(descriptor, handler, p->context, receiver, fake_name, p->slot,
TailCallStub(descriptor, handler, p->context, receiver, p->name, p->slot,
p->vector);
}
Bind(&miss);
@ -1569,22 +1568,24 @@ void AccessorAssemblerImpl::GenerateLoadICProtoArray() {
void AccessorAssemblerImpl::GenerateLoadGlobalIC() {
typedef LoadGlobalICStub::Descriptor Descriptor;
Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
LoadICParameters p(context, nullptr, nullptr, slot, vector);
LoadICParameters p(context, nullptr, name, slot, vector);
LoadGlobalIC(&p);
}
void AccessorAssemblerImpl::GenerateLoadGlobalICTrampoline() {
typedef LoadGlobalICTrampolineStub::Descriptor Descriptor;
Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* context = Parameter(Descriptor::kContext);
Node* vector = LoadTypeFeedbackVectorForStub();
LoadICParameters p(context, nullptr, nullptr, slot, vector);
LoadICParameters p(context, nullptr, name, slot, vector);
LoadGlobalIC(&p);
}

View File

@ -92,22 +92,24 @@ void LoadDescriptor::InitializePlatformSpecific(
void LoadGlobalDescriptor::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
// kSlot
MachineType machine_types[] = {MachineType::TaggedSigned()};
// kName, kSlot
MachineType machine_types[] = {MachineType::AnyTagged(),
MachineType::TaggedSigned()};
data->InitializePlatformIndependent(arraysize(machine_types), 0,
machine_types);
}
void LoadGlobalDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {LoadWithVectorDescriptor::SlotRegister()};
Register registers[] = {NameRegister(), SlotRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void LoadGlobalWithVectorDescriptor::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
// kSlot, kVector
MachineType machine_types[] = {MachineType::TaggedSigned(),
// kName, kSlot, kVector
MachineType machine_types[] = {MachineType::AnyTagged(),
MachineType::TaggedSigned(),
MachineType::AnyTagged()};
data->InitializePlatformIndependent(arraysize(machine_types), 0,
machine_types);
@ -115,8 +117,7 @@ void LoadGlobalWithVectorDescriptor::InitializePlatformIndependent(
void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {LoadWithVectorDescriptor::SlotRegister(),
LoadWithVectorDescriptor::VectorRegister()};
Register registers[] = {NameRegister(), SlotRegister(), VectorRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}

View File

@ -306,10 +306,14 @@ class LoadDescriptor : public CallInterfaceDescriptor {
class LoadGlobalDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kSlot)
DEFINE_PARAMETERS(kName, kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalDescriptor,
CallInterfaceDescriptor)
static const Register NameRegister() {
return LoadDescriptor::NameRegister();
}
static const Register SlotRegister() {
return LoadDescriptor::SlotRegister();
}
@ -400,7 +404,7 @@ class LoadICProtoArrayDescriptor : public LoadWithVectorDescriptor {
class LoadGlobalWithVectorDescriptor : public LoadGlobalDescriptor {
public:
DEFINE_PARAMETERS(kSlot, kVector)
DEFINE_PARAMETERS(kName, kSlot, kVector)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalWithVectorDescriptor,
LoadGlobalDescriptor)

View File

@ -433,13 +433,14 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::MoveRegister(Register from,
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int feedback_slot,
TypeofMode typeof_mode) {
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
const Handle<String> name, int feedback_slot, TypeofMode typeof_mode) {
size_t name_index = GetConstantPoolEntry(name);
if (typeof_mode == INSIDE_TYPEOF) {
OutputLdaGlobalInsideTypeof(feedback_slot);
OutputLdaGlobalInsideTypeof(name_index, feedback_slot);
} else {
DCHECK_EQ(typeof_mode, NOT_INSIDE_TYPEOF);
OutputLdaGlobal(feedback_slot);
OutputLdaGlobal(name_index, feedback_slot);
}
return *this;
}

View File

@ -84,7 +84,8 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final
BytecodeArrayBuilder& LoadFalse();
// Global loads to the accumulator and stores from the accumulator.
BytecodeArrayBuilder& LoadGlobal(int feedback_slot, TypeofMode typeof_mode);
BytecodeArrayBuilder& LoadGlobal(const Handle<String> name, int feedback_slot,
TypeofMode typeof_mode);
BytecodeArrayBuilder& StoreGlobal(const Handle<String> name,
int feedback_slot,
LanguageMode language_mode);

View File

@ -1819,7 +1819,8 @@ void BytecodeGenerator::BuildVariableLoad(Variable* variable,
break;
}
case VariableLocation::UNALLOCATED: {
builder()->LoadGlobal(feedback_index(slot), typeof_mode);
builder()->LoadGlobal(variable->name(), feedback_index(slot),
typeof_mode);
break;
}
case VariableLocation::CONTEXT: {

View File

@ -38,8 +38,9 @@ namespace interpreter {
V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \
\
/* Globals */ \
V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \
V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx) \
V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \
OperandType::kIdx) \
V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \

View File

@ -425,21 +425,23 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) {
__ Dispatch();
}
Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context,
Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index,
Node* feedback_slot,
InterpreterAssembler* assembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
// Load the global via the LoadGlobalIC.
Node* code_target = __ HeapConstant(ic.code());
Node* name = __ LoadConstantPoolEntry(name_index);
Node* smi_slot = __ SmiTag(feedback_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
return __ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kName, name),
Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
}
// LdaGlobal <slot>
// LdaGlobal <name_index> <slot>
//
// Load the global with name in constant pool entry <name_index> into the
// accumulator using FeedBackVector slot <slot> outside of a typeof.
@ -449,13 +451,14 @@ void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* raw_slot = __ BytecodeOperandIdx(0);
Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler);
Node* name_index = __ BytecodeOperandIdx(0);
Node* raw_slot = __ BytecodeOperandIdx(1);
Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler);
__ SetAccumulator(result);
__ Dispatch();
}
// LdaGlobalInsideTypeof <slot>
// LdaGlobalInsideTypeof <name_index> <slot>
//
// Load the global with name in constant pool entry <name_index> into the
// accumulator using FeedBackVector slot <slot> inside of a typeof.
@ -465,8 +468,9 @@ void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* raw_slot = __ BytecodeOperandIdx(0);
Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler);
Node* name_index = __ BytecodeOperandIdx(0);
Node* raw_slot = __ BytecodeOperandIdx(1);
Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler);
__ SetAccumulator(result);
__ Dispatch();
}
@ -656,7 +660,8 @@ void Interpreter::DoLdaLookupGlobalSlot(Runtime::FunctionId function_id,
isolate_, function_id == Runtime::kLoadLookupSlotInsideTypeof
? INSIDE_TYPEOF
: NOT_INSIDE_TYPEOF);
Node* result = BuildLoadGlobal(ic, context, feedback_slot, assembler);
Node* result =
BuildLoadGlobal(ic, context, name_index, feedback_slot, assembler);
__ SetAccumulator(result);
__ Dispatch();
}

View File

@ -141,6 +141,7 @@ class Interpreter {
// Generates code to load a global.
compiler::Node* BuildLoadGlobal(Callable ic, compiler::Node* context,
compiler::Node* name_index,
compiler::Node* feedback_slot,
InterpreterAssembler* assembler);

View File

@ -14,17 +14,18 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 14
bytecode array length: 15
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdaUndefined),
B(Star), R(1),
B(LdaGlobal), U8(4),
B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
/* 39 E> */ B(Call), R(0), R(1), U8(1), U8(2),
/* 44 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["t"],
]
handlers: [
]
@ -37,12 +38,12 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 26
bytecode array length: 27
bytecodes: [
/* 34 E> */ B(StackCheck),
/* 39 S> */ B(LdaUndefined),
B(Star), R(1),
B(LdaGlobal), U8(4),
B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
B(LdaSmi), U8(1),
B(Star), R(2),
@ -54,6 +55,7 @@ bytecodes: [
/* 58 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["t"],
]
handlers: [
]

View File

@ -14,15 +14,16 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 11
bytecode array length: 12
bytecodes: [
/* 45 E> */ B(StackCheck),
/* 50 S> */ B(LdaGlobal), U8(4),
/* 50 S> */ B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
/* 57 E> */ B(New), R(0), R(0), U8(0), U8(2),
/* 68 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["bar"],
]
handlers: [
]
@ -35,10 +36,10 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 17
bytecode array length: 18
bytecodes: [
/* 58 E> */ B(StackCheck),
/* 63 S> */ B(LdaGlobal), U8(4),
/* 63 S> */ B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
B(LdaSmi), U8(3),
B(Star), R(1),
@ -47,6 +48,7 @@ bytecodes: [
/* 82 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["bar"],
]
handlers: [
]
@ -64,10 +66,10 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 25
bytecode array length: 26
bytecodes: [
/* 100 E> */ B(StackCheck),
/* 105 S> */ B(LdaGlobal), U8(4),
/* 105 S> */ B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
B(LdaSmi), U8(3),
B(Star), R(1),
@ -80,6 +82,7 @@ bytecodes: [
/* 130 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["bar"],
]
handlers: [
]

View File

@ -390,7 +390,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 791
bytecode array length: 792
bytecodes: [
B(CreateFunctionContext), U8(254),
B(PushContext), R(0),
@ -903,7 +903,7 @@ bytecodes: [
/* 3435 E> */ B(StaCurrentContextSlot), U8(255),
/* 3438 S> */ B(LdaUndefined),
B(Star), R(2),
B(LdaGlobal), U8(4),
B(LdaGlobal), U8(0), U8(4),
B(Star), R(1),
/* 3438 E> */ B(Call), R(1), R(2), U8(1), U8(2),
/* 3454 S> */ B(LdaSmi), U8(100),
@ -912,6 +912,7 @@ bytecodes: [
/* 3468 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"],
]
handlers: [
]

View File

@ -104,7 +104,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 31
bytecode array length: 32
bytecodes: [
B(LdaConstant), U8(0),
B(Star), R(1),
@ -115,7 +115,7 @@ bytecodes: [
/* 0 E> */ B(StackCheck),
/* 16 S> */ B(LdaUndefined),
B(Star), R(2),
B(LdaGlobal), U8(2),
B(LdaGlobal), U8(1), U8(2),
B(Star), R(1),
/* 16 E> */ B(Call), R(1), R(2), U8(1), U8(4),
B(Star), R(0),
@ -123,6 +123,7 @@ bytecodes: [
]
constant pool: [
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["f"],
]
handlers: [
]

View File

@ -14,10 +14,10 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 13
bytecode array length: 14
bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdaGlobal), U8(2),
/* 31 S> */ B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(BitwiseAndSmi), U8(1), R(0), U8(4),
/* 45 E> */ B(StaGlobalSloppy), U8(0), U8(5),
@ -37,10 +37,10 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 13
bytecode array length: 14
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdaGlobal), U8(2),
/* 32 S> */ B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(AddSmi), U8(1), R(0), U8(4),
/* 51 E> */ B(StaGlobalSloppy), U8(0), U8(5),

View File

@ -14,10 +14,10 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 9
bytecode array length: 10
bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdaGlobal), U8(2),
/* 31 S> */ B(LdaGlobal), U8(0), U8(2),
B(Inc), U8(6),
/* 40 E> */ B(StaGlobalSloppy), U8(0), U8(4),
/* 48 S> */ B(Return),
@ -36,10 +36,10 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 15
bytecode array length: 16
bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdaGlobal), U8(2),
/* 31 S> */ B(LdaGlobal), U8(0), U8(2),
B(ToNumber), R(0),
B(Ldar), R(0),
B(Dec), U8(6),
@ -61,10 +61,10 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 9
bytecode array length: 10
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 46 S> */ B(LdaGlobal), U8(2),
/* 46 S> */ B(LdaGlobal), U8(0), U8(2),
B(Dec), U8(6),
/* 55 E> */ B(StaGlobalStrict), U8(0), U8(4),
/* 68 S> */ B(Return),
@ -83,10 +83,10 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 15
bytecode array length: 16
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdaGlobal), U8(2),
/* 32 S> */ B(LdaGlobal), U8(0), U8(2),
B(ToNumber), R(0),
B(Ldar), R(0),
B(Inc), U8(6),

View File

@ -16,16 +16,17 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 32 E> */ B(StackCheck),
/* 39 S> */ B(LdaGlobal), U8(2),
/* 39 S> */ B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(LdaConstant), U8(0),
B(LdaConstant), U8(1),
B(DeletePropertySloppy), R(0),
/* 58 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
@ -42,16 +43,17 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 28 E> */ B(StackCheck),
/* 51 S> */ B(LdaGlobal), U8(2),
/* 51 S> */ B(LdaGlobal), U8(0), U8(2),
B(Star), R(0),
B(LdaSmi), U8(1),
B(DeletePropertyStrict), R(0),
/* 71 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]

View File

@ -14,13 +14,14 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 4
bytecode array length: 5
bytecodes: [
/* 21 E> */ B(StackCheck),
/* 26 S> */ B(LdaGlobal), U8(2),
/* 26 S> */ B(LdaGlobal), U8(0), U8(2),
/* 36 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]
@ -33,13 +34,14 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 4
bytecode array length: 5
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdaGlobal), U8(2),
/* 32 S> */ B(LdaGlobal), U8(0), U8(2),
/* 42 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["t"],
]
handlers: [
]
@ -52,13 +54,14 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 4
bytecode array length: 5
bytecodes: [
/* 17 E> */ B(StackCheck),
/* 22 S> */ B(LdaGlobal), U8(2),
/* 22 S> */ B(LdaGlobal), U8(0), U8(2),
/* 32 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]
@ -201,7 +204,7 @@ snippet: "
"
frame size: 0
parameter count: 2
bytecode array length: 650
bytecode array length: 652
bytecodes: [
/* 17 E> */ B(StackCheck),
/* 25 S> */ B(Nop),
@ -460,11 +463,12 @@ bytecodes: [
/* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254),
/* 1295 S> */ B(Nop),
/* 1296 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256),
/* 1305 S> */ B(Wide), B(LdaGlobal), U16(258),
/* 1305 S> */ B(Wide), B(LdaGlobal), U16(1), U16(258),
/* 1315 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
]
handlers: [
]

View File

@ -39,14 +39,15 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 5
bytecode array length: 6
bytecodes: [
/* 22 E> */ B(StackCheck),
/* 28 S> */ B(LdaGlobalInsideTypeof), U8(2),
/* 28 S> */ B(LdaGlobalInsideTypeof), U8(0), U8(2),
B(TypeOf),
/* 46 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
]

View File

@ -77,8 +77,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit global load / store operations.
Handle<String> name = factory->NewStringFromStaticChars("var_name");
builder.LoadGlobal(1, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(1, TypeofMode::INSIDE_TYPEOF)
builder.LoadGlobal(name, 1, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(name, 1, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(name, 1, LanguageMode::SLOPPY)
.StoreGlobal(name, 1, LanguageMode::STRICT);
@ -285,14 +285,14 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name");
// Emit wide global load / store operations.
builder.LoadGlobal(1024, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF)
builder.LoadGlobal(name, 1024, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF)
.LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF)
.StoreGlobal(name, 1024, LanguageMode::SLOPPY)
.StoreGlobal(wide_name, 1, LanguageMode::STRICT);
// Emit extra wide global load.
builder.LoadGlobal(1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF);
builder.LoadGlobal(name, 1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF);
// Emit wide load / store property operations.
builder.LoadNamedProperty(reg, wide_name, 0)

View File

@ -60,7 +60,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
.ForInPrepare(reg_0, triple)
.CallRuntime(Runtime::kLoadIC_Miss, reg_0)
.Debugger()
.LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
.LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
.Return();
// Test iterator sees the expected output from the builder.
@ -268,8 +268,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaGlobal);
CHECK_EQ(iterator.current_offset(), offset);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple);
CHECK_EQ(iterator.current_bytecode_size(), 6);
CHECK_EQ(iterator.GetIndexOperand(0), 0x10000000u);
CHECK_EQ(iterator.current_bytecode_size(), 10);
CHECK_EQ(iterator.GetIndexOperand(1), 0x10000000u);
offset += Bytecodes::Size(Bytecode::kLdaGlobal, OperandScale::kQuadruple) +
kPrefixByteSize;
iterator.Advance();

View File

@ -68,11 +68,12 @@ TEST_F(BytecodeNodeTest, Constructor2) {
}
TEST_F(BytecodeNodeTest, Constructor3) {
uint32_t operands[] = {0x11};
BytecodeNode node(Bytecode::kLdaGlobal, operands[0]);
uint32_t operands[] = {0x11, 0x22};
BytecodeNode node(Bytecode::kLdaGlobal, operands[0], operands[1]);
CHECK_EQ(node.bytecode(), Bytecode::kLdaGlobal);
CHECK_EQ(node.operand_count(), 1);
CHECK_EQ(node.operand_count(), 2);
CHECK_EQ(node.operand(0), operands[0]);
CHECK_EQ(node.operand(1), operands[1]);
CHECK(!node.source_info().is_valid());
}