OLD | NEW |
---|---|
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 Loading... | |
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); |
167 void SlowAssert(ConditionBody condition_body, const char* string = nullptr, | |
168 const char* file = nullptr, int line = 0); | |
169 // No-op. Used by CSA_ASSERT macro. | |
170 inline void Nop() {} | |
166 | 171 |
167 // Check a value for smi-ness | 172 // Check a value for smi-ness |
168 compiler::Node* TaggedIsSmi(compiler::Node* a); | 173 compiler::Node* TaggedIsSmi(compiler::Node* a); |
169 // Check that the value is a non-negative smi. | 174 // Check that the value is a non-negative smi. |
170 compiler::Node* WordIsPositiveSmi(compiler::Node* a); | 175 compiler::Node* WordIsPositiveSmi(compiler::Node* a); |
171 // Check that a word has a word-aligned address. | 176 // Check that a word has a word-aligned address. |
172 compiler::Node* WordIsWordAligned(compiler::Node* word); | 177 compiler::Node* WordIsWordAligned(compiler::Node* word); |
173 compiler::Node* WordIsPowerOfTwo(compiler::Node* value); | 178 compiler::Node* WordIsPowerOfTwo(compiler::Node* value); |
174 | 179 |
175 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, | 180 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1250 | 1255 |
1251 private: | 1256 private: |
1252 compiler::Node* GetArguments(); | 1257 compiler::Node* GetArguments(); |
1253 | 1258 |
1254 CodeStubAssembler* assembler_; | 1259 CodeStubAssembler* assembler_; |
1255 compiler::Node* argc_; | 1260 compiler::Node* argc_; |
1256 compiler::Node* arguments_; | 1261 compiler::Node* arguments_; |
1257 compiler::Node* fp_; | 1262 compiler::Node* fp_; |
1258 }; | 1263 }; |
1259 | 1264 |
1260 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1265 #ifdef DEBUG |
1266 #define CSA_ASSERT(x) Assert([&] { return (x); }, #x, __FILE__, __LINE__) | |
Benedikt Meurer
2016/11/09 04:52:09
Can we please, please find a less awkward syntax f
Igor Sheludko
2016/11/09 12:10:34
Ok, I can remove this lambda code.
| |
1267 #else | |
1268 #define CSA_ASSERT(x) Nop() | |
1269 #endif | |
1270 | |
1261 #ifdef ENABLE_SLOW_DCHECKS | 1271 #ifdef ENABLE_SLOW_DCHECKS |
1262 #define CSA_SLOW_ASSERT(x) \ | 1272 #define CSA_SLOW_ASSERT(x) \ |
1263 if (FLAG_enable_slow_asserts) { \ | 1273 SlowAssert([&] { return (x); }, #x, __FILE__, __LINE__) |
1264 Assert((x), #x, __FILE__, __LINE__); \ | |
1265 } | |
1266 #else | 1274 #else |
1267 #define CSA_SLOW_ASSERT(x) | 1275 #define CSA_SLOW_ASSERT(x) Nop() |
1268 #endif | 1276 #endif |
1269 | 1277 |
1270 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1278 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1271 | 1279 |
1272 } // namespace internal | 1280 } // namespace internal |
1273 } // namespace v8 | 1281 } // namespace v8 |
1274 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1282 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |