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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1410953003: [Interpreter] Adds delete operator to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased the patch 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( 689 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
690 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) { 690 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) {
691 DCHECK(FitsInIdx16Operand(function_id)); 691 DCHECK(FitsInIdx16Operand(function_id));
692 DCHECK(FitsInIdx8Operand(arg_count)); 692 DCHECK(FitsInIdx8Operand(arg_count));
693 Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id), 693 Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id),
694 first_arg.ToOperand(), static_cast<uint8_t>(arg_count)); 694 first_arg.ToOperand(), static_cast<uint8_t>(arg_count));
695 return *this; 695 return *this;
696 } 696 }
697 697
698 698
699 BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
700 LanguageMode language_mode) {
701 Output(BytecodeForDelete(language_mode), object.ToOperand());
702 return *this;
703 }
704
705
699 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { 706 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
700 // These constants shouldn't be added to the constant pool, the should use 707 // These constants shouldn't be added to the constant pool, the should use
701 // specialzed bytecodes instead. 708 // specialzed bytecodes instead.
702 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value())); 709 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value()));
703 DCHECK(!object.is_identical_to(isolate_->factory()->null_value())); 710 DCHECK(!object.is_identical_to(isolate_->factory()->null_value()));
704 DCHECK(!object.is_identical_to(isolate_->factory()->the_hole_value())); 711 DCHECK(!object.is_identical_to(isolate_->factory()->the_hole_value()));
705 DCHECK(!object.is_identical_to(isolate_->factory()->true_value())); 712 DCHECK(!object.is_identical_to(isolate_->factory()->true_value()));
706 DCHECK(!object.is_identical_to(isolate_->factory()->false_value())); 713 DCHECK(!object.is_identical_to(isolate_->factory()->false_value()));
707 714
708 size_t* entry = constants_map_.Find(object); 715 size_t* entry = constants_map_.Find(object);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 case CreateArgumentsType::kUnmappedArguments: 1016 case CreateArgumentsType::kUnmappedArguments:
1010 return Bytecode::kCreateUnmappedArguments; 1017 return Bytecode::kCreateUnmappedArguments;
1011 default: 1018 default:
1012 UNREACHABLE(); 1019 UNREACHABLE();
1013 } 1020 }
1014 return static_cast<Bytecode>(-1); 1021 return static_cast<Bytecode>(-1);
1015 } 1022 }
1016 1023
1017 1024
1018 // static 1025 // static
1026 Bytecode BytecodeArrayBuilder::BytecodeForDelete(LanguageMode language_mode) {
1027 switch (language_mode) {
1028 case SLOPPY:
1029 return Bytecode::kDeletePropertySloppy;
1030 case STRICT:
1031 return Bytecode::kDeletePropertyStrict;
1032 case STRONG:
1033 UNIMPLEMENTED();
1034 default:
1035 UNREACHABLE();
1036 }
1037 return static_cast<Bytecode>(-1);
1038 }
1039
1040
1041 // static
1019 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) { 1042 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
1020 return kMinUInt8 <= value && value <= kMaxUInt8; 1043 return kMinUInt8 <= value && value <= kMaxUInt8;
1021 } 1044 }
1022 1045
1023 1046
1024 // static 1047 // static
1025 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) { 1048 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) {
1026 return value <= static_cast<size_t>(kMaxUInt8); 1049 return value <= static_cast<size_t>(kMaxUInt8);
1027 } 1050 }
1028 1051
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 DCHECK_GT(next_consecutive_count_, 0); 1098 DCHECK_GT(next_consecutive_count_, 0);
1076 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1099 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1077 allocated_.push_back(next_consecutive_register_); 1100 allocated_.push_back(next_consecutive_register_);
1078 next_consecutive_count_--; 1101 next_consecutive_count_--;
1079 return Register(next_consecutive_register_++); 1102 return Register(next_consecutive_register_++);
1080 } 1103 }
1081 1104
1082 } // namespace interpreter 1105 } // namespace interpreter
1083 } // namespace internal 1106 } // namespace internal
1084 } // namespace v8 1107 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698