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

Side by Side Diff: src/code-stub-assembler.h

Issue 2617393002: [stubs] Ensure generated CalculateNewElementsCapacity is identical to runtime version (Closed)
Patch Set: Review feedback Created 3 years, 11 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/code-stub-assembler.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_CODE_STUB_ASSEMBLER_H_ 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_
6 #define V8_CODE_STUB_ASSEMBLER_H_ 6 #define V8_CODE_STUB_ASSEMBLER_H_
7 7
8 #include <functional> 8 #include <functional>
9 9
10 #include "src/compiler/code-assembler.h" 10 #include "src/compiler/code-assembler.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Smi operations. 165 // Smi operations.
166 #define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \ 166 #define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \
167 Node* SmiOpName(Node* a, Node* b) { \ 167 Node* SmiOpName(Node* a, Node* b) { \
168 return BitcastWordToTaggedSigned( \ 168 return BitcastWordToTaggedSigned( \
169 IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); \ 169 IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); \
170 } 170 }
171 SMI_ARITHMETIC_BINOP(SmiAdd, IntPtrAdd) 171 SMI_ARITHMETIC_BINOP(SmiAdd, IntPtrAdd)
172 SMI_ARITHMETIC_BINOP(SmiSub, IntPtrSub) 172 SMI_ARITHMETIC_BINOP(SmiSub, IntPtrSub)
173 SMI_ARITHMETIC_BINOP(SmiAnd, WordAnd) 173 SMI_ARITHMETIC_BINOP(SmiAnd, WordAnd)
174 SMI_ARITHMETIC_BINOP(SmiOr, WordOr) 174 SMI_ARITHMETIC_BINOP(SmiOr, WordOr)
175 #undef SMI_ARITHMETIC_BINOP
175 176
176 #define SMI_SHIFT_OP(SmiOpName, IntPtrOpName) \ 177 Node* SmiShl(Node* a, int shift) {
177 Node* SmiOpName(Node* a, int shift) { \ 178 return BitcastWordToTaggedSigned(WordShl(BitcastTaggedToWord(a), shift));
178 return BitcastWordToTaggedSigned( \ 179 }
179 IntPtrOpName(BitcastTaggedToWord(a), shift)); \
180 } \
181 SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName)
182 180
183 SMI_SHIFT_OP(SmiShl, WordShl) 181 Node* SmiShr(Node* a, int shift) {
184 SMI_SHIFT_OP(SmiShr, WordShr) 182 return BitcastWordToTaggedSigned(
185 #undef SMI_SHIFT_OP 183 WordAnd(WordShr(BitcastTaggedToWord(a), shift),
186 #undef SMI_ARITHMETIC_BINOP 184 BitcastTaggedToWord(SmiConstant(-1))));
185 }
186
187 Node* WordOrSmiShl(Node* a, int shift, ParameterMode mode) {
188 if (mode == SMI_PARAMETERS) {
189 return SmiShl(a, shift);
190 } else {
191 DCHECK_EQ(INTPTR_PARAMETERS, mode);
192 return WordShl(a, shift);
193 }
194 }
195
196 Node* WordOrSmiShr(Node* a, int shift, ParameterMode mode) {
197 if (mode == SMI_PARAMETERS) {
198 return SmiShr(a, shift);
199 } else {
200 DCHECK_EQ(INTPTR_PARAMETERS, mode);
201 return WordShr(a, shift);
202 }
203 }
187 204
188 #define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \ 205 #define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \
189 Node* SmiOpName(Node* a, Node* b) { \ 206 Node* SmiOpName(Node* a, Node* b) { \
190 return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \ 207 return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \
191 } 208 }
192 SMI_COMPARISON_OP(SmiEqual, WordEqual) 209 SMI_COMPARISON_OP(SmiEqual, WordEqual)
193 SMI_COMPARISON_OP(SmiAbove, UintPtrGreaterThan) 210 SMI_COMPARISON_OP(SmiAbove, UintPtrGreaterThan)
194 SMI_COMPARISON_OP(SmiAboveOrEqual, UintPtrGreaterThanOrEqual) 211 SMI_COMPARISON_OP(SmiAboveOrEqual, UintPtrGreaterThanOrEqual)
195 SMI_COMPARISON_OP(SmiBelow, UintPtrLessThan) 212 SMI_COMPARISON_OP(SmiBelow, UintPtrLessThan)
196 SMI_COMPARISON_OP(SmiLessThan, IntPtrLessThan) 213 SMI_COMPARISON_OP(SmiLessThan, IntPtrLessThan)
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 } 1269 }
1253 #else 1270 #else
1254 #define CSA_SLOW_ASSERT(csa, x) ((void)0) 1271 #define CSA_SLOW_ASSERT(csa, x) ((void)0)
1255 #endif 1272 #endif
1256 1273
1257 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1274 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1258 1275
1259 } // namespace internal 1276 } // namespace internal
1260 } // namespace v8 1277 } // namespace v8
1261 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1278 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698