OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/code-stub-assembler.h" | 5 #include "src/compiler/code-stub-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 Node* CodeStubAssembler::HeapConstant(Handle<HeapObject> object) { | 71 Node* CodeStubAssembler::HeapConstant(Handle<HeapObject> object) { |
72 return raw_assembler_->HeapConstant(object); | 72 return raw_assembler_->HeapConstant(object); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 Node* CodeStubAssembler::BooleanConstant(bool value) { | 76 Node* CodeStubAssembler::BooleanConstant(bool value) { |
77 return raw_assembler_->BooleanConstant(value); | 77 return raw_assembler_->BooleanConstant(value); |
78 } | 78 } |
79 | 79 |
80 | 80 |
| 81 Node* CodeStubAssembler::Load(MachineType type, Node* base) { |
| 82 return raw_assembler_->Load(type, base); |
| 83 } |
| 84 |
| 85 |
| 86 Node* CodeStubAssembler::Load(MachineType type, Node* base, Node* index) { |
| 87 return raw_assembler_->Load(type, base, index); |
| 88 } |
| 89 |
| 90 |
81 Node* CodeStubAssembler::Parameter(int value) { | 91 Node* CodeStubAssembler::Parameter(int value) { |
82 return raw_assembler_->Parameter(value); | 92 return raw_assembler_->Parameter(value); |
83 } | 93 } |
84 | 94 |
85 | 95 |
| 96 Node* CodeStubAssembler::StackArg(Node* num_args, int value) { |
| 97 // N = num_args |
| 98 // Arg 0: [sp + (N + 1) * kPointerSize] |
| 99 // Arg 1: [sp + N * kPointerSize] |
| 100 // ... |
| 101 // Arg N-1: [sp + kPointerSize] |
| 102 RawMachineAssembler* rma = raw_assembler_.get(); |
| 103 return rma->Load( |
| 104 MachineType::AnyTagged(), rma->LoadStackPointer(), |
| 105 rma->Word32Shl(rma->Int32Sub(num_args, rma->Int32Constant(value - 1)), |
| 106 rma->Int32Constant(kPointerSizeLog2))); |
| 107 } |
| 108 |
| 109 |
| 110 Node* CodeStubAssembler::StackArgOrUndefined(Node* num_args, int value) { |
| 111 RawMachineAssembler* rma = raw_assembler_.get(); |
| 112 RawMachineLabel ok, not_ok, done; |
| 113 rma->Branch(rma->Int32LessThan(rma->Int32Constant(value - 1), num_args), &ok, |
| 114 ¬_ok); |
| 115 rma->Bind(&ok); |
| 116 Node* arg = StackArg(num_args, value); |
| 117 rma->Goto(&done); |
| 118 rma->Bind(¬_ok); |
| 119 Node* undefined = rma->UndefinedConstant(); |
| 120 rma->Goto(&done); |
| 121 rma->Bind(&done); |
| 122 return rma->Phi(MachineRepresentation::kTagged, arg, undefined); |
| 123 } |
| 124 |
| 125 |
86 void CodeStubAssembler::Return(Node* value) { | 126 void CodeStubAssembler::Return(Node* value) { |
87 return raw_assembler_->Return(value); | 127 return raw_assembler_->Return(value); |
88 } | 128 } |
89 | 129 |
90 | 130 |
91 Node* CodeStubAssembler::SmiShiftBitsConstant() { | 131 Node* CodeStubAssembler::SmiShiftBitsConstant() { |
92 return Int32Constant(kSmiShiftSize + kSmiTagSize); | 132 return Int32Constant(kSmiShiftSize + kSmiTagSize); |
93 } | 133 } |
94 | 134 |
95 | 135 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 207 |
168 Graph* CodeStubAssembler::graph() { return raw_assembler_->graph(); } | 208 Graph* CodeStubAssembler::graph() { return raw_assembler_->graph(); } |
169 | 209 |
170 | 210 |
171 Zone* CodeStubAssembler::zone() { return raw_assembler_->zone(); } | 211 Zone* CodeStubAssembler::zone() { return raw_assembler_->zone(); } |
172 | 212 |
173 | 213 |
174 } // namespace compiler | 214 } // namespace compiler |
175 } // namespace internal | 215 } // namespace internal |
176 } // namespace v8 | 216 } // namespace v8 |
OLD | NEW |