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

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

Issue 2383473003: [stubs] Add more helper methods for heap constants (Closed)
Patch Set: formatting Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.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 #include "src/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 20 matching lines...) Expand all
31 Label ok(this); 31 Label ok(this);
32 Comment("[ Assert"); 32 Comment("[ Assert");
33 GotoIf(condition, &ok); 33 GotoIf(condition, &ok);
34 DebugBreak(); 34 DebugBreak();
35 Goto(&ok); 35 Goto(&ok);
36 Bind(&ok); 36 Bind(&ok);
37 Comment("] Assert"); 37 Comment("] Assert");
38 #endif 38 #endif
39 } 39 }
40 40
41 Node* CodeStubAssembler::NoContextConstant() {
42 return SmiConstant(Smi::FromInt(0));
43 }
44
41 Node* CodeStubAssembler::BooleanMapConstant() { 45 Node* CodeStubAssembler::BooleanMapConstant() {
42 return HeapConstant(isolate()->factory()->boolean_map()); 46 return HeapConstant(isolate()->factory()->boolean_map());
Igor Sheludko 2016/09/29 13:54:53 Why is boolean_map so different? I guess V(bool
43 } 47 }
44 48
45 Node* CodeStubAssembler::EmptyStringConstant() { 49 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \
46 return LoadRoot(Heap::kempty_stringRootIndex); 50 Node* CodeStubAssembler::name##Constant() { \
51 return LoadRoot(Heap::k##rootName##RootIndex); \
52 }
53 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
54 #undef HEAP_CONSTANT_ACCESSOR
55
56 Node* CodeStubAssembler::IsBooleanMap(Node* value) {
57 return WordEqual(value, BooleanMapConstant());
47 } 58 }
48 59
49 Node* CodeStubAssembler::FixedArrayMapConstant() { 60 #define HEAP_CONSTANT_TEST(rootName, name) \
50 return LoadRoot(Heap::kFixedArrayMapRootIndex); 61 Node* CodeStubAssembler::Is##name(Node* value) { \
51 } 62 return WordEqual(value, name##Constant()); \
52 63 }
53 Node* CodeStubAssembler::FixedCowArrayMapConstant() { 64 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST);
54 return LoadRoot(Heap::kFixedCOWArrayMapRootIndex); 65 #undef HEAP_CONSTANT_TEST
55 }
56
57 Node* CodeStubAssembler::FixedDoubleArrayMapConstant() {
58 return LoadRoot(Heap::kFixedDoubleArrayMapRootIndex);
59 }
60
61 Node* CodeStubAssembler::HeapNumberMapConstant() {
62 return LoadRoot(Heap::kHeapNumberMapRootIndex);
63 }
64
65 Node* CodeStubAssembler::NoContextConstant() {
66 return SmiConstant(Smi::FromInt(0));
67 }
68
69 Node* CodeStubAssembler::MinusZeroConstant() {
70 return LoadRoot(Heap::kMinusZeroValueRootIndex);
71 }
72
73 Node* CodeStubAssembler::NanConstant() {
74 return LoadRoot(Heap::kNanValueRootIndex);
75 }
76
77 Node* CodeStubAssembler::NullConstant() {
78 return LoadRoot(Heap::kNullValueRootIndex);
79 }
80
81 Node* CodeStubAssembler::UndefinedConstant() {
82 return LoadRoot(Heap::kUndefinedValueRootIndex);
83 }
84
85 Node* CodeStubAssembler::TheHoleConstant() {
86 return LoadRoot(Heap::kTheHoleValueRootIndex);
87 }
88 66
89 Node* CodeStubAssembler::HashSeed() { 67 Node* CodeStubAssembler::HashSeed() {
90 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); 68 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex);
91 } 69 }
92 70
93 Node* CodeStubAssembler::StaleRegisterConstant() { 71 Node* CodeStubAssembler::StaleRegisterConstant() {
94 return LoadRoot(Heap::kStaleRegisterRootIndex); 72 return LoadRoot(Heap::kStaleRegisterRootIndex);
95 } 73 }
96 74
97 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) { 75 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) {
(...skipping 5596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5694 Heap::kTheHoleValueRootIndex); 5672 Heap::kTheHoleValueRootIndex);
5695 5673
5696 // Store the WeakCell in the feedback vector. 5674 // Store the WeakCell in the feedback vector.
5697 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5675 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5698 CodeStubAssembler::SMI_PARAMETERS); 5676 CodeStubAssembler::SMI_PARAMETERS);
5699 return cell; 5677 return cell;
5700 } 5678 }
5701 5679
5702 } // namespace internal 5680 } // namespace internal
5703 } // namespace v8 5681 } // namespace v8
OLDNEW
« 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