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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister( | 146 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister( |
147 Register reg) { | 147 Register reg) { |
148 Output(Bytecode::kStar, reg.ToOperand()); | 148 Output(Bytecode::kStar, reg.ToOperand()); |
149 return *this; | 149 return *this; |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( | 153 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( |
154 Register object, int feedback_slot, LanguageMode language_mode) { | 154 Register object, int feedback_slot, LanguageMode language_mode) { |
155 if (is_strong(language_mode)) { | 155 if (!is_sloppy(language_mode)) { |
156 UNIMPLEMENTED(); | 156 UNIMPLEMENTED(); |
157 } | 157 } |
158 | 158 |
159 if (FitsInByteOperand(feedback_slot)) { | 159 if (FitsInByteOperand(feedback_slot)) { |
160 Output(Bytecode::kLoadIC, object.ToOperand(), | 160 Output(Bytecode::kLoadIC, object.ToOperand(), |
161 static_cast<uint8_t>(feedback_slot)); | 161 static_cast<uint8_t>(feedback_slot)); |
162 } else { | 162 } else { |
163 UNIMPLEMENTED(); | 163 UNIMPLEMENTED(); |
164 } | 164 } |
165 return *this; | 165 return *this; |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty( | 169 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty( |
170 Register object, int feedback_slot, LanguageMode language_mode) { | 170 Register object, int feedback_slot, LanguageMode language_mode) { |
171 if (is_strong(language_mode)) { | 171 if (!is_sloppy(language_mode)) { |
172 UNIMPLEMENTED(); | 172 UNIMPLEMENTED(); |
173 } | 173 } |
174 | 174 |
175 if (FitsInByteOperand(feedback_slot)) { | 175 if (FitsInByteOperand(feedback_slot)) { |
176 Output(Bytecode::kKeyedLoadIC, object.ToOperand(), | 176 Output(Bytecode::kKeyedLoadIC, object.ToOperand(), |
177 static_cast<uint8_t>(feedback_slot)); | 177 static_cast<uint8_t>(feedback_slot)); |
178 } else { | 178 } else { |
179 UNIMPLEMENTED(); | 179 UNIMPLEMENTED(); |
180 } | 180 } |
181 return *this; | 181 return *this; |
182 } | 182 } |
183 | 183 |
184 | 184 |
| 185 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( |
| 186 Register object, Register name, int feedback_slot, |
| 187 LanguageMode language_mode) { |
| 188 if (!is_sloppy(language_mode)) { |
| 189 UNIMPLEMENTED(); |
| 190 } |
| 191 |
| 192 if (FitsInByteOperand(feedback_slot)) { |
| 193 Output(Bytecode::kStoreIC, object.ToOperand(), name.ToOperand(), |
| 194 static_cast<uint8_t>(feedback_slot)); |
| 195 } else { |
| 196 UNIMPLEMENTED(); |
| 197 } |
| 198 return *this; |
| 199 } |
| 200 |
| 201 |
| 202 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty( |
| 203 Register object, Register key, int feedback_slot, |
| 204 LanguageMode language_mode) { |
| 205 if (!is_sloppy(language_mode)) { |
| 206 UNIMPLEMENTED(); |
| 207 } |
| 208 |
| 209 if (FitsInByteOperand(feedback_slot)) { |
| 210 Output(Bytecode::kKeyedStoreIC, object.ToOperand(), key.ToOperand(), |
| 211 static_cast<uint8_t>(feedback_slot)); |
| 212 } else { |
| 213 UNIMPLEMENTED(); |
| 214 } |
| 215 return *this; |
| 216 } |
| 217 |
| 218 |
185 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { | 219 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { |
186 Output(Bytecode::kReturn); | 220 Output(Bytecode::kReturn); |
187 return *this; | 221 return *this; |
188 } | 222 } |
189 | 223 |
190 | 224 |
191 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { | 225 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { |
192 // These constants shouldn't be added to the constant pool, the should use | 226 // These constants shouldn't be added to the constant pool, the should use |
193 // specialzed bytecodes instead. | 227 // specialzed bytecodes instead. |
194 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value())); | 228 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value())); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 366 |
333 Register TemporaryRegisterScope::NewRegister() { | 367 Register TemporaryRegisterScope::NewRegister() { |
334 count_++; | 368 count_++; |
335 last_register_index_ = builder_->BorrowTemporaryRegister(); | 369 last_register_index_ = builder_->BorrowTemporaryRegister(); |
336 return Register(last_register_index_); | 370 return Register(last_register_index_); |
337 } | 371 } |
338 | 372 |
339 } // namespace interpreter | 373 } // namespace interpreter |
340 } // namespace internal | 374 } // namespace internal |
341 } // namespace v8 | 375 } // namespace v8 |
OLD | NEW |