Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 23dbbd289c6c5d5a9e07697368e9fba6ab05e22d..ab286558cd6990f7bcfe3d7d5c00c75d06f3cd72 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -77,12 +77,10 @@ class LChunkBuilder; |
V(BoundsCheck) \ |
V(BoundsCheckBaseIndexInformation) \ |
V(Branch) \ |
- V(CallConstantFunction) \ |
+ V(CallWithDescriptor) \ |
+ V(CallJSFunction) \ |
V(CallFunction) \ |
V(CallGlobal) \ |
- V(CallKeyed) \ |
- V(CallKnownGlobal) \ |
- V(CallNamed) \ |
V(CallNew) \ |
V(CallNewArray) \ |
V(CallRuntime) \ |
@@ -2288,112 +2286,182 @@ class HBinaryCall : public HCall<2> { |
}; |
-class HInvokeFunction V8_FINAL : public HBinaryCall { |
+class HCallJSFunction V8_FINAL : public HCall<2> { |
public: |
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
- |
- HInvokeFunction(HValue* context, |
- HValue* function, |
- Handle<JSFunction> known_function, |
- int argument_count) |
- : HBinaryCall(context, function, argument_count), |
- known_function_(known_function) { |
- formal_parameter_count_ = known_function.is_null() |
- ? 0 : known_function->shared()->formal_parameter_count(); |
- } |
- |
- static HInvokeFunction* New(Zone* zone, |
+ static HCallJSFunction* New(Zone* zone, |
HValue* context, |
HValue* function, |
- Handle<JSFunction> known_function, |
- int argument_count) { |
- return new(zone) HInvokeFunction(context, function, |
- known_function, argument_count); |
+ HValue* call_kind_value, |
+ int argument_count, |
+ bool pass_argument_count) { |
+ return new(zone) HCallJSFunction(function, call_kind_value, |
Toon Verwaest
2013/12/18 16:11:41
nit:
return new(zone) HCallJSFunction(
functio
Jarin
2013/12/30 15:15:47
Done.
|
+ argument_count, pass_argument_count); |
} |
- HValue* context() { return first(); } |
- HValue* function() { return second(); } |
- Handle<JSFunction> known_function() { return known_function_; } |
- int formal_parameter_count() const { return formal_parameter_count_; } |
+ HValue* function() { return OperandAt(0); } |
+ HValue* call_kind() { return OperandAt(1); } |
- DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
+ virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
+ |
+ virtual Representation RequiredInputRepresentation( |
+ int index) V8_FINAL V8_OVERRIDE { |
+ if (index == 0) { |
+ return Representation::Tagged(); |
+ } else if (index == 1) { |
Toon Verwaest
2013/12/18 16:11:41
What about just
if (index == 0) return Representa
Jarin
2013/12/30 15:15:47
I quite like to list the options for index explici
|
+ return Representation::Smi(); |
+ } |
+ UNREACHABLE(); |
+ return Representation::None(); |
+ } |
+ |
+ bool pass_argument_count() const { return pass_argument_count_; } |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
private: |
- HInvokeFunction(HValue* context, HValue* function, int argument_count) |
- : HBinaryCall(context, function, argument_count) { |
+ // The argument count includes the receiver. |
+ HCallJSFunction(HValue* function, HValue* call_kind, int argument_count, |
Toon Verwaest
2013/12/18 16:11:41
Arguments of function declarations on separate lin
Jarin
2013/12/30 15:15:47
Done.
|
+ bool pass_argument_count) |
+ : HCall<2>(argument_count), |
Toon Verwaest
2013/12/18 16:11:41
You can put these on a single line if they fit.
Jarin
2013/12/30 15:15:47
They do not fit (esp. after the rebase change I ha
|
+ pass_argument_count_(pass_argument_count) { |
+ SetOperandAt(0, function); |
+ SetOperandAt(1, call_kind); |
} |
- Handle<JSFunction> known_function_; |
- int formal_parameter_count_; |
+ bool pass_argument_count_; |
}; |
-class HCallConstantFunction V8_FINAL : public HCall<0> { |
+class HCallWithDescriptor V8_FINAL : public HInstruction { |
public: |
- DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction, |
- Handle<JSFunction>, |
- int); |
+ static HCallWithDescriptor* New(Zone* zone, HValue* context, |
+ HValue* target, |
+ int argument_count, |
+ const CodeStubInterfaceDescriptor* descriptor, |
+ Vector<HValue*>& operands) { |
+ ASSERT(operands.length() == descriptor->environment_length()); |
+ HCallWithDescriptor* res = |
+ new(zone) HCallWithDescriptor(target, argument_count, |
+ descriptor, operands, zone); |
+ return res; |
+ } |
- Handle<JSFunction> function() const { return function_; } |
- int formal_parameter_count() const { return formal_parameter_count_; } |
+ virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } |
+ virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { |
+ return values_[index]; |
+ } |
- bool IsApplyFunction() const { |
- return function_->code() == |
- function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); |
+ virtual Representation RequiredInputRepresentation( |
+ int index) V8_FINAL V8_OVERRIDE { |
+ if (index == 0) { |
+ return Representation::Tagged(); |
+ } else { |
+ int par_index = index - 1; |
+ if (par_index < descriptor_->environment_length()) { |
Toon Verwaest
2013/12/18 16:11:41
Why not just ASSERT(par_index < descriptor_->envir
Jarin
2013/12/30 15:15:47
Done.
|
+ return descriptor_->GetParameterRepresentation(par_index); |
+ } |
+ UNREACHABLE(); |
+ return Representation::None(); |
+ } |
} |
- virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
+ DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
- virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
- return Representation::None(); |
+ virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { |
+ return HType::Tagged(); |
} |
- DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
- |
- private: |
- HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
- : HCall<0>(argument_count), |
- function_(function), |
- formal_parameter_count_(function->shared()->formal_parameter_count()) {} |
+ virtual int argument_count() const { |
+ return argument_count_; |
+ } |
- Handle<JSFunction> function_; |
- int formal_parameter_count_; |
-}; |
+ virtual int argument_delta() const V8_OVERRIDE { |
+ return -argument_count_; |
+ } |
+ const CodeStubInterfaceDescriptor* descriptor() const { |
+ return descriptor_; |
+ } |
-class HCallKeyed V8_FINAL : public HBinaryCall { |
- public: |
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); |
+ HValue* target() { |
+ return OperandAt(0); |
+ } |
- HValue* context() { return first(); } |
- HValue* key() { return second(); } |
+ virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } |
- DECLARE_CONCRETE_INSTRUCTION(CallKeyed) |
+ virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
private: |
- HCallKeyed(HValue* context, HValue* key, int argument_count) |
- : HBinaryCall(context, key, argument_count) { |
+ // The argument count includes the receiver. |
+ HCallWithDescriptor(HValue* target, |
+ int argument_count, |
+ const CodeStubInterfaceDescriptor* descriptor, |
+ Vector<HValue*>& operands, |
+ Zone* zone) |
+ : descriptor_(descriptor), |
+ values_(descriptor->environment_length() + 1, zone) { |
+ argument_count_ = argument_count; |
+ AddOperand(target, zone); |
+ for (int i = 0; i < operands.length(); i++) { |
+ AddOperand(operands[i], zone); |
+ } |
+ this->set_representation(Representation::Tagged()); |
+ this->SetAllSideEffects(); |
+ } |
+ |
+ void AddOperand(HValue* v, Zone* zone) { |
+ values_.Add(NULL, zone); |
+ SetOperandAt(values_.length() - 1, v); |
} |
+ |
+ void InternalSetOperandAt(int index, |
+ HValue* value) V8_FINAL V8_OVERRIDE { |
+ values_[index] = value; |
+ } |
+ |
+ const CodeStubInterfaceDescriptor* descriptor_; |
+ ZoneList<HValue*> values_; |
+ int argument_count_; |
}; |
-class HCallNamed V8_FINAL : public HUnaryCall { |
+class HInvokeFunction V8_FINAL : public HBinaryCall { |
public: |
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int); |
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
- virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
+ HInvokeFunction(HValue* context, |
+ HValue* function, |
+ Handle<JSFunction> known_function, |
+ int argument_count) |
+ : HBinaryCall(context, function, argument_count), |
+ known_function_(known_function) { |
+ formal_parameter_count_ = known_function.is_null() |
+ ? 0 : known_function->shared()->formal_parameter_count(); |
+ } |
- HValue* context() { return value(); } |
- Handle<String> name() const { return name_; } |
+ static HInvokeFunction* New(Zone* zone, |
+ HValue* context, |
+ HValue* function, |
+ Handle<JSFunction> known_function, |
+ int argument_count) { |
+ return new(zone) HInvokeFunction(context, function, |
+ known_function, argument_count); |
+ } |
+ |
+ HValue* context() { return first(); } |
+ HValue* function() { return second(); } |
+ Handle<JSFunction> known_function() { return known_function_; } |
+ int formal_parameter_count() const { return formal_parameter_count_; } |
- DECLARE_CONCRETE_INSTRUCTION(CallNamed) |
+ DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
private: |
- HCallNamed(HValue* context, Handle<String> name, int argument_count) |
- : HUnaryCall(context, argument_count), name_(name) { |
+ HInvokeFunction(HValue* context, HValue* function, int argument_count) |
+ : HBinaryCall(context, function, argument_count) { |
} |
- Handle<String> name_; |
+ Handle<JSFunction> known_function_; |
+ int formal_parameter_count_; |
}; |
@@ -2452,32 +2520,6 @@ class HCallGlobal V8_FINAL : public HUnaryCall { |
}; |
-class HCallKnownGlobal V8_FINAL : public HCall<0> { |
- public: |
- DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int); |
- |
- virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
- |
- Handle<JSFunction> target() const { return target_; } |
- int formal_parameter_count() const { return formal_parameter_count_; } |
- |
- virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
- return Representation::None(); |
- } |
- |
- DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
- |
- private: |
- HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
- : HCall<0>(argument_count), |
- target_(target), |
- formal_parameter_count_(target->shared()->formal_parameter_count()) { } |
- |
- Handle<JSFunction> target_; |
- int formal_parameter_count_; |
-}; |
- |
- |
class HCallNew V8_FINAL : public HBinaryCall { |
public: |
DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |