Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1410953003: [Interpreter] Adds delete operator to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added more tests for delete and addressed review comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 // operations, instead of calling builtins directly. 486 // operations, instead of calling builtins directly.
487 Node* reg_index = __ BytecodeOperandReg8(0); 487 Node* reg_index = __ BytecodeOperandReg8(0);
488 Node* lhs = __ LoadRegister(reg_index); 488 Node* lhs = __ LoadRegister(reg_index);
489 Node* rhs = __ GetAccumulator(); 489 Node* rhs = __ GetAccumulator();
490 Node* result = __ CallRuntime(function_id, lhs, rhs); 490 Node* result = __ CallRuntime(function_id, lhs, rhs);
491 __ SetAccumulator(result); 491 __ SetAccumulator(result);
492 __ Dispatch(); 492 __ Dispatch();
493 } 493 }
494 494
495 495
496 void Interpreter::DoDelete(Runtime::FunctionId function_id,
497 compiler::InterpreterAssembler* assembler) {
rmcilroy 2015/10/26 14:31:07 indentation
mythria 2015/10/27 10:50:48 Done.
498 Node* reg_index = __ BytecodeOperandReg8(0);
499 Node* object = __ LoadRegister(reg_index);
500 Node* key = __ GetAccumulator();
501 Node* result = __ CallRuntime(function_id, object, key);
502 __ SetAccumulator(result);
503 __ Dispatch();
504 }
rmcilroy 2015/10/26 14:31:07 nit - move this to be directly above DeletePropert
mythria 2015/10/27 10:50:48 Done.
505
506
496 // Add <src> 507 // Add <src>
497 // 508 //
498 // Add register <src> to accumulator. 509 // Add register <src> to accumulator.
499 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) { 510 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) {
500 DoBinaryOp(Runtime::kAdd, assembler); 511 DoBinaryOp(Runtime::kAdd, assembler);
501 } 512 }
502 513
503 514
504 // Sub <src> 515 // Sub <src>
505 // 516 //
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // Load the accumulator with the string representating type of the 645 // Load the accumulator with the string representating type of the
635 // object in the accumulator. 646 // object in the accumulator.
636 void Interpreter::DoTypeOf(compiler::InterpreterAssembler* assembler) { 647 void Interpreter::DoTypeOf(compiler::InterpreterAssembler* assembler) {
637 Node* accumulator = __ GetAccumulator(); 648 Node* accumulator = __ GetAccumulator();
638 Node* result = __ CallRuntime(Runtime::kInterpreterTypeOf, accumulator); 649 Node* result = __ CallRuntime(Runtime::kInterpreterTypeOf, accumulator);
639 __ SetAccumulator(result); 650 __ SetAccumulator(result);
640 __ Dispatch(); 651 __ Dispatch();
641 } 652 }
642 653
643 654
655 // DeletePropertyStrict
656 //
657 // Delete the property specified in the accumulator from the object
658 // referenced by the register operand following strict mode semantics.
659 void Interpreter::DoDeletePropertyStrict(
660 compiler::InterpreterAssembler* assembler) {
661 DoDelete(Runtime::kDeleteProperty_Strict, assembler);
662 }
663
664
665 // DeletePropertySloppy
666 //
667 // Delete the property specified in the accumulator from the object
668 // referenced by the register operand following sloppy mode semantics.
669 void Interpreter::DoDeletePropertySloppy(
670 compiler::InterpreterAssembler* assembler) {
671 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler);
672 }
673
674
644 // Call <callable> <receiver> <arg_count> 675 // Call <callable> <receiver> <arg_count>
645 // 676 //
646 // Call a JSfunction or Callable in |callable| with the |receiver| and 677 // Call a JSfunction or Callable in |callable| with the |receiver| and
647 // |arg_count| arguments in subsequent registers. 678 // |arg_count| arguments in subsequent registers.
648 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { 679 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) {
649 Node* function_reg = __ BytecodeOperandReg8(0); 680 Node* function_reg = __ BytecodeOperandReg8(0);
650 Node* function = __ LoadRegister(function_reg); 681 Node* function = __ LoadRegister(function_reg);
651 Node* receiver_reg = __ BytecodeOperandReg8(1); 682 Node* receiver_reg = __ BytecodeOperandReg8(1);
652 Node* first_arg = __ RegisterLocation(receiver_reg); 683 Node* first_arg = __ RegisterLocation(receiver_reg);
653 Node* args_count = __ BytecodeOperandCount8(2); 684 Node* args_count = __ BytecodeOperandCount8(2);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // 1098 //
1068 // Return the value in the accumulator. 1099 // Return the value in the accumulator.
1069 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 1100 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
1070 __ Return(); 1101 __ Return();
1071 } 1102 }
1072 1103
1073 1104
1074 } // namespace interpreter 1105 } // namespace interpreter
1075 } // namespace internal 1106 } // namespace internal
1076 } // namespace v8 1107 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698