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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecodes.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 abee9f78049502746686633adfe77f2d34e3516f..7a8954ffe63caba1e5ae9f6cd60b6642c5f6f031 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -265,12 +265,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int slot_index) {
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
int slot_index, LanguageMode language_mode) {
- if (!is_sloppy(language_mode)) {
- UNIMPLEMENTED();
- }
DCHECK(slot_index >= 0);
+ Bytecode bytecode = BytecodeForStoreGlobal(language_mode);
if (FitsInIdx8Operand(slot_index)) {
- Output(Bytecode::kStaGlobal, static_cast<uint8_t>(slot_index));
+ Output(bytecode, static_cast<uint8_t>(slot_index));
} else {
UNIMPLEMENTED();
}
@@ -809,6 +807,23 @@ Bytecode BytecodeArrayBuilder::BytecodeForKeyedStoreIC(
// static
+Bytecode BytecodeArrayBuilder::BytecodeForStoreGlobal(
+ LanguageMode language_mode) {
+ switch (language_mode) {
+ case SLOPPY:
+ return Bytecode::kStaGlobalSloppy;
+ case STRICT:
+ return Bytecode::kStaGlobalStrict;
+ case STRONG:
+ UNIMPLEMENTED();
+ default:
+ UNREACHABLE();
+ }
+ return static_cast<Bytecode>(-1);
+}
+
+
+// static
bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
return kMinUInt8 <= value && value <= kMaxUInt8;
}
« 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