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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 // | 177 // |
178 // Store accumulator to register <dst>. | 178 // Store accumulator to register <dst>. |
179 void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) { | 179 void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) { |
180 Node* reg_index = __ BytecodeOperandReg8(0); | 180 Node* reg_index = __ BytecodeOperandReg8(0); |
181 Node* accumulator = __ GetAccumulator(); | 181 Node* accumulator = __ GetAccumulator(); |
182 __ StoreRegister(accumulator, reg_index); | 182 __ StoreRegister(accumulator, reg_index); |
183 __ Dispatch(); | 183 __ Dispatch(); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void Interpreter::DoLoadGlobal(Callable ic, | |
188 compiler::InterpreterAssembler* assembler) { | |
189 // Get the global object. | |
190 Node* context = __ GetContext(); | |
191 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); | |
192 | |
193 // Load the global via the LoadIC. | |
194 Node* code_target = __ HeapConstant(ic.code()); | |
195 Node* constant_index = __ BytecodeOperandIdx8(0); | |
196 Node* name = __ LoadConstantPoolEntry(constant_index); | |
197 Node* raw_slot = __ BytecodeOperandIdx8(1); | |
198 Node* smi_slot = __ SmiTag(raw_slot); | |
199 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | |
200 Node* result = __ CallIC(ic.descriptor(), code_target, global, name, smi_slot, | |
201 type_feedback_vector); | |
202 __ SetAccumulator(result); | |
203 | |
204 __ Dispatch(); | |
205 } | |
206 | |
207 | |
208 // LdaGlobalSloppy <name> <slot> | |
209 // | |
210 // Load the global with name in constant pool entry <name> into the accumulator | |
211 // using FeedBackVector slot <slot> in sloppy mode. | |
212 void Interpreter::DoLdaGlobalSloppy(compiler::InterpreterAssembler* assembler) { | |
213 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
214 SLOPPY, UNINITIALIZED); | |
215 DoLoadGlobal(ic, assembler); | |
216 } | |
217 | |
218 | |
219 // LdaGlobalSloppy <name> <slot> | |
220 // | |
221 // Load the global with name in constant pool entry <name> into the accumulator | |
222 // using FeedBackVector slot <slot> in strict mode. | |
223 void Interpreter::DoLdaGlobalStrict(compiler::InterpreterAssembler* assembler) { | |
224 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
225 STRICT, UNINITIALIZED); | |
226 DoLoadGlobal(ic, assembler); | |
227 } | |
228 | |
229 | |
230 void Interpreter::DoStoreGlobal(Callable ic, | |
231 compiler::InterpreterAssembler* assembler) { | |
232 // Get the global object. | |
233 Node* context = __ GetContext(); | |
234 Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX); | |
235 | |
236 // Store the global via the StoreIC. | |
237 Node* code_target = __ HeapConstant(ic.code()); | |
238 Node* constant_index = __ BytecodeOperandIdx8(0); | |
239 Node* name = __ LoadConstantPoolEntry(constant_index); | |
240 Node* value = __ GetAccumulator(); | |
241 Node* raw_slot = __ BytecodeOperandIdx8(1); | |
242 Node* smi_slot = __ SmiTag(raw_slot); | |
243 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | |
244 __ CallIC(ic.descriptor(), code_target, global, name, value, smi_slot, | |
245 type_feedback_vector); | |
246 | |
247 __ Dispatch(); | |
248 } | |
249 | |
250 | |
251 // StaGlobalSloppy <name> <slot> | |
252 // | |
253 // Store the value in the accumulator into the global with name in constant pool | |
254 // entry <name> using FeedBackVector slot <slot> in sloppy mode. | |
255 void Interpreter::DoStaGlobalSloppy(compiler::InterpreterAssembler* assembler) { | |
256 Callable ic = | |
257 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | |
258 DoStoreGlobal(ic, assembler); | |
259 } | |
260 | |
261 | |
262 // StaGlobalStrict <name> <slot> | |
263 // | |
264 // Store the value in the accumulator into the global with name in constant pool | |
265 // entry <name> using FeedBackVector slot <slot> in strict mode. | |
266 void Interpreter::DoStaGlobalStrict(compiler::InterpreterAssembler* assembler) { | |
267 Callable ic = | |
268 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | |
269 DoStoreGlobal(ic, assembler); | |
270 } | |
271 | |
272 | |
187 // LdaContextSlot <context> <slot_index> | 273 // LdaContextSlot <context> <slot_index> |
188 // | 274 // |
189 // Load the object in |slot_index| of |context| into the accumulator. | 275 // Load the object in |slot_index| of |context| into the accumulator. |
190 void Interpreter::DoLdaContextSlot(compiler::InterpreterAssembler* assembler) { | 276 void Interpreter::DoLdaContextSlot(compiler::InterpreterAssembler* assembler) { |
191 Node* reg_index = __ BytecodeOperandReg8(0); | 277 Node* reg_index = __ BytecodeOperandReg8(0); |
192 Node* context = __ LoadRegister(reg_index); | 278 Node* context = __ LoadRegister(reg_index); |
193 Node* slot_index = __ BytecodeOperandIdx8(1); | 279 Node* slot_index = __ BytecodeOperandIdx8(1); |
194 Node* result = __ LoadContextSlot(context, slot_index); | 280 Node* result = __ LoadContextSlot(context, slot_index); |
195 __ SetAccumulator(result); | 281 __ SetAccumulator(result); |
196 __ Dispatch(); | 282 __ Dispatch(); |
197 } | 283 } |
198 | 284 |
199 | 285 |
200 // StaContextSlot <context> <slot_index> | 286 // StaContextSlot <context> <slot_index> |
201 // | 287 // |
202 // Stores the object in the accumulator into |slot_index| of |context|. | 288 // Stores the object in the accumulator into |slot_index| of |context|. |
203 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) { | 289 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) { |
204 Node* value = __ GetAccumulator(); | 290 Node* value = __ GetAccumulator(); |
205 Node* reg_index = __ BytecodeOperandReg8(0); | 291 Node* reg_index = __ BytecodeOperandReg8(0); |
206 Node* context = __ LoadRegister(reg_index); | 292 Node* context = __ LoadRegister(reg_index); |
207 Node* slot_index = __ BytecodeOperandIdx8(1); | 293 Node* slot_index = __ BytecodeOperandIdx8(1); |
208 __ StoreContextSlot(context, slot_index, value); | 294 __ StoreContextSlot(context, slot_index, value); |
209 __ Dispatch(); | 295 __ Dispatch(); |
210 } | 296 } |
211 | 297 |
212 | 298 |
213 void Interpreter::DoPropertyLoadIC(Callable ic, | 299 void Interpreter::DoLoadIC(Callable ic, |
214 compiler::InterpreterAssembler* assembler) { | 300 compiler::InterpreterAssembler* assembler) { |
215 Node* code_target = __ HeapConstant(ic.code()); | 301 Node* code_target = __ HeapConstant(ic.code()); |
216 Node* reg_index = __ BytecodeOperandReg8(0); | 302 Node* register_index = __ BytecodeOperandReg8(0); |
217 Node* object = __ LoadRegister(reg_index); | 303 Node* object = __ LoadRegister(register_index); |
218 Node* name = __ GetAccumulator(); | 304 Node* constant_index = __ BytecodeOperandIdx8(1); |
219 Node* raw_slot = __ BytecodeOperandIdx8(1); | 305 Node* name = __ LoadConstantPoolEntry(constant_index); |
306 Node* raw_slot = __ BytecodeOperandIdx8(2); | |
220 Node* smi_slot = __ SmiTag(raw_slot); | 307 Node* smi_slot = __ SmiTag(raw_slot); |
221 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 308 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
222 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot, | 309 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot, |
223 type_feedback_vector); | 310 type_feedback_vector); |
224 __ SetAccumulator(result); | 311 __ SetAccumulator(result); |
225 __ Dispatch(); | 312 __ Dispatch(); |
226 } | 313 } |
227 | 314 |
228 | 315 |
229 // LoadICSloppy <object> <slot> | 316 // LoadICSloppy <object> <name> <slot> |
230 // | 317 // |
231 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and | 318 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and |
232 // the name in the accumulator. | 319 // the name at constant pool entry <name>. |
233 void Interpreter::DoLoadICSloppy(compiler::InterpreterAssembler* assembler) { | 320 void Interpreter::DoLoadICSloppy(compiler::InterpreterAssembler* assembler) { |
234 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 321 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
235 SLOPPY, UNINITIALIZED); | 322 SLOPPY, UNINITIALIZED); |
236 DoPropertyLoadIC(ic, assembler); | 323 DoLoadIC(ic, assembler); |
237 } | 324 } |
238 | 325 |
239 | 326 |
240 // LoadICStrict <object> <slot> | 327 // LoadICStrict <object> <name> <slot> |
241 // | 328 // |
242 // Calls the strict mode LoadIC at FeedBackVector slot <slot> for <object> and | 329 // Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and |
243 // the name in the accumulator. | 330 // the name at constant pool entry <name>. |
244 void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) { | 331 void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) { |
245 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 332 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
246 STRICT, UNINITIALIZED); | 333 STRICT, UNINITIALIZED); |
247 DoPropertyLoadIC(ic, assembler); | 334 DoLoadIC(ic, assembler); |
248 } | 335 } |
249 | 336 |
250 | 337 |
338 void Interpreter::DoKeyedLoadIC(Callable ic, | |
339 compiler::InterpreterAssembler* assembler) { | |
340 Node* code_target = __ HeapConstant(ic.code()); | |
341 Node* reg_index = __ BytecodeOperandReg8(0); | |
342 Node* object = __ LoadRegister(reg_index); | |
343 Node* name = __ GetAccumulator(); | |
344 Node* raw_slot = __ BytecodeOperandIdx8(1); | |
345 Node* smi_slot = __ SmiTag(raw_slot); | |
346 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | |
347 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot, | |
348 type_feedback_vector); | |
349 __ SetAccumulator(result); | |
350 __ Dispatch(); | |
351 } | |
352 | |
353 | |
251 // KeyedLoadICSloppy <object> <slot> | 354 // KeyedLoadICSloppy <object> <slot> |
252 // | 355 // |
253 // Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | 356 // Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object> |
254 // and the key in the accumulator. | 357 // and the key in the accumulator. |
255 void Interpreter::DoKeyedLoadICSloppy( | 358 void Interpreter::DoKeyedLoadICSloppy( |
256 compiler::InterpreterAssembler* assembler) { | 359 compiler::InterpreterAssembler* assembler) { |
257 Callable ic = | 360 Callable ic = |
258 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 361 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
259 DoPropertyLoadIC(ic, assembler); | 362 DoKeyedLoadIC(ic, assembler); |
260 } | 363 } |
261 | 364 |
262 | 365 |
263 // KeyedLoadICStrict <object> <slot> | 366 // KeyedLoadICStrict <object> <slot> |
264 // | 367 // |
265 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object> | 368 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object> |
266 // and the key in the accumulator. | 369 // and the key in the accumulator. |
267 void Interpreter::DoKeyedLoadICStrict( | 370 void Interpreter::DoKeyedLoadICStrict( |
268 compiler::InterpreterAssembler* assembler) { | 371 compiler::InterpreterAssembler* assembler) { |
269 Callable ic = | 372 Callable ic = |
270 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | 373 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
271 DoPropertyLoadIC(ic, assembler); | 374 DoKeyedLoadIC(ic, assembler); |
272 } | 375 } |
273 | 376 |
274 | 377 |
275 void Interpreter::DoPropertyStoreIC(Callable ic, | 378 void Interpreter::DoStoreIC(Callable ic, |
276 compiler::InterpreterAssembler* assembler) { | 379 compiler::InterpreterAssembler* assembler) { |
277 Node* code_target = __ HeapConstant(ic.code()); | 380 Node* code_target = __ HeapConstant(ic.code()); |
278 Node* object_reg_index = __ BytecodeOperandReg8(0); | 381 Node* object_reg_index = __ BytecodeOperandReg8(0); |
279 Node* object = __ LoadRegister(object_reg_index); | 382 Node* object = __ LoadRegister(object_reg_index); |
280 Node* name_reg_index = __ BytecodeOperandReg8(1); | 383 Node* constant_index = __ BytecodeOperandIdx8(1); |
281 Node* name = __ LoadRegister(name_reg_index); | 384 Node* name = __ LoadConstantPoolEntry(constant_index); |
282 Node* value = __ GetAccumulator(); | 385 Node* value = __ GetAccumulator(); |
283 Node* raw_slot = __ BytecodeOperandIdx8(2); | 386 Node* raw_slot = __ BytecodeOperandIdx8(2); |
284 Node* smi_slot = __ SmiTag(raw_slot); | 387 Node* smi_slot = __ SmiTag(raw_slot); |
285 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 388 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
286 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value, | 389 __ CallIC(ic.descriptor(), code_target, object, name, value, smi_slot, |
287 smi_slot, type_feedback_vector); | 390 type_feedback_vector); |
288 __ SetAccumulator(result); | |
289 __ Dispatch(); | 391 __ Dispatch(); |
290 } | 392 } |
291 | 393 |
292 | 394 |
293 // StoreICSloppy <object> <name> <slot> | 395 // StoreICSloppy <object> <name> <slot> |
294 // | 396 // |
295 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and | 397 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and |
296 // the name <name> with the value in the accumulator. | 398 // the in constant pool entry <name> with the value in the accumulator. |
oth
2015/10/22 10:54:30
For clarity, might change <name> to <name_index> o
rmcilroy
2015/10/22 13:27:48
Done. Also for Lda/StaGlobals above.
| |
297 void Interpreter::DoStoreICSloppy(compiler::InterpreterAssembler* assembler) { | 399 void Interpreter::DoStoreICSloppy(compiler::InterpreterAssembler* assembler) { |
298 Callable ic = | 400 Callable ic = |
299 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 401 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
300 DoPropertyStoreIC(ic, assembler); | 402 DoStoreIC(ic, assembler); |
301 } | 403 } |
302 | 404 |
303 | 405 |
304 // StoreICStrict <object> <name> <slot> | 406 // StoreICStrict <object> <name> <slot> |
305 // | 407 // |
306 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and | 408 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and |
307 // the name <name> with the value in the accumulator. | 409 // the name in constant pool entry <name> with the value in the accumulator. |
oth
2015/10/22 10:54:30
Ditto.
rmcilroy
2015/10/22 13:27:48
Done.
| |
308 void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) { | 410 void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) { |
309 Callable ic = | 411 Callable ic = |
310 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | 412 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
311 DoPropertyStoreIC(ic, assembler); | 413 DoStoreIC(ic, assembler); |
312 } | 414 } |
313 | 415 |
314 | 416 |
417 void Interpreter::DoKeyedStoreIC(Callable ic, | |
418 compiler::InterpreterAssembler* assembler) { | |
419 Node* code_target = __ HeapConstant(ic.code()); | |
420 Node* object_reg_index = __ BytecodeOperandReg8(0); | |
421 Node* object = __ LoadRegister(object_reg_index); | |
422 Node* name_reg_index = __ BytecodeOperandReg8(1); | |
423 Node* name = __ LoadRegister(name_reg_index); | |
424 Node* value = __ GetAccumulator(); | |
425 Node* raw_slot = __ BytecodeOperandIdx8(2); | |
426 Node* smi_slot = __ SmiTag(raw_slot); | |
427 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | |
428 __ CallIC(ic.descriptor(), code_target, object, name, value, smi_slot, | |
429 type_feedback_vector); | |
430 __ Dispatch(); | |
431 } | |
432 | |
433 | |
315 // KeyedStoreICSloppy <object> <key> <slot> | 434 // KeyedStoreICSloppy <object> <key> <slot> |
316 // | 435 // |
317 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 436 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
318 // and the key <key> with the value in the accumulator. | 437 // and the key <key> with the value in the accumulator. |
319 void Interpreter::DoKeyedStoreICSloppy( | 438 void Interpreter::DoKeyedStoreICSloppy( |
320 compiler::InterpreterAssembler* assembler) { | 439 compiler::InterpreterAssembler* assembler) { |
321 Callable ic = | 440 Callable ic = |
322 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 441 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
323 DoPropertyStoreIC(ic, assembler); | 442 DoKeyedStoreIC(ic, assembler); |
324 } | 443 } |
325 | 444 |
326 | 445 |
327 // KeyedStoreICStore <object> <key> <slot> | 446 // KeyedStoreICStore <object> <key> <slot> |
328 // | 447 // |
329 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 448 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
330 // and the key <key> with the value in the accumulator. | 449 // and the key <key> with the value in the accumulator. |
331 void Interpreter::DoKeyedStoreICStrict( | 450 void Interpreter::DoKeyedStoreICStrict( |
332 compiler::InterpreterAssembler* assembler) { | 451 compiler::InterpreterAssembler* assembler) { |
333 Callable ic = | 452 Callable ic = |
334 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | 453 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
335 DoPropertyStoreIC(ic, assembler); | 454 DoKeyedStoreIC(ic, assembler); |
336 } | 455 } |
337 | 456 |
338 | 457 |
339 // PushContext <context> | 458 // PushContext <context> |
340 // | 459 // |
341 // Pushes the accumulator as the current context, and saves it in <context> | 460 // Pushes the accumulator as the current context, and saves it in <context> |
342 void Interpreter::DoPushContext(compiler::InterpreterAssembler* assembler) { | 461 void Interpreter::DoPushContext(compiler::InterpreterAssembler* assembler) { |
343 Node* reg_index = __ BytecodeOperandReg8(0); | 462 Node* reg_index = __ BytecodeOperandReg8(0); |
344 Node* context = __ GetAccumulator(); | 463 Node* context = __ GetAccumulator(); |
345 __ SetContext(context); | 464 __ SetContext(context); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
885 // | 1004 // |
886 // Return the value in the accumulator. | 1005 // Return the value in the accumulator. |
887 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 1006 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
888 __ Return(); | 1007 __ Return(); |
889 } | 1008 } |
890 | 1009 |
891 | 1010 |
892 } // namespace interpreter | 1011 } // namespace interpreter |
893 } // namespace internal | 1012 } // namespace internal |
894 } // namespace v8 | 1013 } // namespace v8 |
OLD | NEW |