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

Unified Diff: src/compiler/js-generic-lowering.cc

Issue 1419823003: Remove support for "loads and stores to global vars through property cell shortcuts inst… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@disable-shortcuts
Patch Set: Addressing comments 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/compiler/bytecode-graph-builder.cc ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc
index 94b1c4e9da9be2950ffd5099ddc0d33a79e7a730..ca7c9065223d6c27183239286a495fd2c5fe5555 100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -306,25 +306,21 @@ void JSGenericLowering::LowerJSLoadNamed(Node* node) {
void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
+ Node* context = NodeProperties::GetContextInput(node);
+ Node* effect = NodeProperties::GetEffectInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
- if (p.slot_index() >= 0) {
- Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0);
- Node* script_context = node->InputAt(0);
- node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
- node->ReplaceInput(1, script_context); // Set new context...
- node->RemoveInput(2);
- node->RemoveInput(2); // ...instead of old one.
- ReplaceWithStubCall(node, callable, flags);
-
- } else {
- Callable callable = CodeFactory::LoadICInOptimizedCode(
- isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED);
- node->RemoveInput(0); // script context
- node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
- node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
- ReplaceWithStubCall(node, callable, flags);
- }
+ Callable callable = CodeFactory::LoadICInOptimizedCode(
+ isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED);
+ // Load global object from the context.
+ Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context,
+ jsgraph()->IntPtrConstant(Context::SlotOffset(
+ Context::GLOBAL_OBJECT_INDEX)),
+ effect, graph()->start());
+ node->InsertInput(zone(), 0, global);
+ node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
+ node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
+ ReplaceWithStubCall(node, callable, flags);
}
@@ -363,35 +359,27 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
+ Node* context = NodeProperties::GetContextInput(node);
+ Node* effect = NodeProperties::GetEffectInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
- if (p.slot_index() >= 0) {
- Callable callable =
- CodeFactory::StoreGlobalViaContext(isolate(), 0, p.language_mode());
- Node* script_context = node->InputAt(0);
- Node* value = node->InputAt(2);
- node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
- node->ReplaceInput(1, value);
- node->ReplaceInput(2, script_context); // Set new context...
- node->RemoveInput(3);
- node->RemoveInput(3); // ...instead of old one.
- ReplaceWithStubCall(node, callable, flags);
-
+ Callable callable = CodeFactory::StoreICInOptimizedCode(
+ isolate(), p.language_mode(), UNINITIALIZED);
+ // Load global object from the context.
+ Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context,
+ jsgraph()->IntPtrConstant(Context::SlotOffset(
+ Context::GLOBAL_OBJECT_INDEX)),
+ effect, graph()->start());
+ node->InsertInput(zone(), 0, global);
+ node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
+ if (FLAG_vector_stores) {
+ DCHECK(p.feedback().index() != -1);
+ node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
} else {
- Callable callable = CodeFactory::StoreICInOptimizedCode(
- isolate(), p.language_mode(), UNINITIALIZED);
- node->RemoveInput(0); // script context
- node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
- if (FLAG_vector_stores) {
- DCHECK(p.feedback().index() != -1);
- node->InsertInput(zone(), 3,
- jsgraph()->SmiConstant(p.feedback().index()));
- } else {
- node->RemoveInput(3);
- }
- ReplaceWithStubCall(node, callable,
- CallDescriptor::kPatchableCallSite | flags);
+ node->RemoveInput(3);
}
+ ReplaceWithStubCall(node, callable,
+ CallDescriptor::kPatchableCallSite | flags);
}
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698