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

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

Issue 1406183002: [Interpreter] Add support for strict mode global stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months 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/bytecodes.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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Output(Bytecode::kLdaGlobal, static_cast<uint8_t>(slot_index)); 258 Output(Bytecode::kLdaGlobal, static_cast<uint8_t>(slot_index));
259 } else { 259 } else {
260 UNIMPLEMENTED(); 260 UNIMPLEMENTED();
261 } 261 }
262 return *this; 262 return *this;
263 } 263 }
264 264
265 265
266 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal( 266 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
267 int slot_index, LanguageMode language_mode) { 267 int slot_index, LanguageMode language_mode) {
268 if (!is_sloppy(language_mode)) {
269 UNIMPLEMENTED();
270 }
271 DCHECK(slot_index >= 0); 268 DCHECK(slot_index >= 0);
269 Bytecode bytecode = BytecodeForStoreGlobal(language_mode);
272 if (FitsInIdx8Operand(slot_index)) { 270 if (FitsInIdx8Operand(slot_index)) {
273 Output(Bytecode::kStaGlobal, static_cast<uint8_t>(slot_index)); 271 Output(bytecode, static_cast<uint8_t>(slot_index));
274 } else { 272 } else {
275 UNIMPLEMENTED(); 273 UNIMPLEMENTED();
276 } 274 }
277 return *this; 275 return *this;
278 } 276 }
279 277
280 278
281 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, 279 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
282 int slot_index) { 280 int slot_index) {
283 DCHECK(slot_index >= 0); 281 DCHECK(slot_index >= 0);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 case STRONG: 800 case STRONG:
803 UNIMPLEMENTED(); 801 UNIMPLEMENTED();
804 default: 802 default:
805 UNREACHABLE(); 803 UNREACHABLE();
806 } 804 }
807 return static_cast<Bytecode>(-1); 805 return static_cast<Bytecode>(-1);
808 } 806 }
809 807
810 808
811 // static 809 // static
810 Bytecode BytecodeArrayBuilder::BytecodeForStoreGlobal(
811 LanguageMode language_mode) {
812 switch (language_mode) {
813 case SLOPPY:
814 return Bytecode::kStaGlobalSloppy;
815 case STRICT:
816 return Bytecode::kStaGlobalStrict;
817 case STRONG:
818 UNIMPLEMENTED();
819 default:
820 UNREACHABLE();
821 }
822 return static_cast<Bytecode>(-1);
823 }
824
825
826 // static
812 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) { 827 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
813 return kMinUInt8 <= value && value <= kMaxUInt8; 828 return kMinUInt8 <= value && value <= kMaxUInt8;
814 } 829 }
815 830
816 831
817 // static 832 // static
818 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) { 833 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) {
819 return value <= static_cast<size_t>(kMaxUInt8); 834 return value <= static_cast<size_t>(kMaxUInt8);
820 } 835 }
821 836
(...skipping 23 matching lines...) Expand all
845 860
846 Register TemporaryRegisterScope::NewRegister() { 861 Register TemporaryRegisterScope::NewRegister() {
847 count_++; 862 count_++;
848 last_register_index_ = builder_->BorrowTemporaryRegister(); 863 last_register_index_ = builder_->BorrowTemporaryRegister();
849 return Register(last_register_index_); 864 return Register(last_register_index_);
850 } 865 }
851 866
852 } // namespace interpreter 867 } // namespace interpreter
853 } // namespace internal 868 } // namespace internal
854 } // namespace v8 869 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698