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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.h
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h
index be527fa8d30bee06dd8050de27e78315b28853d9..77066b2bd0a46bb2a1d147c5135e5f13b82d521e 100644
--- a/src/code-stub-assembler.h
+++ b/src/code-stub-assembler.h
@@ -172,18 +172,35 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
SMI_ARITHMETIC_BINOP(SmiSub, IntPtrSub)
SMI_ARITHMETIC_BINOP(SmiAnd, WordAnd)
SMI_ARITHMETIC_BINOP(SmiOr, WordOr)
+#undef SMI_ARITHMETIC_BINOP
-#define SMI_SHIFT_OP(SmiOpName, IntPtrOpName) \
- Node* SmiOpName(Node* a, int shift) { \
- return BitcastWordToTaggedSigned( \
- IntPtrOpName(BitcastTaggedToWord(a), shift)); \
- } \
- SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName)
+ Node* SmiShl(Node* a, int shift) {
+ return BitcastWordToTaggedSigned(WordShl(BitcastTaggedToWord(a), shift));
+ }
- SMI_SHIFT_OP(SmiShl, WordShl)
- SMI_SHIFT_OP(SmiShr, WordShr)
-#undef SMI_SHIFT_OP
-#undef SMI_ARITHMETIC_BINOP
+ Node* SmiShr(Node* a, int shift) {
+ return BitcastWordToTaggedSigned(
+ WordAnd(WordShr(BitcastTaggedToWord(a), shift),
+ BitcastTaggedToWord(SmiConstant(-1))));
+ }
+
+ Node* WordOrSmiShl(Node* a, int shift, ParameterMode mode) {
+ if (mode == SMI_PARAMETERS) {
+ return SmiShl(a, shift);
+ } else {
+ DCHECK_EQ(INTPTR_PARAMETERS, mode);
+ return WordShl(a, shift);
+ }
+ }
+
+ Node* WordOrSmiShr(Node* a, int shift, ParameterMode mode) {
+ if (mode == SMI_PARAMETERS) {
+ return SmiShr(a, shift);
+ } else {
+ DCHECK_EQ(INTPTR_PARAMETERS, mode);
+ return WordShr(a, shift);
+ }
+ }
#define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \
Node* SmiOpName(Node* a, Node* b) { \
« 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