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

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

Issue 2187603004: [stubs] Using template magic to get the call interface descriptor type from callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@code-factory-cleanup
Patch Set: Created 4 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/compiler/js-generic-lowering.h ('k') | src/interpreter/interpreter.h » ('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 e07daf0c721936cd951d196b1af7b75eecf47611..978af8f956a6e7db6c924266ff1dfef3397e5981 100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -87,12 +87,14 @@ REPLACE_STUB_CALL(ToObject)
REPLACE_STUB_CALL(ToString)
#undef REPLACE_STUB_CALL
-void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
+void JSGenericLowering::ReplaceWithStubCall(Node* node,
+ const Callable& callable,
CallDescriptor::Flags flags) {
ReplaceWithStubCall(node, callable, flags, node->op()->properties());
}
-void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
+void JSGenericLowering::ReplaceWithStubCall(Node* node,
+ const Callable& callable,
CallDescriptor::Flags flags,
Operator::Properties properties) {
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
@@ -150,12 +152,14 @@ void JSGenericLowering::LowerJSTypeOf(Node* node) {
void JSGenericLowering::LowerJSLoadProperty(Node* node) {
+ Node* receiver = NodeProperties::GetValueInput(node, 0);
+ Node* key = NodeProperties::GetValueInput(node, 1);
Node* closure = NodeProperties::GetValueInput(node, 2);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const PropertyAccess& p = PropertyAccessOf(node->op());
- Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate());
+ auto callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate());
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
machine()->Load(MachineType::AnyTagged()), closure,
@@ -166,20 +170,26 @@ void JSGenericLowering::LowerJSLoadProperty(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
- node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
- node->ReplaceInput(3, vector);
+ typedef decltype(callable)::Descriptor Descriptor;
+ node->InsertInputs(zone(), 0, 1);
+ node->ReplaceInput(Descriptor::kReceiver, receiver);
+ node->ReplaceInput(Descriptor::kName, key);
+ node->ReplaceInput(Descriptor::kSlot,
+ jsgraph()->SmiConstant(p.feedback().index()));
+ node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(6, effect);
ReplaceWithStubCall(node, callable, flags);
}
void JSGenericLowering::LowerJSLoadNamed(Node* node) {
+ Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* closure = NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
NamedAccess const& p = NamedAccessOf(node->op());
- Callable callable = CodeFactory::LoadICInOptimizedCode(isolate());
+ auto callable = CodeFactory::LoadICInOptimizedCode(isolate());
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
machine()->Load(MachineType::AnyTagged()), closure,
@@ -190,9 +200,13 @@ void JSGenericLowering::LowerJSLoadNamed(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
- node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
- node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
- node->ReplaceInput(3, vector);
+ typedef decltype(callable)::Descriptor Descriptor;
+ node->InsertInputs(zone(), 0, 2);
+ node->ReplaceInput(Descriptor::kReceiver, receiver);
+ node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name()));
+ node->ReplaceInput(Descriptor::kSlot,
+ jsgraph()->SmiConstant(p.feedback().index()));
+ node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(6, effect);
ReplaceWithStubCall(node, callable, flags);
}
@@ -204,7 +218,7 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
Node* control = NodeProperties::GetControlInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
- Callable callable =
+ auto callable =
CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode());
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
@@ -216,8 +230,11 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
- node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index()));
- node->ReplaceInput(1, vector);
+ typedef decltype(callable)::Descriptor Descriptor;
+ node->InsertInputs(zone(), 0, 1);
+ node->ReplaceInput(Descriptor::kSlot,
+ jsgraph()->SmiConstant(p.feedback().index()));
+ node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(4, effect);
ReplaceWithStubCall(node, callable, flags);
}
@@ -233,7 +250,7 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
PropertyAccess const& p = PropertyAccessOf(node->op());
LanguageMode language_mode = p.language_mode();
- Callable callable =
+ auto callable =
CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode);
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
@@ -245,7 +262,7 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
- typedef StoreWithVectorDescriptor Descriptor;
+ typedef decltype(callable)::Descriptor Descriptor;
node->InsertInputs(zone(), 0, 1);
node->ReplaceInput(Descriptor::kReceiver, receiver);
node->ReplaceInput(Descriptor::kName, key);
@@ -266,7 +283,7 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
Node* control = NodeProperties::GetControlInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
NamedAccess const& p = NamedAccessOf(node->op());
- Callable callable =
+ auto callable =
CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode());
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
@@ -278,7 +295,7 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
- typedef StoreWithVectorDescriptor Descriptor;
+ typedef decltype(callable)::Descriptor Descriptor;
node->InsertInputs(zone(), 0, 2);
node->ReplaceInput(Descriptor::kReceiver, receiver);
node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name()));
@@ -299,7 +316,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
Node* control = NodeProperties::GetControlInput(node);
CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
- Callable callable =
+ auto callable =
CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode());
// Load the type feedback vector from the closure.
Node* literals = effect = graph()->NewNode(
@@ -321,7 +338,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
machine()->Load(MachineType::AnyTagged()), native_context,
jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
effect, control);
- typedef StoreWithVectorDescriptor Descriptor;
+ typedef decltype(callable)::Descriptor Descriptor;
node->InsertInputs(zone(), 0, 3);
node->ReplaceInput(Descriptor::kReceiver, global);
node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name()));
« no previous file with comments | « src/compiler/js-generic-lowering.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698