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

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

Issue 2489743002: [stubs] Ensure CSA_ASSERT and CSA_SLOW_ASSERT do not produce unused instructions in release mode. (Closed)
Patch Set: ((void)0) Created 4 years, 1 month 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 | « src/builtins/builtins-string.cc ('k') | 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 compiler::Node* NumberInc(compiler::Node* value); 154 compiler::Node* NumberInc(compiler::Node* value);
155 155
156 // Allocate an object of the given size. 156 // Allocate an object of the given size.
157 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); 157 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone);
158 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); 158 compiler::Node* Allocate(int size, AllocationFlags flags = kNone);
159 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); 159 compiler::Node* InnerAllocate(compiler::Node* previous, int offset);
160 compiler::Node* InnerAllocate(compiler::Node* previous, 160 compiler::Node* InnerAllocate(compiler::Node* previous,
161 compiler::Node* offset); 161 compiler::Node* offset);
162 compiler::Node* IsRegularHeapObjectSize(compiler::Node* size); 162 compiler::Node* IsRegularHeapObjectSize(compiler::Node* size);
163 163
164 void Assert(compiler::Node* condition, const char* string = nullptr, 164 typedef std::function<compiler::Node*()> ConditionBody;
165 void Assert(ConditionBody condition_body, const char* string = nullptr,
165 const char* file = nullptr, int line = 0); 166 const char* file = nullptr, int line = 0);
166 167
167 // Check a value for smi-ness 168 // Check a value for smi-ness
168 compiler::Node* TaggedIsSmi(compiler::Node* a); 169 compiler::Node* TaggedIsSmi(compiler::Node* a);
169 // Check that the value is a non-negative smi. 170 // Check that the value is a non-negative smi.
170 compiler::Node* WordIsPositiveSmi(compiler::Node* a); 171 compiler::Node* WordIsPositiveSmi(compiler::Node* a);
171 // Check that a word has a word-aligned address. 172 // Check that a word has a word-aligned address.
172 compiler::Node* WordIsWordAligned(compiler::Node* word); 173 compiler::Node* WordIsWordAligned(compiler::Node* word);
173 compiler::Node* WordIsPowerOfTwo(compiler::Node* value); 174 compiler::Node* WordIsPowerOfTwo(compiler::Node* value);
174 175
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 1257
1257 private: 1258 private:
1258 compiler::Node* GetArguments(); 1259 compiler::Node* GetArguments();
1259 1260
1260 CodeStubAssembler* assembler_; 1261 CodeStubAssembler* assembler_;
1261 compiler::Node* argc_; 1262 compiler::Node* argc_;
1262 compiler::Node* arguments_; 1263 compiler::Node* arguments_;
1263 compiler::Node* fp_; 1264 compiler::Node* fp_;
1264 }; 1265 };
1265 1266
1266 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) 1267 #ifdef DEBUG
1268 #define CSA_ASSERT(csa, x) \
1269 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__)
1270 #else
1271 #define CSA_ASSERT(csa, x) ((void)0)
1272 #endif
1273
1267 #ifdef ENABLE_SLOW_DCHECKS 1274 #ifdef ENABLE_SLOW_DCHECKS
1268 #define CSA_SLOW_ASSERT(x) \ 1275 #define CSA_SLOW_ASSERT(csa, x) \
1269 if (FLAG_enable_slow_asserts) { \ 1276 if (FLAG_enable_slow_asserts) { \
1270 Assert((x), #x, __FILE__, __LINE__); \ 1277 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__); \
1271 } 1278 }
1272 #else 1279 #else
1273 #define CSA_SLOW_ASSERT(x) 1280 #define CSA_SLOW_ASSERT(csa, x) ((void)0)
1274 #endif 1281 #endif
1275 1282
1276 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1283 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1277 1284
1278 } // namespace internal 1285 } // namespace internal
1279 } // namespace v8 1286 } // namespace v8
1280 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1287 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-string.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698