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

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

Issue 1422443006: [Intepreter] Don't throw reference errors for globals in typeof. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister( 281 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
282 Register reg) { 282 Register reg) {
283 // TODO(oth): Avoid storing the accumulator in the register if the 283 // TODO(oth): Avoid storing the accumulator in the register if the
284 // previous bytecode loaded the accumulator with the same register. 284 // previous bytecode loaded the accumulator with the same register.
285 Output(Bytecode::kStar, reg.ToOperand()); 285 Output(Bytecode::kStar, reg.ToOperand());
286 return *this; 286 return *this;
287 } 287 }
288 288
289 289
290 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal( 290 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
291 size_t name_index, int feedback_slot, LanguageMode language_mode) { 291 size_t name_index, int feedback_slot, LanguageMode language_mode,
292 Bytecode bytecode = BytecodeForLoadGlobal(language_mode); 292 TypeofMode typeof_mode) {
293 // TODO(rmcilroy): Potentially store language and typeof information in an
294 // operand rather than having extra bytecodes.
295 Bytecode bytecode = BytecodeForLoadGlobal(language_mode, typeof_mode);
293 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { 296 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
294 Output(bytecode, static_cast<uint8_t>(name_index), 297 Output(bytecode, static_cast<uint8_t>(name_index),
295 static_cast<uint8_t>(feedback_slot)); 298 static_cast<uint8_t>(feedback_slot));
296 } else if (FitsInIdx16Operand(name_index) && 299 } else if (FitsInIdx16Operand(name_index) &&
297 FitsInIdx16Operand(feedback_slot)) { 300 FitsInIdx16Operand(feedback_slot)) {
298 Output(BytecodeForWideOperands(bytecode), static_cast<uint16_t>(name_index), 301 Output(BytecodeForWideOperands(bytecode), static_cast<uint16_t>(name_index),
299 static_cast<uint16_t>(feedback_slot)); 302 static_cast<uint16_t>(feedback_slot));
300 } else { 303 } else {
301 UNIMPLEMENTED(); 304 UNIMPLEMENTED();
302 } 305 }
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 case Bytecode::kStoreICStrict: 1026 case Bytecode::kStoreICStrict:
1024 return Bytecode::kStoreICStrictWide; 1027 return Bytecode::kStoreICStrictWide;
1025 case Bytecode::kKeyedStoreICSloppy: 1028 case Bytecode::kKeyedStoreICSloppy:
1026 return Bytecode::kKeyedStoreICSloppyWide; 1029 return Bytecode::kKeyedStoreICSloppyWide;
1027 case Bytecode::kKeyedStoreICStrict: 1030 case Bytecode::kKeyedStoreICStrict:
1028 return Bytecode::kKeyedStoreICStrictWide; 1031 return Bytecode::kKeyedStoreICStrictWide;
1029 case Bytecode::kLdaGlobalSloppy: 1032 case Bytecode::kLdaGlobalSloppy:
1030 return Bytecode::kLdaGlobalSloppyWide; 1033 return Bytecode::kLdaGlobalSloppyWide;
1031 case Bytecode::kLdaGlobalStrict: 1034 case Bytecode::kLdaGlobalStrict:
1032 return Bytecode::kLdaGlobalStrictWide; 1035 return Bytecode::kLdaGlobalStrictWide;
1036 case Bytecode::kLdaGlobalInsideTypeofSloppy:
1037 return Bytecode::kLdaGlobalInsideTypeofSloppyWide;
1038 case Bytecode::kLdaGlobalInsideTypeofStrict:
1039 return Bytecode::kLdaGlobalInsideTypeofStrictWide;
1033 case Bytecode::kStaGlobalSloppy: 1040 case Bytecode::kStaGlobalSloppy:
1034 return Bytecode::kStaGlobalSloppyWide; 1041 return Bytecode::kStaGlobalSloppyWide;
1035 case Bytecode::kStaGlobalStrict: 1042 case Bytecode::kStaGlobalStrict:
1036 return Bytecode::kStaGlobalStrictWide; 1043 return Bytecode::kStaGlobalStrictWide;
1037 default: 1044 default:
1038 UNREACHABLE(); 1045 UNREACHABLE();
1039 return static_cast<Bytecode>(-1); 1046 return static_cast<Bytecode>(-1);
1040 } 1047 }
1041 } 1048 }
1042 1049
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 case STRONG: 1108 case STRONG:
1102 UNIMPLEMENTED(); 1109 UNIMPLEMENTED();
1103 default: 1110 default:
1104 UNREACHABLE(); 1111 UNREACHABLE();
1105 } 1112 }
1106 return static_cast<Bytecode>(-1); 1113 return static_cast<Bytecode>(-1);
1107 } 1114 }
1108 1115
1109 1116
1110 // static 1117 // static
1111 Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal( 1118 Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal(LanguageMode language_mode,
1112 LanguageMode language_mode) { 1119 TypeofMode typeof_mode) {
1113 switch (language_mode) { 1120 switch (language_mode) {
1114 case SLOPPY: 1121 case SLOPPY:
1115 return Bytecode::kLdaGlobalSloppy; 1122 return typeof_mode == INSIDE_TYPEOF
1123 ? Bytecode::kLdaGlobalInsideTypeofSloppy
1124 : Bytecode::kLdaGlobalSloppy;
1116 case STRICT: 1125 case STRICT:
1117 return Bytecode::kLdaGlobalStrict; 1126 return typeof_mode == INSIDE_TYPEOF
1127 ? Bytecode::kLdaGlobalInsideTypeofStrict
1128 : Bytecode::kLdaGlobalStrict;
1118 case STRONG: 1129 case STRONG:
1119 UNIMPLEMENTED(); 1130 UNIMPLEMENTED();
1120 default: 1131 default:
1121 UNREACHABLE(); 1132 UNREACHABLE();
1122 } 1133 }
1123 return static_cast<Bytecode>(-1); 1134 return static_cast<Bytecode>(-1);
1124 } 1135 }
1125 1136
1126 1137
1127 // static 1138 // static
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 DCHECK_GT(next_consecutive_count_, 0); 1258 DCHECK_GT(next_consecutive_count_, 0);
1248 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1259 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1249 allocated_.push_back(next_consecutive_register_); 1260 allocated_.push_back(next_consecutive_register_);
1250 next_consecutive_count_--; 1261 next_consecutive_count_--;
1251 return Register(next_consecutive_register_++); 1262 return Register(next_consecutive_register_++);
1252 } 1263 }
1253 1264
1254 } // namespace interpreter 1265 } // namespace interpreter
1255 } // namespace internal 1266 } // namespace internal
1256 } // namespace v8 1267 } // 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