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 <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 // LdaSmi <imm> | 279 // LdaSmi <imm> |
280 // | 280 // |
281 // Load an integer literal into the accumulator as a Smi. | 281 // Load an integer literal into the accumulator as a Smi. |
282 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) { | 282 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) { |
283 Node* raw_int = __ BytecodeOperandImm(0); | 283 Node* raw_int = __ BytecodeOperandImm(0); |
284 Node* smi_int = __ SmiTag(raw_int); | 284 Node* smi_int = __ SmiTag(raw_int); |
285 __ SetAccumulator(smi_int); | 285 __ SetAccumulator(smi_int); |
286 __ Dispatch(); | 286 __ Dispatch(); |
287 } | 287 } |
288 | 288 |
289 void Interpreter::DoLoadConstant(InterpreterAssembler* assembler) { | |
290 Node* index = __ BytecodeOperandIdx(0); | |
291 Node* constant = __ LoadConstantPoolEntry(index); | |
292 __ SetAccumulator(constant); | |
293 __ Dispatch(); | |
294 } | |
295 | |
rmcilroy
2016/05/24 10:53:56
Thanks for the cleanup!
oth
2016/05/24 13:37:12
Acknowledged.
| |
296 // LdaConstant <idx> | 289 // LdaConstant <idx> |
297 // | 290 // |
298 // Load constant literal at |idx| in the constant pool into the accumulator. | 291 // Load constant literal at |idx| in the constant pool into the accumulator. |
299 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) { | 292 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) { |
300 DoLoadConstant(assembler); | 293 Node* index = __ BytecodeOperandIdx(0); |
294 Node* constant = __ LoadConstantPoolEntry(index); | |
295 __ SetAccumulator(constant); | |
296 __ Dispatch(); | |
297 } | |
298 | |
299 Node* Interpreter::BuildLoadUndefined(InterpreterAssembler* assembler) { | |
rmcilroy
2016/05/24 10:53:56
nit - I think we could just inline this
oth
2016/05/24 13:37:12
Done.
| |
300 return __ HeapConstant(isolate_->factory()->undefined_value()); | |
301 } | 301 } |
302 | 302 |
303 // LdaUndefined | 303 // LdaUndefined |
304 // | 304 // |
305 // Load Undefined into the accumulator. | 305 // Load Undefined into the accumulator. |
306 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { | 306 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { |
307 Node* undefined_value = | 307 Node* result = BuildLoadUndefined(assembler); |
308 __ HeapConstant(isolate_->factory()->undefined_value()); | 308 __ SetAccumulator(result); |
309 __ SetAccumulator(undefined_value); | |
310 __ Dispatch(); | 309 __ Dispatch(); |
311 } | 310 } |
312 | 311 |
312 // LdrUndefined <reg> | |
313 // | |
314 // Loads undefined into the accumulator and |reg|. | |
315 void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) { | |
316 Node* result = BuildLoadUndefined(assembler); | |
317 Node* destination = __ BytecodeOperandReg(0); | |
318 __ StoreRegister(result, destination); | |
319 __ Dispatch(); | |
320 } | |
321 | |
313 // LdaNull | 322 // LdaNull |
314 // | 323 // |
315 // Load Null into the accumulator. | 324 // Load Null into the accumulator. |
316 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { | 325 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { |
317 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); | 326 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); |
318 __ SetAccumulator(null_value); | 327 __ SetAccumulator(null_value); |
319 __ Dispatch(); | 328 __ Dispatch(); |
320 } | 329 } |
321 | 330 |
322 // LdaTheHole | 331 // LdaTheHole |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 // | 379 // |
371 // Stores the value of register <src> to register <dst>. | 380 // Stores the value of register <src> to register <dst>. |
372 void Interpreter::DoMov(InterpreterAssembler* assembler) { | 381 void Interpreter::DoMov(InterpreterAssembler* assembler) { |
373 Node* src_index = __ BytecodeOperandReg(0); | 382 Node* src_index = __ BytecodeOperandReg(0); |
374 Node* src_value = __ LoadRegister(src_index); | 383 Node* src_value = __ LoadRegister(src_index); |
375 Node* dst_index = __ BytecodeOperandReg(1); | 384 Node* dst_index = __ BytecodeOperandReg(1); |
376 __ StoreRegister(src_value, dst_index); | 385 __ StoreRegister(src_value, dst_index); |
377 __ Dispatch(); | 386 __ Dispatch(); |
378 } | 387 } |
379 | 388 |
380 void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { | 389 Node* Interpreter::BuildLoadGlobal(Callable ic, |
390 InterpreterAssembler* assembler) { | |
381 // Get the global object. | 391 // Get the global object. |
382 Node* context = __ GetContext(); | 392 Node* context = __ GetContext(); |
383 Node* native_context = | 393 Node* native_context = |
384 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 394 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); |
385 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | 395 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); |
386 | 396 |
387 // Load the global via the LoadIC. | 397 // Load the global via the LoadIC. |
388 Node* code_target = __ HeapConstant(ic.code()); | 398 Node* code_target = __ HeapConstant(ic.code()); |
389 Node* constant_index = __ BytecodeOperandIdx(0); | 399 Node* constant_index = __ BytecodeOperandIdx(0); |
390 Node* name = __ LoadConstantPoolEntry(constant_index); | 400 Node* name = __ LoadConstantPoolEntry(constant_index); |
391 Node* raw_slot = __ BytecodeOperandIdx(1); | 401 Node* raw_slot = __ BytecodeOperandIdx(1); |
392 Node* smi_slot = __ SmiTag(raw_slot); | 402 Node* smi_slot = __ SmiTag(raw_slot); |
393 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 403 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
394 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, | 404 return __ CallStub(ic.descriptor(), code_target, context, global, name, |
395 name, smi_slot, type_feedback_vector); | 405 smi_slot, type_feedback_vector); |
396 __ SetAccumulator(result); | |
397 __ Dispatch(); | |
398 } | 406 } |
399 | 407 |
400 // LdaGlobal <name_index> <slot> | 408 // LdaGlobal <name_index> <slot> |
401 // | 409 // |
402 // Load the global with name in constant pool entry <name_index> into the | 410 // Load the global with name in constant pool entry <name_index> into the |
403 // accumulator using FeedBackVector slot <slot> outside of a typeof. | 411 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
404 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { | 412 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
405 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 413 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
406 UNINITIALIZED); | 414 UNINITIALIZED); |
407 DoLoadGlobal(ic, assembler); | 415 Node* result = BuildLoadGlobal(ic, assembler); |
416 __ SetAccumulator(result); | |
417 __ Dispatch(); | |
418 } | |
419 | |
420 // LdrGlobal <name_index> <slot> <reg> | |
421 // | |
422 // Load the global with name in constant pool entry <name_index> into | |
423 // register <reg> using FeedBackVector slot <slot> outside of a typeof. | |
424 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { | |
425 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
426 UNINITIALIZED); | |
427 Node* result = BuildLoadGlobal(ic, assembler); | |
428 Node* destination = __ BytecodeOperandReg(2); | |
429 __ StoreRegister(result, destination); | |
430 __ Dispatch(); | |
408 } | 431 } |
409 | 432 |
410 // LdaGlobalInsideTypeof <name_index> <slot> | 433 // LdaGlobalInsideTypeof <name_index> <slot> |
411 // | 434 // |
412 // Load the global with name in constant pool entry <name_index> into the | 435 // Load the global with name in constant pool entry <name_index> into the |
413 // accumulator using FeedBackVector slot <slot> inside of a typeof. | 436 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
414 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { | 437 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
415 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, | 438 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, |
416 UNINITIALIZED); | 439 UNINITIALIZED); |
417 DoLoadGlobal(ic, assembler); | 440 Node* result = BuildLoadGlobal(ic, assembler); |
441 __ SetAccumulator(result); | |
442 __ Dispatch(); | |
418 } | 443 } |
419 | 444 |
420 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { | 445 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
421 // Get the global object. | 446 // Get the global object. |
422 Node* context = __ GetContext(); | 447 Node* context = __ GetContext(); |
423 Node* native_context = | 448 Node* native_context = |
424 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 449 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); |
425 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | 450 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); |
426 | 451 |
427 // Store the global via the StoreIC. | 452 // Store the global via the StoreIC. |
428 Node* code_target = __ HeapConstant(ic.code()); | 453 Node* code_target = __ HeapConstant(ic.code()); |
429 Node* constant_index = __ BytecodeOperandIdx(0); | 454 Node* constant_index = __ BytecodeOperandIdx(0); |
430 Node* name = __ LoadConstantPoolEntry(constant_index); | 455 Node* name = __ LoadConstantPoolEntry(constant_index); |
431 Node* value = __ GetAccumulator(); | 456 Node* value = __ GetAccumulator(); |
432 Node* raw_slot = __ BytecodeOperandIdx(1); | 457 Node* raw_slot = __ BytecodeOperandIdx(1); |
433 Node* smi_slot = __ SmiTag(raw_slot); | 458 Node* smi_slot = __ SmiTag(raw_slot); |
434 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 459 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
435 __ CallStub(ic.descriptor(), code_target, context, global, name, value, | 460 __ CallStub(ic.descriptor(), code_target, context, global, name, value, |
436 smi_slot, type_feedback_vector); | 461 smi_slot, type_feedback_vector); |
437 __ Dispatch(); | 462 __ Dispatch(); |
438 } | 463 } |
439 | 464 |
440 // StaGlobalSloppy <name_index> <slot> | 465 // StaGlobalSloppy <name_index> <slot> |
441 // | 466 // |
442 // Store the value in the accumulator into the global with name in constant pool | 467 // Store the value in the accumulator into the global with name in constant pool |
443 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. | 468 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. |
444 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { | 469 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
445 Callable ic = | 470 Callable ic = |
446 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 471 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
447 DoStoreGlobal(ic, assembler); | 472 DoStaGlobal(ic, assembler); |
448 } | 473 } |
449 | 474 |
450 // StaGlobalStrict <name_index> <slot> | 475 // StaGlobalStrict <name_index> <slot> |
451 // | 476 // |
452 // Store the value in the accumulator into the global with name in constant pool | 477 // Store the value in the accumulator into the global with name in constant pool |
453 // entry <name_index> using FeedBackVector slot <slot> in strict mode. | 478 // entry <name_index> using FeedBackVector slot <slot> in strict mode. |
454 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { | 479 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { |
455 Callable ic = | 480 Callable ic = |
456 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | 481 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
457 DoStoreGlobal(ic, assembler); | 482 DoStaGlobal(ic, assembler); |
483 } | |
484 | |
485 compiler::Node* Interpreter::BuildLoadContextSlot( | |
486 InterpreterAssembler* assembler) { | |
487 Node* reg_index = __ BytecodeOperandReg(0); | |
488 Node* context = __ LoadRegister(reg_index); | |
489 Node* slot_index = __ BytecodeOperandIdx(1); | |
490 return __ LoadContextSlot(context, slot_index); | |
458 } | 491 } |
459 | 492 |
460 // LdaContextSlot <context> <slot_index> | 493 // LdaContextSlot <context> <slot_index> |
461 // | 494 // |
462 // Load the object in |slot_index| of |context| into the accumulator. | 495 // Load the object in |slot_index| of |context| into the accumulator. |
463 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { | 496 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { |
464 Node* reg_index = __ BytecodeOperandReg(0); | 497 Node* result = BuildLoadContextSlot(assembler); |
465 Node* context = __ LoadRegister(reg_index); | |
466 Node* slot_index = __ BytecodeOperandIdx(1); | |
467 Node* result = __ LoadContextSlot(context, slot_index); | |
468 __ SetAccumulator(result); | 498 __ SetAccumulator(result); |
469 __ Dispatch(); | 499 __ Dispatch(); |
470 } | 500 } |
471 | 501 |
502 // LdrContextSlot <context> <slot_index> <reg> | |
503 // | |
504 // Load the object in <slot_index> of <context> into register <reg>. | |
505 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) { | |
506 Node* result = BuildLoadContextSlot(assembler); | |
507 Node* destination = __ BytecodeOperandReg(2); | |
508 __ StoreRegister(result, destination); | |
509 __ Dispatch(); | |
510 } | |
511 | |
472 // StaContextSlot <context> <slot_index> | 512 // StaContextSlot <context> <slot_index> |
473 // | 513 // |
474 // Stores the object in the accumulator into |slot_index| of |context|. | 514 // Stores the object in the accumulator into |slot_index| of |context|. |
475 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { | 515 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { |
476 Node* value = __ GetAccumulator(); | 516 Node* value = __ GetAccumulator(); |
477 Node* reg_index = __ BytecodeOperandReg(0); | 517 Node* reg_index = __ BytecodeOperandReg(0); |
478 Node* context = __ LoadRegister(reg_index); | 518 Node* context = __ LoadRegister(reg_index); |
479 Node* slot_index = __ BytecodeOperandIdx(1); | 519 Node* slot_index = __ BytecodeOperandIdx(1); |
480 __ StoreContextSlot(context, slot_index, value); | 520 __ StoreContextSlot(context, slot_index, value); |
481 __ Dispatch(); | 521 __ Dispatch(); |
482 } | 522 } |
483 | 523 |
484 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, | 524 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, |
485 InterpreterAssembler* assembler) { | 525 InterpreterAssembler* assembler) { |
486 Node* index = __ BytecodeOperandIdx(0); | 526 Node* index = __ BytecodeOperandIdx(0); |
487 Node* name = __ LoadConstantPoolEntry(index); | 527 Node* name = __ LoadConstantPoolEntry(index); |
488 Node* context = __ GetContext(); | 528 Node* context = __ GetContext(); |
489 Node* result = __ CallRuntime(function_id, context, name); | 529 Node* result = __ CallRuntime(function_id, context, name); |
490 __ SetAccumulator(result); | 530 __ SetAccumulator(result); |
491 __ Dispatch(); | 531 __ Dispatch(); |
492 } | 532 } |
493 | 533 |
494 // LdaLookupSlot <name_index> | 534 // LdaLookupSlot <name_index> |
495 // | 535 // |
496 // Lookup the object with the name in constant pool entry |name_index| | 536 // Lookup the object with the name in constant pool entry |name_index| |
497 // dynamically. | 537 // dynamically. |
498 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { | 538 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { |
499 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); | 539 DoLdaLookupSlot(Runtime::kLoadLookupSlot, assembler); |
500 } | 540 } |
501 | 541 |
502 // LdaLookupSlotInsideTypeof <name_index> | 542 // LdaLookupSlotInsideTypeof <name_index> |
503 // | 543 // |
504 // Lookup the object with the name in constant pool entry |name_index| | 544 // Lookup the object with the name in constant pool entry |name_index| |
505 // dynamically without causing a NoReferenceError. | 545 // dynamically without causing a NoReferenceError. |
506 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { | 546 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { |
507 DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); | 547 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
508 } | 548 } |
509 | 549 |
510 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, | 550 void Interpreter::DoStaLookupSlot(LanguageMode language_mode, |
511 InterpreterAssembler* assembler) { | 551 InterpreterAssembler* assembler) { |
512 Node* value = __ GetAccumulator(); | 552 Node* value = __ GetAccumulator(); |
513 Node* index = __ BytecodeOperandIdx(0); | 553 Node* index = __ BytecodeOperandIdx(0); |
514 Node* name = __ LoadConstantPoolEntry(index); | 554 Node* name = __ LoadConstantPoolEntry(index); |
515 Node* context = __ GetContext(); | 555 Node* context = __ GetContext(); |
516 Node* result = __ CallRuntime(is_strict(language_mode) | 556 Node* result = __ CallRuntime(is_strict(language_mode) |
517 ? Runtime::kStoreLookupSlot_Strict | 557 ? Runtime::kStoreLookupSlot_Strict |
518 : Runtime::kStoreLookupSlot_Sloppy, | 558 : Runtime::kStoreLookupSlot_Sloppy, |
519 context, name, value); | 559 context, name, value); |
520 __ SetAccumulator(result); | 560 __ SetAccumulator(result); |
521 __ Dispatch(); | 561 __ Dispatch(); |
522 } | 562 } |
523 | 563 |
524 // StaLookupSlotSloppy <name_index> | 564 // StaLookupSlotSloppy <name_index> |
525 // | 565 // |
526 // Store the object in accumulator to the object with the name in constant | 566 // Store the object in accumulator to the object with the name in constant |
527 // pool entry |name_index| in sloppy mode. | 567 // pool entry |name_index| in sloppy mode. |
528 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { | 568 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { |
529 DoStoreLookupSlot(LanguageMode::SLOPPY, assembler); | 569 DoStaLookupSlot(LanguageMode::SLOPPY, assembler); |
530 } | 570 } |
531 | 571 |
532 // StaLookupSlotStrict <name_index> | 572 // StaLookupSlotStrict <name_index> |
533 // | 573 // |
534 // Store the object in accumulator to the object with the name in constant | 574 // Store the object in accumulator to the object with the name in constant |
535 // pool entry |name_index| in strict mode. | 575 // pool entry |name_index| in strict mode. |
536 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { | 576 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { |
537 DoStoreLookupSlot(LanguageMode::STRICT, assembler); | 577 DoStaLookupSlot(LanguageMode::STRICT, assembler); |
538 } | 578 } |
539 | 579 |
540 void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { | 580 Node* Interpreter::BuildLoadNamedProperty(Callable ic, |
581 InterpreterAssembler* assembler) { | |
541 Node* code_target = __ HeapConstant(ic.code()); | 582 Node* code_target = __ HeapConstant(ic.code()); |
542 Node* register_index = __ BytecodeOperandReg(0); | 583 Node* register_index = __ BytecodeOperandReg(0); |
543 Node* object = __ LoadRegister(register_index); | 584 Node* object = __ LoadRegister(register_index); |
544 Node* constant_index = __ BytecodeOperandIdx(1); | 585 Node* constant_index = __ BytecodeOperandIdx(1); |
545 Node* name = __ LoadConstantPoolEntry(constant_index); | 586 Node* name = __ LoadConstantPoolEntry(constant_index); |
546 Node* raw_slot = __ BytecodeOperandIdx(2); | 587 Node* raw_slot = __ BytecodeOperandIdx(2); |
547 Node* smi_slot = __ SmiTag(raw_slot); | 588 Node* smi_slot = __ SmiTag(raw_slot); |
548 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 589 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
549 Node* context = __ GetContext(); | 590 Node* context = __ GetContext(); |
550 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, | 591 return __ CallStub(ic.descriptor(), code_target, context, object, name, |
551 name, smi_slot, type_feedback_vector); | 592 smi_slot, type_feedback_vector); |
552 __ SetAccumulator(result); | |
553 __ Dispatch(); | |
554 } | 593 } |
555 | 594 |
556 // LoadIC <object> <name_index> <slot> | 595 // LoadIC <object> <name_index> <slot> |
557 // | 596 // |
558 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | 597 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
559 // constant pool entry <name_index>. | 598 // constant pool entry <name_index>. |
560 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { | 599 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { |
561 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 600 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
562 UNINITIALIZED); | 601 UNINITIALIZED); |
563 DoLoadIC(ic, assembler); | 602 Node* result = BuildLoadNamedProperty(ic, assembler); |
603 __ SetAccumulator(result); | |
604 __ Dispatch(); | |
564 } | 605 } |
565 | 606 |
566 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { | 607 // LdrNamedProperty <object> <name_index> <slot> <reg> |
608 // | |
609 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | |
610 // constant pool entry <name_index> and puts the result into register <reg>. | |
611 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { | |
612 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | |
613 UNINITIALIZED); | |
614 Node* result = BuildLoadNamedProperty(ic, assembler); | |
615 Node* destination = __ BytecodeOperandReg(3); | |
616 __ StoreRegister(result, destination); | |
617 __ Dispatch(); | |
618 } | |
619 | |
620 Node* Interpreter::BuildLoadKeyedProperty(Callable ic, | |
621 InterpreterAssembler* assembler) { | |
567 Node* code_target = __ HeapConstant(ic.code()); | 622 Node* code_target = __ HeapConstant(ic.code()); |
568 Node* reg_index = __ BytecodeOperandReg(0); | 623 Node* reg_index = __ BytecodeOperandReg(0); |
569 Node* object = __ LoadRegister(reg_index); | 624 Node* object = __ LoadRegister(reg_index); |
570 Node* name = __ GetAccumulator(); | 625 Node* name = __ GetAccumulator(); |
571 Node* raw_slot = __ BytecodeOperandIdx(1); | 626 Node* raw_slot = __ BytecodeOperandIdx(1); |
572 Node* smi_slot = __ SmiTag(raw_slot); | 627 Node* smi_slot = __ SmiTag(raw_slot); |
573 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 628 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
574 Node* context = __ GetContext(); | 629 Node* context = __ GetContext(); |
575 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, | 630 return __ CallStub(ic.descriptor(), code_target, context, object, name, |
576 name, smi_slot, type_feedback_vector); | 631 smi_slot, type_feedback_vector); |
577 __ SetAccumulator(result); | |
578 __ Dispatch(); | |
579 } | 632 } |
580 | 633 |
581 // KeyedLoadIC <object> <slot> | 634 // KeyedLoadIC <object> <slot> |
582 // | 635 // |
583 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | 636 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
584 // in the accumulator. | 637 // in the accumulator. |
585 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { | 638 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { |
586 Callable ic = | 639 Callable ic = |
587 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); | 640 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); |
588 DoKeyedLoadIC(ic, assembler); | 641 Node* result = BuildLoadKeyedProperty(ic, assembler); |
642 __ SetAccumulator(result); | |
643 __ Dispatch(); | |
644 } | |
645 | |
646 // LdrKeyedProperty <object> <slot> <reg> | |
647 // | |
648 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | |
649 // in the accumulator and puts the result in register <reg>. | |
650 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { | |
651 Callable ic = | |
652 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); | |
653 Node* result = BuildLoadKeyedProperty(ic, assembler); | |
654 Node* destination = __ BytecodeOperandReg(2); | |
655 __ StoreRegister(result, destination); | |
656 __ Dispatch(); | |
589 } | 657 } |
590 | 658 |
591 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { | 659 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
592 Node* code_target = __ HeapConstant(ic.code()); | 660 Node* code_target = __ HeapConstant(ic.code()); |
593 Node* object_reg_index = __ BytecodeOperandReg(0); | 661 Node* object_reg_index = __ BytecodeOperandReg(0); |
594 Node* object = __ LoadRegister(object_reg_index); | 662 Node* object = __ LoadRegister(object_reg_index); |
595 Node* constant_index = __ BytecodeOperandIdx(1); | 663 Node* constant_index = __ BytecodeOperandIdx(1); |
596 Node* name = __ LoadConstantPoolEntry(constant_index); | 664 Node* name = __ LoadConstantPoolEntry(constant_index); |
597 Node* value = __ GetAccumulator(); | 665 Node* value = __ GetAccumulator(); |
598 Node* raw_slot = __ BytecodeOperandIdx(2); | 666 Node* raw_slot = __ BytecodeOperandIdx(2); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 // KeyedStoreICSloppy <object> <key> <slot> | 713 // KeyedStoreICSloppy <object> <key> <slot> |
646 // | 714 // |
647 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 715 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
648 // and the key <key> with the value in the accumulator. | 716 // and the key <key> with the value in the accumulator. |
649 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { | 717 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { |
650 Callable ic = | 718 Callable ic = |
651 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 719 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
652 DoKeyedStoreIC(ic, assembler); | 720 DoKeyedStoreIC(ic, assembler); |
653 } | 721 } |
654 | 722 |
655 // KeyedStoreICStore <object> <key> <slot> | 723 // KeyedStoreICStrict <object> <key> <slot> |
656 // | 724 // |
657 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 725 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
658 // and the key <key> with the value in the accumulator. | 726 // and the key <key> with the value in the accumulator. |
659 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) { | 727 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) { |
660 Callable ic = | 728 Callable ic = |
661 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); | 729 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
662 DoKeyedStoreIC(ic, assembler); | 730 DoKeyedStoreIC(ic, assembler); |
663 } | 731 } |
664 | 732 |
665 // PushContext <context> | 733 // PushContext <context> |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1781 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1849 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
1782 __ SmiTag(new_state)); | 1850 __ SmiTag(new_state)); |
1783 __ SetAccumulator(old_state); | 1851 __ SetAccumulator(old_state); |
1784 | 1852 |
1785 __ Dispatch(); | 1853 __ Dispatch(); |
1786 } | 1854 } |
1787 | 1855 |
1788 } // namespace interpreter | 1856 } // namespace interpreter |
1789 } // namespace internal | 1857 } // namespace internal |
1790 } // namespace v8 | 1858 } // namespace v8 |
OLD | NEW |