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

Unified Diff: src/hydrogen.cc

Issue 1228113008: Crankshaft part of the 'loads and stores to global vars through property cell shortcuts' feature. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments + regression test Created 5 years, 5 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/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 56980266af249194862def6a90b425c7364003b7..7c5d7df04366d65053a554cbd0f554c4729685d7 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5559,6 +5559,17 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
instr->SetDependsOnFlag(kGlobalVars);
return ast_context()->ReturnInstruction(instr, expr->id());
}
+ } else if (variable->IsGlobalSlot()) {
+ DCHECK(variable->index() > 0);
+ DCHECK(variable->IsStaticGlobalObjectProperty());
+ // Each var occupies two slots in the context: for reads and writes.
+ int slot_index = variable->index();
+ int depth = scope()->ContextChainLength(variable->scope());
+
+ HLoadGlobalViaContext* instr =
+ New<HLoadGlobalViaContext>(variable->name(), depth, slot_index);
+ return ast_context()->ReturnInstruction(instr, expr->id());
+
} else {
HValue* global_object = Add<HLoadNamedField>(
context(), nullptr,
@@ -6780,6 +6791,19 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
}
+ } else if (var->IsGlobalSlot()) {
+ DCHECK(var->index() > 0);
+ DCHECK(var->IsStaticGlobalObjectProperty());
+ // Each var occupies two slots in the context: for reads and writes.
+ int slot_index = var->index() + 1;
+ int depth = scope()->ContextChainLength(var->scope());
+
+ HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>(
+ var->name(), value, depth, slot_index, function_language_mode());
+ USE(instr);
+ DCHECK(instr->HasObservableSideEffects());
+ Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
+
} else {
HValue* global_object = Add<HLoadNamedField>(
context(), nullptr,
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698