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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 1985753002: [interpreter] Introduce fused bytecodes for common sequences. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 7 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.h ('k') | src/interpreter/bytecode-peephole-optimizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 74120095a4f71b73b406133c6cccaa18fd5c143d..63fbb29b09c3c123abab873291a4ef3f735a0c39 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -586,6 +586,11 @@ void BytecodeGraphBuilder::VisitLdaUndefined() {
environment()->BindAccumulator(node);
}
+void BytecodeGraphBuilder::VisitLdrUndefined() {
+ Node* node = jsgraph()->UndefinedConstant();
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node);
+}
+
void BytecodeGraphBuilder::VisitLdaNull() {
Node* node = jsgraph()->NullConstant();
environment()->BindAccumulator(node);
@@ -623,25 +628,32 @@ void BytecodeGraphBuilder::VisitMov() {
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value);
}
-void BytecodeGraphBuilder::BuildLoadGlobal(
- TypeofMode typeof_mode) {
- FrameStateBeforeAndAfter states(this);
+Node* BytecodeGraphBuilder::BuildLoadGlobal(TypeofMode typeof_mode) {
Handle<Name> name =
Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
VectorSlotPair feedback =
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
-
const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
- Node* node = NewNode(op, GetFunctionClosure());
- environment()->BindAccumulator(node, &states);
+ return NewNode(op, GetFunctionClosure());
}
void BytecodeGraphBuilder::VisitLdaGlobal() {
- BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
+ environment()->BindAccumulator(node, &states);
+}
+
+void BytecodeGraphBuilder::VisitLdrGlobal() {
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node,
+ &states);
}
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
- BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
+ environment()->BindAccumulator(node, &states);
}
void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) {
@@ -665,7 +677,7 @@ void BytecodeGraphBuilder::VisitStaGlobalStrict() {
BuildStoreGlobal(LanguageMode::STRICT);
}
-void BytecodeGraphBuilder::VisitLdaContextSlot() {
+Node* BytecodeGraphBuilder::BuildLoadContextSlot() {
// TODO(mythria): LoadContextSlots are unrolled by the required depth when
// generating bytecode. Hence the value of depth is always 0. Update this
// code, when the implementation changes.
@@ -676,10 +688,19 @@ void BytecodeGraphBuilder::VisitLdaContextSlot() {
0, bytecode_iterator().GetIndexOperand(1), false);
Node* context =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
- Node* node = NewNode(op, context);
+ return NewNode(op, context);
+}
+
+void BytecodeGraphBuilder::VisitLdaContextSlot() {
+ Node* node = BuildLoadContextSlot();
environment()->BindAccumulator(node);
}
+void BytecodeGraphBuilder::VisitLdrContextSlot() {
+ Node* node = BuildLoadContextSlot();
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node);
+}
+
void BytecodeGraphBuilder::VisitStaContextSlot() {
// TODO(mythria): LoadContextSlots are unrolled by the required depth when
// generating bytecode. Hence the value of depth is always 0. Update this
@@ -732,8 +753,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlotStrict() {
BuildStaLookupSlot(LanguageMode::STRICT);
}
-void BytecodeGraphBuilder::BuildNamedLoad() {
- FrameStateBeforeAndAfter states(this);
+Node* BytecodeGraphBuilder::BuildNamedLoad() {
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name =
@@ -742,14 +762,23 @@ void BytecodeGraphBuilder::BuildNamedLoad() {
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
const Operator* op = javascript()->LoadNamed(name, feedback);
- Node* node = NewNode(op, object, GetFunctionClosure());
- environment()->BindAccumulator(node, &states);
+ return NewNode(op, object, GetFunctionClosure());
}
-void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); }
+void BytecodeGraphBuilder::VisitLoadIC() {
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildNamedLoad();
+ environment()->BindAccumulator(node, &states);
+}
-void BytecodeGraphBuilder::BuildKeyedLoad() {
+void BytecodeGraphBuilder::VisitLdrNamedProperty() {
FrameStateBeforeAndAfter states(this);
+ Node* node = BuildNamedLoad();
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node,
+ &states);
+}
+
+Node* BytecodeGraphBuilder::BuildKeyedLoad() {
Node* key = environment()->LookupAccumulator();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
@@ -757,11 +786,21 @@ void BytecodeGraphBuilder::BuildKeyedLoad() {
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
const Operator* op = javascript()->LoadProperty(feedback);
- Node* node = NewNode(op, object, key, GetFunctionClosure());
+ return NewNode(op, object, key, GetFunctionClosure());
+}
+
+void BytecodeGraphBuilder::VisitKeyedLoadIC() {
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildKeyedLoad();
environment()->BindAccumulator(node, &states);
}
-void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); }
+void BytecodeGraphBuilder::VisitLdrKeyedProperty() {
+ FrameStateBeforeAndAfter states(this);
+ Node* node = BuildKeyedLoad();
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node,
+ &states);
+}
void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) {
FrameStateBeforeAndAfter states(this);
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-peephole-optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698