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

Side by Side Diff: runtime/vm/aot_optimizer.h

Issue 2856543002: Use off-heap data for class check instructions (Closed)
Patch Set: Feedback from Slava: rejig inheritance of CallTargets Created 3 years, 7 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 | runtime/vm/aot_optimizer.cc » ('j') | runtime/vm/aot_optimizer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_AOT_OPTIMIZER_H_ 5 #ifndef RUNTIME_VM_AOT_OPTIMIZER_H_
6 #define RUNTIME_VM_AOT_OPTIMIZER_H_ 6 #define RUNTIME_VM_AOT_OPTIMIZER_H_
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Instruction* instr, 46 Instruction* instr,
47 Environment* env, 47 Environment* env,
48 FlowGraph::UseKind use_kind) { 48 FlowGraph::UseKind use_kind) {
49 flow_graph_->InsertBefore(next, instr, env, use_kind); 49 flow_graph_->InsertBefore(next, instr, env, use_kind);
50 } 50 }
51 51
52 private: 52 private:
53 // Attempt to build ICData for call using propagated class-ids. 53 // Attempt to build ICData for call using propagated class-ids.
54 bool TryCreateICData(InstanceCallInstr* call); 54 bool TryCreateICData(InstanceCallInstr* call);
55 55
56 bool TryReplaceWithIndexedOp(InstanceCallInstr* call); 56 bool TryReplaceWithIndexedOp(InstanceCallInstr* call,
57 const ICData* unary_checks);
57 58
58 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); 59 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
59 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); 60 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
60 61
61 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind); 62 bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind);
62 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind); 63 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind);
63 64
64 bool TryInlineFieldAccess(InstanceCallInstr* call); 65 bool TryInlineFieldAccess(InstanceCallInstr* call);
65 bool TryInlineInstanceGetter(InstanceCallInstr* call); 66 bool TryInlineInstanceGetter(InstanceCallInstr* call);
66 bool TryInlineInstanceSetter(InstanceCallInstr* call, 67 bool TryInlineInstanceSetter(InstanceCallInstr* call,
67 const ICData& unary_ic_data); 68 const ICData& unary_ic_data);
68 69
69 bool TryInlineInstanceMethod(InstanceCallInstr* call); 70 bool TryInlineInstanceMethod(InstanceCallInstr* call);
70 void ReplaceWithInstanceOf(InstanceCallInstr* instr); 71 void ReplaceWithInstanceOf(InstanceCallInstr* instr);
71 bool TypeCheckAsClassEquality(const AbstractType& type); 72 bool TypeCheckAsClassEquality(const AbstractType& type);
72 void ReplaceWithTypeCast(InstanceCallInstr* instr); 73 void ReplaceWithTypeCast(InstanceCallInstr* instr);
73 74
74 bool TryReplaceInstanceCallWithInline(InstanceCallInstr* call); 75 bool TryReplaceInstanceCallWithInline(InstanceCallInstr* call);
75 76
76 // Insert a check of 'to_check' determined by 'unary_checks'. If the 77 // Insert a check of 'to_check' determined by 'unary_checks'. If the
77 // check fails it will deoptimize to 'deopt_id' using the deoptimization 78 // check fails it will deoptimize to 'deopt_id' using the deoptimization
78 // environment 'deopt_environment'. The check is inserted immediately 79 // environment 'deopt_environment'. The check is inserted immediately
79 // before 'insert_before'. 80 // before 'insert_before'.
80 void AddCheckClass(Definition* to_check, 81 void AddCheckClass(Definition* to_check,
81 const ICData& unary_checks, 82 const Cids& cids,
82 intptr_t deopt_id, 83 intptr_t deopt_id,
83 Environment* deopt_environment, 84 Environment* deopt_environment,
84 Instruction* insert_before); 85 Instruction* insert_before);
85 Instruction* GetCheckClass(Definition* to_check,
86 const ICData& unary_checks,
87 intptr_t deopt_id,
88 TokenPosition token_pos);
89 86
90 // Insert a Smi check if needed. 87 // Insert a Smi check if needed.
91 void AddCheckSmi(Definition* to_check, 88 void AddCheckSmi(Definition* to_check,
92 intptr_t deopt_id, 89 intptr_t deopt_id,
93 Environment* deopt_environment, 90 Environment* deopt_environment,
94 Instruction* insert_before); 91 Instruction* insert_before);
95 92
96 // Add a class check for a call's first argument immediately before the 93 // Add a class check for a call's nth argument immediately before the
97 // call, using the call's IC data to determine the check, and the call's 94 // call, using the call's IC data to determine the check, and the call's
98 // deopt ID and deoptimization environment if the check fails. 95 // deopt ID and deoptimization environment if the check fails.
99 void AddReceiverCheck(InstanceCallInstr* call); 96 void AddChecksToArgNr(InstanceCallInstr* call,
Vyacheslav Egorov (Google) 2017/05/09 21:07:27 s/ToArgNr/ForArgNr/ ?
erikcorry 2017/05/10 08:47:43 Done.
97 Definition* instr,
98 int argument_number);
99
100 // Convenience version of AddChecksToArgNr that works on the 0th argument
101 // (receiver).
102 void AddReceiverCheck(InstanceCallInstr* call) {
103 AddChecksToArgNr(call, call->ArgumentAt(0), /* arg_number = */ 0);
104 }
100 105
101 void ReplaceCall(Definition* call, Definition* replacement); 106 void ReplaceCall(Definition* call, Definition* replacement);
102 107
103 bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call); 108 bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call);
104 bool TryReplaceWithHaveSameRuntimeType(InstanceCallInstr* call); 109 bool TryReplaceWithHaveSameRuntimeType(InstanceCallInstr* call);
105 110
106 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, 111 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call,
107 RawFunction::Kind kind) const; 112 RawFunction::Kind kind) const;
108 113
109 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind); 114 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
(...skipping 29 matching lines...) Expand all
139 144
140 bool has_unique_no_such_method_; 145 bool has_unique_no_such_method_;
141 146
142 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); 147 DISALLOW_COPY_AND_ASSIGN(AotOptimizer);
143 }; 148 };
144 149
145 150
146 } // namespace dart 151 } // namespace dart
147 152
148 #endif // RUNTIME_VM_AOT_OPTIMIZER_H_ 153 #endif // RUNTIME_VM_AOT_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/aot_optimizer.cc » ('j') | runtime/vm/aot_optimizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698