| 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 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // LdaUndefined | 345 // LdaUndefined |
| 346 // | 346 // |
| 347 // Load Undefined into the accumulator. | 347 // Load Undefined into the accumulator. |
| 348 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { | 348 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { |
| 349 Node* undefined_value = | 349 Node* undefined_value = |
| 350 __ HeapConstant(isolate_->factory()->undefined_value()); | 350 __ HeapConstant(isolate_->factory()->undefined_value()); |
| 351 __ SetAccumulator(undefined_value); | 351 __ SetAccumulator(undefined_value); |
| 352 __ Dispatch(); | 352 __ Dispatch(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // LdrUndefined <reg> | |
| 356 // | |
| 357 // Loads undefined into the accumulator and |reg|. | |
| 358 void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) { | |
| 359 Node* undefined_value = | |
| 360 __ HeapConstant(isolate_->factory()->undefined_value()); | |
| 361 Node* destination = __ BytecodeOperandReg(0); | |
| 362 __ StoreRegister(undefined_value, destination); | |
| 363 __ Dispatch(); | |
| 364 } | |
| 365 | |
| 366 // LdaNull | 355 // LdaNull |
| 367 // | 356 // |
| 368 // Load Null into the accumulator. | 357 // Load Null into the accumulator. |
| 369 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { | 358 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { |
| 370 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); | 359 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); |
| 371 __ SetAccumulator(null_value); | 360 __ SetAccumulator(null_value); |
| 372 __ Dispatch(); | 361 __ Dispatch(); |
| 373 } | 362 } |
| 374 | 363 |
| 375 // LdaTheHole | 364 // LdaTheHole |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 442 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
| 454 | 443 |
| 455 Node* context = __ GetContext(); | 444 Node* context = __ GetContext(); |
| 456 | 445 |
| 457 Node* raw_slot = __ BytecodeOperandIdx(0); | 446 Node* raw_slot = __ BytecodeOperandIdx(0); |
| 458 Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler); | 447 Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler); |
| 459 __ SetAccumulator(result); | 448 __ SetAccumulator(result); |
| 460 __ Dispatch(); | 449 __ Dispatch(); |
| 461 } | 450 } |
| 462 | 451 |
| 463 // LdrGlobal <slot> <reg> | |
| 464 // | |
| 465 // Load the global with name in constant pool entry <name_index> into | |
| 466 // register <reg> using FeedBackVector slot <slot> outside of a typeof. | |
| 467 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { | |
| 468 Callable ic = | |
| 469 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | |
| 470 | |
| 471 Node* context = __ GetContext(); | |
| 472 | |
| 473 Node* raw_slot = __ BytecodeOperandIdx(0); | |
| 474 Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler); | |
| 475 Node* destination = __ BytecodeOperandReg(1); | |
| 476 __ StoreRegister(result, destination); | |
| 477 __ Dispatch(); | |
| 478 } | |
| 479 | |
| 480 // LdaGlobalInsideTypeof <slot> | 452 // LdaGlobalInsideTypeof <slot> |
| 481 // | 453 // |
| 482 // Load the global with name in constant pool entry <name_index> into the | 454 // Load the global with name in constant pool entry <name_index> into the |
| 483 // accumulator using FeedBackVector slot <slot> inside of a typeof. | 455 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
| 484 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { | 456 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
| 485 Callable ic = | 457 Callable ic = |
| 486 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); | 458 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
| 487 | 459 |
| 488 Node* context = __ GetContext(); | 460 Node* context = __ GetContext(); |
| 489 | 461 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 499 |
| 528 // StaGlobalStrict <name_index> <slot> | 500 // StaGlobalStrict <name_index> <slot> |
| 529 // | 501 // |
| 530 // Store the value in the accumulator into the global with name in constant pool | 502 // Store the value in the accumulator into the global with name in constant pool |
| 531 // entry <name_index> using FeedBackVector slot <slot> in strict mode. | 503 // entry <name_index> using FeedBackVector slot <slot> in strict mode. |
| 532 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { | 504 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { |
| 533 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); | 505 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
| 534 DoStaGlobal(ic, assembler); | 506 DoStaGlobal(ic, assembler); |
| 535 } | 507 } |
| 536 | 508 |
| 537 compiler::Node* Interpreter::BuildLoadContextSlot( | |
| 538 InterpreterAssembler* assembler) { | |
| 539 Node* reg_index = __ BytecodeOperandReg(0); | |
| 540 Node* context = __ LoadRegister(reg_index); | |
| 541 Node* slot_index = __ BytecodeOperandIdx(1); | |
| 542 Node* depth = __ BytecodeOperandUImm(2); | |
| 543 Node* slot_context = __ GetContextAtDepth(context, depth); | |
| 544 return __ LoadContextElement(slot_context, slot_index); | |
| 545 } | |
| 546 | |
| 547 compiler::Node* Interpreter::BuildLoadCurrentContextSlot( | |
| 548 InterpreterAssembler* assembler) { | |
| 549 Node* slot_index = __ BytecodeOperandIdx(0); | |
| 550 Node* slot_context = __ GetContext(); | |
| 551 return __ LoadContextElement(slot_context, slot_index); | |
| 552 } | |
| 553 | |
| 554 // LdaContextSlot <context> <slot_index> <depth> | 509 // LdaContextSlot <context> <slot_index> <depth> |
| 555 // | 510 // |
| 556 // Load the object in |slot_index| of the context at |depth| in the context | 511 // Load the object in |slot_index| of the context at |depth| in the context |
| 557 // chain starting at |context| into the accumulator. | 512 // chain starting at |context| into the accumulator. |
| 558 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { | 513 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { |
| 559 Node* result = BuildLoadContextSlot(assembler); | 514 Node* reg_index = __ BytecodeOperandReg(0); |
| 515 Node* context = __ LoadRegister(reg_index); |
| 516 Node* slot_index = __ BytecodeOperandIdx(1); |
| 517 Node* depth = __ BytecodeOperandUImm(2); |
| 518 Node* slot_context = __ GetContextAtDepth(context, depth); |
| 519 Node* result = __ LoadContextElement(slot_context, slot_index); |
| 560 __ SetAccumulator(result); | 520 __ SetAccumulator(result); |
| 561 __ Dispatch(); | 521 __ Dispatch(); |
| 562 } | 522 } |
| 563 | 523 |
| 564 // LdaCurrentContextSlot <slot_index> | 524 // LdaCurrentContextSlot <slot_index> |
| 565 // | 525 // |
| 566 // Load the object in |slot_index| of the current context into the accumulator. | 526 // Load the object in |slot_index| of the current context into the accumulator. |
| 567 void Interpreter::DoLdaCurrentContextSlot(InterpreterAssembler* assembler) { | 527 void Interpreter::DoLdaCurrentContextSlot(InterpreterAssembler* assembler) { |
| 568 Node* result = BuildLoadCurrentContextSlot(assembler); | 528 Node* slot_index = __ BytecodeOperandIdx(0); |
| 529 Node* slot_context = __ GetContext(); |
| 530 Node* result = __ LoadContextElement(slot_context, slot_index); |
| 569 __ SetAccumulator(result); | 531 __ SetAccumulator(result); |
| 570 __ Dispatch(); | 532 __ Dispatch(); |
| 571 } | 533 } |
| 572 | 534 |
| 573 // LdrContextSlot <context> <slot_index> <depth> <reg> | |
| 574 // | |
| 575 // Load the object in |slot_index| of the context at |depth| in the context | |
| 576 // chain of |context| into register |reg|. | |
| 577 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) { | |
| 578 Node* result = BuildLoadContextSlot(assembler); | |
| 579 Node* destination = __ BytecodeOperandReg(3); | |
| 580 __ StoreRegister(result, destination); | |
| 581 __ Dispatch(); | |
| 582 } | |
| 583 | |
| 584 // LdrCurrentContextSlot <slot_index> <reg> | |
| 585 // | |
| 586 // Load the object in |slot_index| of the current context into register |reg|. | |
| 587 void Interpreter::DoLdrCurrentContextSlot(InterpreterAssembler* assembler) { | |
| 588 Node* result = BuildLoadCurrentContextSlot(assembler); | |
| 589 Node* destination = __ BytecodeOperandReg(1); | |
| 590 __ StoreRegister(result, destination); | |
| 591 __ Dispatch(); | |
| 592 } | |
| 593 | |
| 594 // StaContextSlot <context> <slot_index> <depth> | 535 // StaContextSlot <context> <slot_index> <depth> |
| 595 // | 536 // |
| 596 // Stores the object in the accumulator into |slot_index| of the context at | 537 // Stores the object in the accumulator into |slot_index| of the context at |
| 597 // |depth| in the context chain starting at |context|. | 538 // |depth| in the context chain starting at |context|. |
| 598 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { | 539 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { |
| 599 Node* value = __ GetAccumulator(); | 540 Node* value = __ GetAccumulator(); |
| 600 Node* reg_index = __ BytecodeOperandReg(0); | 541 Node* reg_index = __ BytecodeOperandReg(0); |
| 601 Node* context = __ LoadRegister(reg_index); | 542 Node* context = __ LoadRegister(reg_index); |
| 602 Node* slot_index = __ BytecodeOperandIdx(1); | 543 Node* slot_index = __ BytecodeOperandIdx(1); |
| 603 Node* depth = __ BytecodeOperandUImm(2); | 544 Node* depth = __ BytecodeOperandUImm(2); |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2683 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2743 __ SmiTag(new_state)); | 2684 __ SmiTag(new_state)); |
| 2744 __ SetAccumulator(old_state); | 2685 __ SetAccumulator(old_state); |
| 2745 | 2686 |
| 2746 __ Dispatch(); | 2687 __ Dispatch(); |
| 2747 } | 2688 } |
| 2748 | 2689 |
| 2749 } // namespace interpreter | 2690 } // namespace interpreter |
| 2750 } // namespace internal | 2691 } // namespace internal |
| 2751 } // namespace v8 | 2692 } // namespace v8 |
| OLD | NEW |