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

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

Issue 2383473003: [stubs] Add more helper methods for heap constants (Closed)
Patch Set: formatting 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 f87f55a479bdc9e3991f5dc48e26fc982b068168..10dd39a199c68b515fa2c8c4dbfd3e674579f5d1 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -38,53 +38,31 @@ 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::BooleanMapConstant() {
+ return HeapConstant(isolate()->factory()->boolean_map());
Igor Sheludko 2016/09/29 13:54:53 Why is boolean_map so different? I guess V(bool
}
-Node* CodeStubAssembler::NullConstant() {
- return LoadRoot(Heap::kNullValueRootIndex);
-}
+#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::UndefinedConstant() {
- return LoadRoot(Heap::kUndefinedValueRootIndex);
+Node* CodeStubAssembler::IsBooleanMap(Node* value) {
+ return WordEqual(value, BooleanMapConstant());
}
-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