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

Side by Side Diff: src/crankshaft/hydrogen.h

Issue 1761023003: [crankshaft] Correctly propagate TailCallMode in case of inlining. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_
6 #define V8_CRANKSHAFT_HYDROGEN_H_ 6 #define V8_CRANKSHAFT_HYDROGEN_H_
7 7
8 #include "src/accessors.h" 8 #include "src/accessors.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 void BuildBranch(HValue* value); 842 void BuildBranch(HValue* value);
843 843
844 Expression* condition_; 844 Expression* condition_;
845 HBasicBlock* if_true_; 845 HBasicBlock* if_true_;
846 HBasicBlock* if_false_; 846 HBasicBlock* if_false_;
847 }; 847 };
848 848
849 849
850 class FunctionState final { 850 class FunctionState final {
851 public: 851 public:
852 FunctionState(HOptimizedGraphBuilder* owner, 852 FunctionState(HOptimizedGraphBuilder* owner, CompilationInfo* info,
853 CompilationInfo* info, 853 InliningKind inlining_kind, int inlining_id,
854 InliningKind inlining_kind, 854 TailCallMode tail_call_mode);
855 int inlining_id);
856 ~FunctionState(); 855 ~FunctionState();
857 856
858 CompilationInfo* compilation_info() { return compilation_info_; } 857 CompilationInfo* compilation_info() { return compilation_info_; }
859 AstContext* call_context() { return call_context_; } 858 AstContext* call_context() { return call_context_; }
860 InliningKind inlining_kind() const { return inlining_kind_; } 859 InliningKind inlining_kind() const { return inlining_kind_; }
861 HBasicBlock* function_return() { return function_return_; } 860 HBasicBlock* function_return() { return function_return_; }
862 TestContext* test_context() { return test_context_; } 861 TestContext* test_context() { return test_context_; }
863 void ClearInlinedTestContext() { 862 void ClearInlinedTestContext() {
864 delete test_context_; 863 delete test_context_;
865 test_context_ = NULL; 864 test_context_ = NULL;
866 } 865 }
867 866
868 FunctionState* outer() { return outer_; } 867 FunctionState* outer() { return outer_; }
869 868
869 TailCallMode ComputeTailCallMode(TailCallMode tail_call_mode) const {
870 if (tail_call_mode_ == TailCallMode::kDisallow) return tail_call_mode_;
871 return tail_call_mode;
872 }
873
870 HEnterInlined* entry() { return entry_; } 874 HEnterInlined* entry() { return entry_; }
871 void set_entry(HEnterInlined* entry) { entry_ = entry; } 875 void set_entry(HEnterInlined* entry) { entry_ = entry; }
872 876
873 HArgumentsObject* arguments_object() { return arguments_object_; } 877 HArgumentsObject* arguments_object() { return arguments_object_; }
874 void set_arguments_object(HArgumentsObject* arguments_object) { 878 void set_arguments_object(HArgumentsObject* arguments_object) {
875 arguments_object_ = arguments_object; 879 arguments_object_ = arguments_object;
876 } 880 }
877 881
878 HArgumentsElements* arguments_elements() { return arguments_elements_; } 882 HArgumentsElements* arguments_elements() { return arguments_elements_; }
879 void set_arguments_elements(HArgumentsElements* arguments_elements) { 883 void set_arguments_elements(HArgumentsElements* arguments_elements) {
880 arguments_elements_ = arguments_elements; 884 arguments_elements_ = arguments_elements;
881 } 885 }
882 886
883 bool arguments_pushed() { return arguments_elements() != NULL; } 887 bool arguments_pushed() { return arguments_elements() != NULL; }
884 888
885 int inlining_id() const { return inlining_id_; } 889 int inlining_id() const { return inlining_id_; }
886 890
887 private: 891 private:
888 HOptimizedGraphBuilder* owner_; 892 HOptimizedGraphBuilder* owner_;
889 893
890 CompilationInfo* compilation_info_; 894 CompilationInfo* compilation_info_;
891 895
892 // During function inlining, expression context of the call being 896 // During function inlining, expression context of the call being
893 // inlined. NULL when not inlining. 897 // inlined. NULL when not inlining.
894 AstContext* call_context_; 898 AstContext* call_context_;
895 899
896 // The kind of call which is currently being inlined. 900 // The kind of call which is currently being inlined.
897 InliningKind inlining_kind_; 901 InliningKind inlining_kind_;
898 902
903 // Defines whether the calls with TailCallMode::kAllow in the function body
904 // can be generated as tail calls.
905 TailCallMode tail_call_mode_;
906
899 // When inlining in an effect or value context, this is the return block. 907 // When inlining in an effect or value context, this is the return block.
900 // It is NULL otherwise. When inlining in a test context, there are a 908 // It is NULL otherwise. When inlining in a test context, there are a
901 // pair of return blocks in the context. When not inlining, there is no 909 // pair of return blocks in the context. When not inlining, there is no
902 // local return point. 910 // local return point.
903 HBasicBlock* function_return_; 911 HBasicBlock* function_return_;
904 912
905 // When inlining a call in a test context, a context containing a pair of 913 // When inlining a call in a test context, a context containing a pair of
906 // return blocks. NULL in all other cases. 914 // return blocks. NULL in all other cases.
907 TestContext* test_context_; 915 TestContext* test_context_;
908 916
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 HValue* search_element, 2397 HValue* search_element,
2390 ElementsKind kind, 2398 ElementsKind kind,
2391 ArrayIndexOfMode mode); 2399 ArrayIndexOfMode mode);
2392 2400
2393 HValue* ImplicitReceiverFor(HValue* function, 2401 HValue* ImplicitReceiverFor(HValue* function,
2394 Handle<JSFunction> target); 2402 Handle<JSFunction> target);
2395 2403
2396 int InliningAstSize(Handle<JSFunction> target); 2404 int InliningAstSize(Handle<JSFunction> target);
2397 bool TryInline(Handle<JSFunction> target, int arguments_count, 2405 bool TryInline(Handle<JSFunction> target, int arguments_count,
2398 HValue* implicit_return_value, BailoutId ast_id, 2406 HValue* implicit_return_value, BailoutId ast_id,
2399 BailoutId return_id, InliningKind inlining_kind); 2407 BailoutId return_id, InliningKind inlining_kind,
2408 TailCallMode syntactic_tail_call_mode);
2400 2409
2401 bool TryInlineCall(Call* expr); 2410 bool TryInlineCall(Call* expr);
2402 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value); 2411 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value);
2403 bool TryInlineGetter(Handle<Object> getter, Handle<Map> receiver_map, 2412 bool TryInlineGetter(Handle<Object> getter, Handle<Map> receiver_map,
2404 BailoutId ast_id, BailoutId return_id); 2413 BailoutId ast_id, BailoutId return_id);
2405 bool TryInlineSetter(Handle<Object> setter, Handle<Map> receiver_map, 2414 bool TryInlineSetter(Handle<Object> setter, Handle<Map> receiver_map,
2406 BailoutId id, BailoutId assignment_id, 2415 BailoutId id, BailoutId assignment_id,
2407 HValue* implicit_return_value); 2416 HValue* implicit_return_value);
2408 bool TryInlineIndirectCall(Handle<JSFunction> function, Call* expr, 2417 bool TryInlineIndirectCall(Handle<JSFunction> function, Call* expr,
2409 int arguments_count); 2418 int arguments_count);
(...skipping 10 matching lines...) Expand all
2420 bool TryInlineApiMethodCall(Call* expr, 2429 bool TryInlineApiMethodCall(Call* expr,
2421 HValue* receiver, 2430 HValue* receiver,
2422 SmallMapList* receiver_types); 2431 SmallMapList* receiver_types);
2423 bool TryInlineApiFunctionCall(Call* expr, HValue* receiver); 2432 bool TryInlineApiFunctionCall(Call* expr, HValue* receiver);
2424 bool TryInlineApiGetter(Handle<Object> function, Handle<Map> receiver_map, 2433 bool TryInlineApiGetter(Handle<Object> function, Handle<Map> receiver_map,
2425 BailoutId ast_id); 2434 BailoutId ast_id);
2426 bool TryInlineApiSetter(Handle<Object> function, Handle<Map> receiver_map, 2435 bool TryInlineApiSetter(Handle<Object> function, Handle<Map> receiver_map,
2427 BailoutId ast_id); 2436 BailoutId ast_id);
2428 bool TryInlineApiCall(Handle<Object> function, HValue* receiver, 2437 bool TryInlineApiCall(Handle<Object> function, HValue* receiver,
2429 SmallMapList* receiver_maps, int argc, BailoutId ast_id, 2438 SmallMapList* receiver_maps, int argc, BailoutId ast_id,
2430 ApiCallType call_type); 2439 ApiCallType call_type,
2440 TailCallMode syntactic_tail_call_mode);
2431 static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map); 2441 static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map);
2432 static bool CanInlineArrayResizeOperation(Handle<Map> receiver_map); 2442 static bool CanInlineArrayResizeOperation(Handle<Map> receiver_map);
2433 2443
2434 // If --trace-inlining, print a line of the inlining trace. Inlining 2444 // If --trace-inlining, print a line of the inlining trace. Inlining
2435 // succeeded if the reason string is NULL and failed if there is a 2445 // succeeded if the reason string is NULL and failed if there is a
2436 // non-NULL reason string. 2446 // non-NULL reason string.
2437 void TraceInline(Handle<JSFunction> target, 2447 void TraceInline(Handle<JSFunction> target, Handle<JSFunction> caller,
2438 Handle<JSFunction> caller, 2448 const char* failure_reason,
2439 const char* failure_reason); 2449 TailCallMode tail_call_mode = TailCallMode::kDisallow);
2440 2450
2441 void HandleGlobalVariableAssignment(Variable* var, HValue* value, 2451 void HandleGlobalVariableAssignment(Variable* var, HValue* value,
2442 FeedbackVectorSlot slot, 2452 FeedbackVectorSlot slot,
2443 BailoutId ast_id); 2453 BailoutId ast_id);
2444 2454
2445 void HandlePropertyAssignment(Assignment* expr); 2455 void HandlePropertyAssignment(Assignment* expr);
2446 void HandleCompoundAssignment(Assignment* expr); 2456 void HandleCompoundAssignment(Assignment* expr);
2447 void HandlePolymorphicNamedFieldAccess( 2457 void HandlePolymorphicNamedFieldAccess(
2448 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, 2458 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot,
2449 BailoutId ast_id, BailoutId return_id, HValue* object, HValue* value, 2459 BailoutId ast_id, BailoutId return_id, HValue* object, HValue* value,
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 2822
2813 void BuildEmitFixedArray(Handle<FixedArrayBase> elements, 2823 void BuildEmitFixedArray(Handle<FixedArrayBase> elements,
2814 ElementsKind kind, 2824 ElementsKind kind,
2815 HValue* object_elements, 2825 HValue* object_elements,
2816 AllocationSiteUsageContext* site_context); 2826 AllocationSiteUsageContext* site_context);
2817 2827
2818 void AddCheckPrototypeMaps(Handle<JSObject> holder, 2828 void AddCheckPrototypeMaps(Handle<JSObject> holder,
2819 Handle<Map> receiver_map); 2829 Handle<Map> receiver_map);
2820 2830
2821 HInstruction* NewCallFunction(HValue* function, int argument_count, 2831 HInstruction* NewCallFunction(HValue* function, int argument_count,
2822 ConvertReceiverMode convert_mode); 2832 ConvertReceiverMode convert_mode,
2833 TailCallMode tail_call_mode);
2823 2834
2824 HInstruction* NewCallFunctionViaIC(HValue* function, int argument_count, 2835 HInstruction* NewCallFunctionViaIC(HValue* function, int argument_count,
2825 ConvertReceiverMode convert_mode, 2836 ConvertReceiverMode convert_mode,
2837 TailCallMode tail_call_mode,
2826 FeedbackVectorSlot slot); 2838 FeedbackVectorSlot slot);
2827 2839
2828 HInstruction* NewCallConstantFunction(Handle<JSFunction> target, 2840 HInstruction* NewCallConstantFunction(Handle<JSFunction> target,
2829 int argument_count); 2841 int argument_count,
2842 TailCallMode tail_call_mode);
2830 2843
2831 bool CanBeFunctionApplyArguments(Call* expr); 2844 bool CanBeFunctionApplyArguments(Call* expr);
2832 2845
2833 // The translation state of the currently-being-translated function. 2846 // The translation state of the currently-being-translated function.
2834 FunctionState* function_state_; 2847 FunctionState* function_state_;
2835 2848
2836 // The base of the function state stack. 2849 // The base of the function state stack.
2837 FunctionState initial_function_state_; 2850 FunctionState initial_function_state_;
2838 2851
2839 // Expression context of the currently visited subexpression. NULL when 2852 // Expression context of the currently visited subexpression. NULL when
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 3036
3024 private: 3037 private:
3025 HGraphBuilder* builder_; 3038 HGraphBuilder* builder_;
3026 }; 3039 };
3027 3040
3028 3041
3029 } // namespace internal 3042 } // namespace internal
3030 } // namespace v8 3043 } // namespace v8
3031 3044
3032 #endif // V8_CRANKSHAFT_HYDROGEN_H_ 3045 #endif // V8_CRANKSHAFT_HYDROGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698