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

Unified Diff: src/crankshaft/hydrogen-instructions.h

Issue 1760253003: [crankshaft] Support ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-crank-2
Patch Set: Addressing comments Created 4 years, 9 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/crankshaft/hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen-instructions.h
diff --git a/src/crankshaft/hydrogen-instructions.h b/src/crankshaft/hydrogen-instructions.h
index da21400cea5a8410d92ae12c8a304629935a958d..1ccc9dd0a88bdc975032c3d25ec76e33ada3800a 100644
--- a/src/crankshaft/hydrogen-instructions.h
+++ b/src/crankshaft/hydrogen-instructions.h
@@ -2307,49 +2307,50 @@ class HCallWithDescriptor final : public HInstruction {
class HInvokeFunction final : public HBinaryCall {
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()->internal_formal_parameter_count();
- has_stack_check_ = !known_function.is_null() &&
- (known_function->code()->kind() == Code::FUNCTION ||
- known_function->code()->kind() == Code::OPTIMIZED_FUNCTION);
- }
-
- static HInvokeFunction* New(Isolate* isolate, Zone* zone, HValue* context,
- HValue* function,
- Handle<JSFunction> known_function,
- int argument_count) {
- return new(zone) HInvokeFunction(context, function,
- known_function, argument_count);
- }
+ DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HInvokeFunction, HValue*,
+ Handle<JSFunction>, int,
+ TailCallMode);
HValue* context() { return first(); }
HValue* function() { return second(); }
Handle<JSFunction> known_function() { return known_function_; }
int formal_parameter_count() const { return formal_parameter_count_; }
- bool HasStackCheck() final { return has_stack_check_; }
+ bool HasStackCheck() final { return HasStackCheckField::decode(bit_field_); }
+ TailCallMode tail_call_mode() const {
+ return TailCallModeField::decode(bit_field_);
+ }
DECLARE_CONCRETE_INSTRUCTION(InvokeFunction)
private:
- HInvokeFunction(HValue* context, HValue* function, int argument_count)
+ void set_has_stack_check(bool has_stack_check) {
+ bit_field_ = HasStackCheckField::update(bit_field_, has_stack_check);
+ }
+
+ HInvokeFunction(HValue* context, HValue* function,
+ Handle<JSFunction> known_function, int argument_count,
+ TailCallMode tail_call_mode)
: HBinaryCall(context, function, argument_count),
- has_stack_check_(false) {
+ known_function_(known_function),
+ bit_field_(TailCallModeField::encode(tail_call_mode)) {
+ formal_parameter_count_ =
+ known_function.is_null()
+ ? 0
+ : known_function->shared()->internal_formal_parameter_count();
+ set_has_stack_check(
+ !known_function.is_null() &&
+ (known_function->code()->kind() == Code::FUNCTION ||
+ known_function->code()->kind() == Code::OPTIMIZED_FUNCTION));
}
Handle<JSFunction> known_function_;
int formal_parameter_count_;
- bool has_stack_check_;
+
+ class HasStackCheckField : public BitField<bool, 0, 1> {};
+ class TailCallModeField
+ : public BitField<TailCallMode, HasStackCheckField::kNext, 1> {};
+ uint32_t bit_field_;
};
@@ -3785,8 +3786,8 @@ class HWrapReceiver final : public HTemplateInstruction<2> {
class HApplyArguments final : public HTemplateInstruction<4> {
public:
- DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*,
- HValue*);
+ DECLARE_INSTRUCTION_FACTORY_P5(HApplyArguments, HValue*, HValue*, HValue*,
+ HValue*, TailCallMode);
Representation RequiredInputRepresentation(int index) override {
// The length is untagged, all other inputs are tagged.
@@ -3800,13 +3801,16 @@ class HApplyArguments final : public HTemplateInstruction<4> {
HValue* length() { return OperandAt(2); }
HValue* elements() { return OperandAt(3); }
+ TailCallMode tail_call_mode() const {
+ return TailCallModeField::decode(bit_field_);
+ }
+
DECLARE_CONCRETE_INSTRUCTION(ApplyArguments)
private:
- HApplyArguments(HValue* function,
- HValue* receiver,
- HValue* length,
- HValue* elements) {
+ HApplyArguments(HValue* function, HValue* receiver, HValue* length,
+ HValue* elements, TailCallMode tail_call_mode)
+ : bit_field_(TailCallModeField::encode(tail_call_mode)) {
set_representation(Representation::Tagged());
SetOperandAt(0, function);
SetOperandAt(1, receiver);
@@ -3814,6 +3818,9 @@ class HApplyArguments final : public HTemplateInstruction<4> {
SetOperandAt(3, elements);
SetAllSideEffects();
}
+
+ class TailCallModeField : public BitField<TailCallMode, 0, 1> {};
+ uint32_t bit_field_;
};
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698