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

Side by Side 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, 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::BooleanMapConstant() {
42 return HeapConstant(isolate()->factory()->boolean_map());
43 }
44
45 Node* CodeStubAssembler::EmptyStringConstant() {
46 return LoadRoot(Heap::kempty_stringRootIndex);
47 }
48
49 Node* CodeStubAssembler::FixedArrayMapConstant() {
50 return LoadRoot(Heap::kFixedArrayMapRootIndex);
51 }
52
53 Node* CodeStubAssembler::FixedCowArrayMapConstant() {
54 return LoadRoot(Heap::kFixedCOWArrayMapRootIndex);
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() { 41 Node* CodeStubAssembler::NoContextConstant() {
66 return SmiConstant(Smi::FromInt(0)); 42 return SmiConstant(Smi::FromInt(0));
67 } 43 }
68 44
69 Node* CodeStubAssembler::MinusZeroConstant() { 45 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \
70 return LoadRoot(Heap::kMinusZeroValueRootIndex); 46 Node* CodeStubAssembler::name##Constant() { \
71 } 47 return LoadRoot(Heap::k##rootName##RootIndex); \
48 }
49 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
50 #undef HEAP_CONSTANT_ACCESSOR
72 51
73 Node* CodeStubAssembler::NanConstant() { 52 #define HEAP_CONSTANT_TEST(rootName, name) \
74 return LoadRoot(Heap::kNanValueRootIndex); 53 Node* CodeStubAssembler::Is##name(Node* value) { \
75 } 54 return WordEqual(value, name##Constant()); \
76 55 }
77 Node* CodeStubAssembler::NullConstant() { 56 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST);
78 return LoadRoot(Heap::kNullValueRootIndex); 57 #undef HEAP_CONSTANT_TEST
79 }
80
81 Node* CodeStubAssembler::UndefinedConstant() {
82 return LoadRoot(Heap::kUndefinedValueRootIndex);
83 }
84
85 Node* CodeStubAssembler::TheHoleConstant() {
86 return LoadRoot(Heap::kTheHoleValueRootIndex);
87 }
88 58
89 Node* CodeStubAssembler::HashSeed() { 59 Node* CodeStubAssembler::HashSeed() {
90 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); 60 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex);
91 } 61 }
92 62
93 Node* CodeStubAssembler::StaleRegisterConstant() { 63 Node* CodeStubAssembler::StaleRegisterConstant() {
94 return LoadRoot(Heap::kStaleRegisterRootIndex); 64 return LoadRoot(Heap::kStaleRegisterRootIndex);
95 } 65 }
96 66
97 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) { 67 Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) {
(...skipping 5624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 Heap::kTheHoleValueRootIndex); 5692 Heap::kTheHoleValueRootIndex);
5723 5693
5724 // Store the WeakCell in the feedback vector. 5694 // Store the WeakCell in the feedback vector.
5725 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5695 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5726 CodeStubAssembler::SMI_PARAMETERS); 5696 CodeStubAssembler::SMI_PARAMETERS);
5727 return cell; 5697 return cell;
5728 } 5698 }
5729 5699
5730 } // namespace internal 5700 } // namespace internal
5731 } // namespace v8 5701 } // 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