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

Unified Diff: src/code-stub-assembler.cc

Issue 2383473003: [stubs] Add more helper methods for heap constants (Closed)
Patch Set: rebasing onto master Created 4 years, 3 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 | « src/code-stub-assembler.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 0c698b92009845de76678295a43d7ec05a8c3333..28800d20c8c350875e1e444b2bd542795cd81efb 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -38,53 +38,23 @@ void CodeStubAssembler::Assert(Node* condition) {
#endif
}
-Node* CodeStubAssembler::BooleanMapConstant() {
- return HeapConstant(isolate()->factory()->boolean_map());
-}
-
-Node* CodeStubAssembler::EmptyStringConstant() {
- return LoadRoot(Heap::kempty_stringRootIndex);
-}
-
-Node* CodeStubAssembler::FixedArrayMapConstant() {
- return LoadRoot(Heap::kFixedArrayMapRootIndex);
-}
-
-Node* CodeStubAssembler::FixedCowArrayMapConstant() {
- return LoadRoot(Heap::kFixedCOWArrayMapRootIndex);
-}
-
-Node* CodeStubAssembler::FixedDoubleArrayMapConstant() {
- return LoadRoot(Heap::kFixedDoubleArrayMapRootIndex);
-}
-
-Node* CodeStubAssembler::HeapNumberMapConstant() {
- return LoadRoot(Heap::kHeapNumberMapRootIndex);
-}
-
Node* CodeStubAssembler::NoContextConstant() {
return SmiConstant(Smi::FromInt(0));
}
-Node* CodeStubAssembler::MinusZeroConstant() {
- return LoadRoot(Heap::kMinusZeroValueRootIndex);
-}
-
-Node* CodeStubAssembler::NanConstant() {
- return LoadRoot(Heap::kNanValueRootIndex);
-}
-
-Node* CodeStubAssembler::NullConstant() {
- return LoadRoot(Heap::kNullValueRootIndex);
-}
-
-Node* CodeStubAssembler::UndefinedConstant() {
- return LoadRoot(Heap::kUndefinedValueRootIndex);
-}
+#define HEAP_CONSTANT_ACCESSOR(rootName, name) \
+ Node* CodeStubAssembler::name##Constant() { \
+ return LoadRoot(Heap::k##rootName##RootIndex); \
+ }
+HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
+#undef HEAP_CONSTANT_ACCESSOR
-Node* CodeStubAssembler::TheHoleConstant() {
- return LoadRoot(Heap::kTheHoleValueRootIndex);
-}
+#define HEAP_CONSTANT_TEST(rootName, name) \
+ Node* CodeStubAssembler::Is##name(Node* value) { \
+ return WordEqual(value, name##Constant()); \
+ }
+HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST);
+#undef HEAP_CONSTANT_TEST
Node* CodeStubAssembler::HashSeed() {
return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex);
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698