class HPushArguments V8_FINAL : public HInstruction {
public:
- DECLARE_INSTRUCTION_FACTORY_P1(HPushArguments, Zone*);
- DECLARE_INSTRUCTION_FACTORY_P2(HPushArguments, Zone*, HValue*);
- DECLARE_INSTRUCTION_FACTORY_P3(HPushArguments, Zone*, HValue*, HValue*);
- DECLARE_INSTRUCTION_FACTORY_P4(HPushArguments, Zone*,
- HValue*, HValue*, HValue*);
- DECLARE_INSTRUCTION_FACTORY_P5(HPushArguments, Zone*,
- HValue*, HValue*, HValue*, HValue*);
+ static HPushArguments* New(Zone* zone, HValue* context) {
+ return new(zone) HPushArguments(zone);
+ }
+ static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1) {
+ HPushArguments* instr = new(zone) HPushArguments(zone);
+ instr->AddInput(arg1);
+ return instr;
+ }
+ static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1,
+ HValue* arg2) {
+ HPushArguments* instr = new(zone) HPushArguments(zone);
+ instr->AddInput(arg1);
+ instr->AddInput(arg2);
+ return instr;
+ }
+ static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1,
+ HValue* arg2, HValue* arg3) {
+ HPushArguments* instr = new(zone) HPushArguments(zone);
+ instr->AddInput(arg1);
+ instr->AddInput(arg2);
+ instr->AddInput(arg3);
+ return instr;
+ }
+ static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1,
+ HValue* arg2, HValue* arg3, HValue* arg4) {
+ HPushArguments* instr = new(zone) HPushArguments(zone);
+ instr->AddInput(arg1);
+ instr->AddInput(arg2);
+ instr->AddInput(arg3);
+ instr->AddInput(arg4);
+ return instr;
+ }
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
return Representation::Tagged();
return inputs_[i];
}
- void AddArgument(HValue* arg) {
- inputs_.Add(NULL, zone_);
- SetOperandAt(inputs_.length() - 1, arg);
- }
+ void AddInput(HValue* value);
DECLARE_CONCRETE_INSTRUCTION(PushArguments)
}
private:
- HPushArguments(Zone* zone,
- HValue* arg1 = NULL, HValue* arg2 = NULL,
- HValue* arg3 = NULL, HValue* arg4 = NULL)
- : HInstruction(HType::Tagged()), zone_(zone), inputs_(4, zone) {
+ explicit HPushArguments(Zone* zone)
+ : HInstruction(HType::Tagged()), inputs_(4, zone) {
set_representation(Representation::Tagged());
- if (arg1) {
- inputs_.Add(NULL, zone);
- SetOperandAt(0, arg1);
- }
- if (arg2) {
- inputs_.Add(NULL, zone);
- SetOperandAt(1, arg2);
- }
- if (arg3) {
- inputs_.Add(NULL, zone);
- SetOperandAt(2, arg3);
- }
- if (arg4) {
- inputs_.Add(NULL, zone);
- SetOperandAt(3, arg4);
- }
}
- Zone* zone_;
ZoneList<HValue*> inputs_;
};
if_found.Else();
{
// Cache miss, fallback to runtime.
- Add<HPushArguments>(zone(), object);
+ Add<HPushArguments>(object);
Push(Add<HCallRuntime>(
isolate()->factory()->empty_string(),
Runtime::FunctionForId(Runtime::kHiddenNumberToStringSkipCache),
if_sameencodingandsequential.Else();
{
// Fallback to the runtime to add the two strings.
- Add<HPushArguments>(zone(), left, right);
+ Add<HPushArguments>(left, right);
Push(Add<HCallRuntime>(
isolate()->factory()->empty_string(),
Runtime::FunctionForId(Runtime::kHiddenStringAdd),
arguments.Add(Pop(), zone());
}
- HPushArguments* push_args = New<HPushArguments>(zone());
+ HPushArguments* push_args = New<HPushArguments>();
while (!arguments.is_empty()) {
- push_args->AddArgument(arguments.RemoveLast());
+ push_args->AddInput(arguments.RemoveLast());
}
AddInstruction(push_args);
}
flags |= expr->has_function()
? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags;
- Add<HPushArguments>(zone(),
- Add<HConstant>(closure_literals),
+ Add<HPushArguments>(Add<HConstant>(closure_literals),
Add<HConstant>(literal_index),
Add<HConstant>(constant_properties),
Add<HConstant>(flags));
: ArrayLiteral::kNoFlags;
flags |= ArrayLiteral::kDisableMementos;
- Add<HPushArguments>(zone(),
- Add<HConstant>(literals),
+ Add<HPushArguments>(Add<HConstant>(literals),
Add<HConstant>(literal_index),
Add<HConstant>(constants),
Add<HConstant>(flags));
HValue* value = environment()->Pop();
if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position());
- Add<HPushArguments>(zone(), value);
+ Add<HPushArguments>(value);
Add<HCallRuntime>(isolate()->factory()->empty_string(),
Runtime::FunctionForId(Runtime::kHiddenThrow), 1);
Add<HSimulate>(expr->id());
HInstruction* insert_after = entry;
for (int i = 0; i < arguments_values->length(); i++) {
HValue* argument = arguments_values->at(i);
- HInstruction* push_argument = New<HPushArguments>(zone(), argument);
+ HInstruction* push_argument = New<HPushArguments>(argument);
push_argument->InsertAfter(insert_after);
insert_after = push_argument;
}
ASSERT_EQ(NULL, receiver);
// Receiver is on expression stack.
receiver = Pop();
- Add<HPushArguments>(zone(), receiver);
+ Add<HPushArguments>(receiver);
break;
case kCallApiSetter:
{
// Receiver and value are on expression stack.
HValue* value = Pop();
receiver = Pop();
- Add<HPushArguments>(zone(), receiver, value);
+ Add<HPushArguments>(receiver, value);
break;
}
}
HValue* key = Pop();
HValue* obj = Pop();
HValue* function = AddLoadJSBuiltin(Builtins::DELETE);
- Add<HPushArguments>(zone(),
- obj, key, Add<HConstant>(function_strict_mode()));
+ Add<HPushArguments>(obj, key, Add<HConstant>(function_strict_mode()));
// TODO(olivf) InvokeFunction produces a check for the parameter count,
// even though we are certain to pass the correct number of arguments here.
HInstruction* instr = New<HInvokeFunction>(function, 3);
} else if (!left_type->Is(Type::String())) {
ASSERT(right_type->Is(Type::String()));
HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT);
- Add<HPushArguments>(zone(), left, right);
+ Add<HPushArguments>(left, right);
return AddUncasted<HInvokeFunction>(function, 2);
}
} else if (!right_type->Is(Type::String())) {
ASSERT(left_type->Is(Type::String()));
HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT);
- Add<HPushArguments>(zone(), left, right);
+ Add<HPushArguments>(left, right);
return AddUncasted<HInvokeFunction>(function, 2);
}
// operation in optimized code, which is more expensive, than a stub call.
if (graph()->info()->IsStub() && is_non_primitive) {
HValue* function = AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op));
- Add<HPushArguments>(zone(), left, right);
+ Add<HPushArguments>(left, right);
instr = AddUncasted<HInvokeFunction>(function, 2);
} else {
switch (op) {
UNREACHABLE();
} else if (op == Token::IN) {
HValue* function = AddLoadJSBuiltin(Builtins::IN);
- Add<HPushArguments>(zone(), left, right);
+ Add<HPushArguments>(left, right);
// TODO(olivf) InvokeFunction produces a check for the parameter count,
// even though we are certain to pass the correct number of arguments here.
HInstruction* result = New<HInvokeFunction>(function, 2);