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

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

Issue 1399423002: [turbofan] Introduce node regions for protection from scheduling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review 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/instruction-selector.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index de07f5a52e960a796678cf31c1ef6361d5a5b4a8..18a2f1f86c5cdda762d4081f26e5b88b990e12d2 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -46,6 +46,7 @@ class AllocationBuilder final {
// Primitive allocation of static size.
void Allocate(int size) {
+ effect_ = graph()->NewNode(jsgraph()->common()->BeginRegion(), effect_);
allocation_ = graph()->NewNode(
simplified()->Allocate(), jsgraph()->Constant(size), effect_, control_);
effect_ = allocation_;
@@ -70,8 +71,13 @@ class AllocationBuilder final {
Store(access, jsgraph()->Constant(value));
}
- Node* allocation() const { return allocation_; }
- Node* effect() const { return effect_; }
+ void Finish(Node* node) {
+ NodeProperties::SetType(allocation_, NodeProperties::GetType(node));
+ node->ReplaceInput(0, allocation_);
+ node->ReplaceInput(1, effect_);
+ node->TrimInputCount(2);
+ NodeProperties::ChangeOp(node, jsgraph()->common()->FinishRegion());
+ }
protected:
JSGraph* jsgraph() { return jsgraph_; }
@@ -1263,6 +1269,7 @@ Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
context, effect, control);
+ RelaxControls(node);
Michael Starzinger 2015/10/14 13:58:13 nit: As discussed offline, can we move this to jus
Jarin 2015/10/14 14:42:34 Done.
AllocationBuilder a(jsgraph(), simplified(), effect, control);
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
int context_length = slot_count + Context::MIN_CONTEXT_SLOTS;
@@ -1274,13 +1281,7 @@ Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
}
- // TODO(mstarzinger): We could mutate {node} into the allocation instead.
- NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node));
- ReplaceWithValue(node, node, a.effect());
- node->ReplaceInput(0, a.allocation());
- node->ReplaceInput(1, a.effect());
- node->TrimInputCount(2);
- NodeProperties::ChangeOp(node, common()->Finish(1));
+ a.Finish(node);
return Changed(node);
}
@@ -1318,6 +1319,7 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
context, effect, control);
+ RelaxControls(node);
AllocationBuilder a(jsgraph(), simplified(), effect, control);
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map());
@@ -1325,13 +1327,7 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input);
a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
- // TODO(mstarzinger): We could mutate {node} into the allocation instead.
- NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node));
- ReplaceWithValue(node, node, a.effect());
- node->ReplaceInput(0, a.allocation());
- node->ReplaceInput(1, a.effect());
- node->TrimInputCount(2);
- NodeProperties::ChangeOp(node, common()->Finish(1));
+ a.Finish(node);
return Changed(node);
}
@@ -1356,6 +1352,7 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
simplified()->LoadField(
AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
context, effect, control);
+ RelaxControls(node);
AllocationBuilder a(jsgraph(), simplified(), effect, control);
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
a.AllocateArray(context_length, factory()->block_context_map());
@@ -1366,13 +1363,7 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
}
- // TODO(mstarzinger): We could mutate {node} into the allocation instead.
- NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node));
- ReplaceWithValue(node, node, a.effect());
- node->ReplaceInput(0, a.allocation());
- node->ReplaceInput(1, a.effect());
- node->TrimInputCount(2);
- NodeProperties::ChangeOp(node, common()->Finish(1));
+ a.Finish(node);
return Changed(node);
}
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698