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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 950e5ef39193c3fdce0056df4c0ae2b491dd857f..cca0db87613d3191880973ccbd47680ac228608d 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -288,8 +288,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
- size_t name_index, int feedback_slot, LanguageMode language_mode) {
- Bytecode bytecode = BytecodeForLoadGlobal(language_mode);
+ size_t name_index, int feedback_slot, LanguageMode language_mode,
+ TypeofMode typeof_mode) {
+ // TODO(rmcilroy): Potentially store language and typeof information in an
+ // operand rather than having extra bytecodes.
+ Bytecode bytecode = BytecodeForLoadGlobal(language_mode, typeof_mode);
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
@@ -1030,6 +1033,10 @@ Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) {
return Bytecode::kLdaGlobalSloppyWide;
case Bytecode::kLdaGlobalStrict:
return Bytecode::kLdaGlobalStrictWide;
+ case Bytecode::kLdaGlobalInsideTypeofSloppy:
+ return Bytecode::kLdaGlobalInsideTypeofSloppyWide;
+ case Bytecode::kLdaGlobalInsideTypeofStrict:
+ return Bytecode::kLdaGlobalInsideTypeofStrictWide;
case Bytecode::kStaGlobalSloppy:
return Bytecode::kStaGlobalSloppyWide;
case Bytecode::kStaGlobalStrict:
@@ -1108,13 +1115,17 @@ Bytecode BytecodeArrayBuilder::BytecodeForKeyedStoreIC(
// static
-Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal(
- LanguageMode language_mode) {
+Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal(LanguageMode language_mode,
+ TypeofMode typeof_mode) {
switch (language_mode) {
case SLOPPY:
- return Bytecode::kLdaGlobalSloppy;
+ return typeof_mode == INSIDE_TYPEOF
+ ? Bytecode::kLdaGlobalInsideTypeofSloppy
+ : Bytecode::kLdaGlobalSloppy;
case STRICT:
- return Bytecode::kLdaGlobalStrict;
+ return typeof_mode == INSIDE_TYPEOF
+ ? Bytecode::kLdaGlobalInsideTypeofStrict
+ : Bytecode::kLdaGlobalStrict;
case STRONG:
UNIMPLEMENTED();
default:
« 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