summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/js-generic-lowering.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/js-generic-lowering.cc')
-rw-r--r--deps/v8/src/compiler/js-generic-lowering.cc457
1 files changed, 155 insertions, 302 deletions
diff --git a/deps/v8/src/compiler/js-generic-lowering.cc b/deps/v8/src/compiler/js-generic-lowering.cc
index 68cc1cea90..300604e198 100644
--- a/deps/v8/src/compiler/js-generic-lowering.cc
+++ b/deps/v8/src/compiler/js-generic-lowering.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/graph-inl.h"
@@ -15,157 +16,13 @@ namespace v8 {
namespace internal {
namespace compiler {
-
-// TODO(mstarzinger): This is a temporary workaround for non-hydrogen stubs for
-// which we don't have an interface descriptor yet. Use ReplaceWithICStubCall
-// once these stub have been made into a HydrogenCodeStub.
-template <typename T>
-static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate,
- T* stub) {
- CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey();
- CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key);
- stub->InitializeInterfaceDescriptor(d);
- return d;
-}
-
-
-// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
-// which doesn't have an interface descriptor yet. It mimics a hydrogen code
-// stub for the underlying IC stub code.
-class LoadICStubShim : public HydrogenCodeStub {
- public:
- LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode)
- : HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) {
- i::compiler::GetInterfaceDescriptor(isolate, this);
- }
-
- virtual Handle<Code> GenerateCode() V8_OVERRIDE {
- ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_);
- return LoadIC::initialize_stub(isolate(), extra_state);
- }
-
- virtual void InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- LoadIC::ReceiverRegister(),
- LoadIC::NameRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
- }
-
- private:
- virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
- virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
- virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
-
- ContextualMode contextual_mode_;
-};
-
-
-// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
-// which doesn't have an interface descriptor yet. It mimics a hydrogen code
-// stub for the underlying IC stub code.
-class KeyedLoadICStubShim : public HydrogenCodeStub {
- public:
- explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) {
- i::compiler::GetInterfaceDescriptor(isolate, this);
- }
-
- virtual Handle<Code> GenerateCode() V8_OVERRIDE {
- return isolate()->builtins()->KeyedLoadIC_Initialize();
- }
-
- virtual void InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- KeyedLoadIC::ReceiverRegister(),
- KeyedLoadIC::NameRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
- }
-
- private:
- virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
- virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
- virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
-};
-
-
-// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
-// which doesn't have an interface descriptor yet. It mimics a hydrogen code
-// stub for the underlying IC stub code.
-class StoreICStubShim : public HydrogenCodeStub {
- public:
- StoreICStubShim(Isolate* isolate, StrictMode strict_mode)
- : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {
- i::compiler::GetInterfaceDescriptor(isolate, this);
- }
-
- virtual Handle<Code> GenerateCode() V8_OVERRIDE {
- return StoreIC::initialize_stub(isolate(), strict_mode_);
- }
-
- virtual void InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- StoreIC::ReceiverRegister(),
- StoreIC::NameRegister(),
- StoreIC::ValueRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
- }
-
- private:
- virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
- virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
- virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
-
- StrictMode strict_mode_;
-};
-
-
-// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
-// which doesn't have an interface descriptor yet. It mimics a hydrogen code
-// stub for the underlying IC stub code.
-class KeyedStoreICStubShim : public HydrogenCodeStub {
- public:
- KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode)
- : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {
- i::compiler::GetInterfaceDescriptor(isolate, this);
- }
-
- virtual Handle<Code> GenerateCode() V8_OVERRIDE {
- return strict_mode_ == SLOPPY
- ? isolate()->builtins()->KeyedStoreIC_Initialize()
- : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
- }
-
- virtual void InitializeInterfaceDescriptor(
- CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
- Register registers[] = { InterfaceDescriptor::ContextRegister(),
- KeyedStoreIC::ReceiverRegister(),
- KeyedStoreIC::NameRegister(),
- KeyedStoreIC::ValueRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
- }
-
- private:
- virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
- virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
- virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
-
- StrictMode strict_mode_;
-};
-
-
-JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph,
- MachineOperatorBuilder* machine,
- SourcePositionTable* source_positions)
- : LoweringBuilder(jsgraph->graph(), source_positions),
- info_(info),
+JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph)
+ : info_(info),
jsgraph_(jsgraph),
- linkage_(new (jsgraph->zone()) Linkage(info)),
- machine_(machine) {}
+ linkage_(new (jsgraph->zone()) Linkage(info)) {}
-void JSGenericLowering::PatchOperator(Node* node, Operator* op) {
+void JSGenericLowering::PatchOperator(Node* node, const Operator* op) {
node->set_op(op);
}
@@ -200,58 +57,45 @@ Node* JSGenericLowering::ExternalConstant(ExternalReference ref) {
}
-void JSGenericLowering::Lower(Node* node) {
- Node* replacement = NULL;
- // Dispatch according to the opcode.
+Reduction JSGenericLowering::Reduce(Node* node) {
switch (node->opcode()) {
-#define DECLARE_CASE(x) \
- case IrOpcode::k##x: \
- replacement = Lower##x(node); \
+#define DECLARE_CASE(x) \
+ case IrOpcode::k##x: \
+ Lower##x(node); \
break;
DECLARE_CASE(Branch)
JS_OP_LIST(DECLARE_CASE)
#undef DECLARE_CASE
default:
// Nothing to see.
- return;
+ return NoChange();
}
-
- // Nothing to do if lowering was done by patching the existing node.
- if (replacement == node) return;
-
- // Iterate through uses of the original node and replace uses accordingly.
- UNIMPLEMENTED();
+ return Changed(node);
}
-#define REPLACE_IC_STUB_CALL(op, StubDeclaration) \
- Node* JSGenericLowering::Lower##op(Node* node) { \
- StubDeclaration; \
- ReplaceWithICStubCall(node, &stub); \
- return node; \
+#define REPLACE_BINARY_OP_IC_CALL(op, token) \
+ void JSGenericLowering::Lower##op(Node* node) { \
+ ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \
+ CallDescriptor::kPatchableCallSiteWithNop); \
}
-REPLACE_IC_STUB_CALL(JSBitwiseOr, BinaryOpICStub stub(isolate(), Token::BIT_OR))
-REPLACE_IC_STUB_CALL(JSBitwiseXor,
- BinaryOpICStub stub(isolate(), Token::BIT_XOR))
-REPLACE_IC_STUB_CALL(JSBitwiseAnd,
- BinaryOpICStub stub(isolate(), Token::BIT_AND))
-REPLACE_IC_STUB_CALL(JSShiftLeft, BinaryOpICStub stub(isolate(), Token::SHL))
-REPLACE_IC_STUB_CALL(JSShiftRight, BinaryOpICStub stub(isolate(), Token::SAR))
-REPLACE_IC_STUB_CALL(JSShiftRightLogical,
- BinaryOpICStub stub(isolate(), Token::SHR))
-REPLACE_IC_STUB_CALL(JSAdd, BinaryOpICStub stub(isolate(), Token::ADD))
-REPLACE_IC_STUB_CALL(JSSubtract, BinaryOpICStub stub(isolate(), Token::SUB))
-REPLACE_IC_STUB_CALL(JSMultiply, BinaryOpICStub stub(isolate(), Token::MUL))
-REPLACE_IC_STUB_CALL(JSDivide, BinaryOpICStub stub(isolate(), Token::DIV))
-REPLACE_IC_STUB_CALL(JSModulus, BinaryOpICStub stub(isolate(), Token::MOD))
-REPLACE_IC_STUB_CALL(JSToNumber, ToNumberStub stub(isolate()))
-#undef REPLACE_IC_STUB_CALL
-
-
-#define REPLACE_COMPARE_IC_CALL(op, token, pure) \
- Node* JSGenericLowering::Lower##op(Node* node) { \
- ReplaceWithCompareIC(node, token, pure); \
- return node; \
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR)
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR)
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND)
+REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL)
+REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR)
+REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR)
+REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD)
+REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB)
+REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL)
+REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV)
+REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD)
+#undef REPLACE_BINARY_OP_IC_CALL
+
+
+#define REPLACE_COMPARE_IC_CALL(op, token, pure) \
+ void JSGenericLowering::Lower##op(Node* node) { \
+ ReplaceWithCompareIC(node, token, pure); \
}
REPLACE_COMPARE_IC_CALL(JSEqual, Token::EQ, false)
REPLACE_COMPARE_IC_CALL(JSNotEqual, Token::NE, false)
@@ -264,10 +108,9 @@ REPLACE_COMPARE_IC_CALL(JSGreaterThanOrEqual, Token::GTE, false)
#undef REPLACE_COMPARE_IC_CALL
-#define REPLACE_RUNTIME_CALL(op, fun) \
- Node* JSGenericLowering::Lower##op(Node* node) { \
- ReplaceWithRuntimeCall(node, fun); \
- return node; \
+#define REPLACE_RUNTIME_CALL(op, fun) \
+ void JSGenericLowering::Lower##op(Node* node) { \
+ ReplaceWithRuntimeCall(node, fun); \
}
REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof)
REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort)
@@ -280,61 +123,71 @@ REPLACE_RUNTIME_CALL(JSCreateGlobalContext, Runtime::kAbort)
#undef REPLACE_RUNTIME
-#define REPLACE_UNIMPLEMENTED(op) \
- Node* JSGenericLowering::Lower##op(Node* node) { \
- UNIMPLEMENTED(); \
- return node; \
- }
-REPLACE_UNIMPLEMENTED(JSToString)
+#define REPLACE_UNIMPLEMENTED(op) \
+ void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); }
REPLACE_UNIMPLEMENTED(JSToName)
REPLACE_UNIMPLEMENTED(JSYield)
REPLACE_UNIMPLEMENTED(JSDebugger)
#undef REPLACE_UNIMPLEMENTED
-static CallDescriptor::DeoptimizationSupport DeoptimizationSupportForNode(
- Node* node) {
- return OperatorProperties::CanLazilyDeoptimize(node->op())
- ? CallDescriptor::kCanDeoptimize
- : CallDescriptor::kCannotDeoptimize;
+static CallDescriptor::Flags FlagsForNode(Node* node) {
+ CallDescriptor::Flags result = CallDescriptor::kNoFlags;
+ if (OperatorProperties::HasFrameStateInput(node->op())) {
+ result |= CallDescriptor::kNeedsFrameState;
+ }
+ return result;
}
void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
bool pure) {
- BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack.
- CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
- CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(d);
- Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
- Node* compare;
+ Callable callable = CodeFactory::CompareIC(isolate(), token);
+ bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op());
+ CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
+ callable.descriptor(), 0,
+ CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
+ NodeVector inputs(zone());
+ inputs.reserve(node->InputCount() + 1);
+ inputs.push_back(CodeConstant(callable.code()));
+ inputs.push_back(NodeProperties::GetValueInput(node, 0));
+ inputs.push_back(NodeProperties::GetValueInput(node, 1));
+ inputs.push_back(NodeProperties::GetContextInput(node));
if (pure) {
- // A pure (strict) comparison doesn't have an effect or control.
- // But for the graph, we need to add these inputs.
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
- NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1),
- NodeProperties::GetContextInput(node),
- graph()->start(), graph()->start());
+ // A pure (strict) comparison doesn't have an effect, control or frame
+ // state. But for the graph, we need to add control and effect inputs.
+ DCHECK(!has_frame_state);
+ inputs.push_back(graph()->start());
+ inputs.push_back(graph()->start());
} else {
- compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic),
- NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1),
- NodeProperties::GetContextInput(node),
- NodeProperties::GetEffectInput(node),
- NodeProperties::GetControlInput(node));
+ DCHECK(has_frame_state == FLAG_turbo_deoptimization);
+ if (FLAG_turbo_deoptimization) {
+ inputs.push_back(NodeProperties::GetFrameStateInput(node));
+ }
+ inputs.push_back(NodeProperties::GetEffectInput(node));
+ inputs.push_back(NodeProperties::GetControlInput(node));
}
+ Node* compare =
+ graph()->NewNode(common()->Call(desc_compare),
+ static_cast<int>(inputs.size()), &inputs.front());
+
node->ReplaceInput(0, compare);
node->ReplaceInput(1, SmiConstant(token));
+
+ if (has_frame_state) {
+ // Remove the frame state from inputs.
+ node->RemoveInput(NodeProperties::FirstFrameStateIndex(node));
+ }
+
ReplaceWithRuntimeCall(node, Runtime::kBooleanize);
}
-void JSGenericLowering::ReplaceWithICStubCall(Node* node,
- HydrogenCodeStub* stub) {
- CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor();
+void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
+ CallDescriptor::Flags flags) {
CallDescriptor* desc = linkage()->GetStubCallDescriptor(
- d, 0, DeoptimizationSupportForNode(node));
- Node* stub_code = CodeConstant(stub->GetCode());
+ callable.descriptor(), 0, flags | FlagsForNode(node));
+ Node* stub_code = CodeConstant(callable.code());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
}
@@ -343,14 +196,15 @@ void JSGenericLowering::ReplaceWithICStubCall(Node* node,
void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
Builtins::JavaScript id,
int nargs) {
- CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
- CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
- CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs);
+ Callable callable =
+ CodeFactory::CallFunction(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
+ CallDescriptor* desc =
+ linkage()->GetStubCallDescriptor(callable.descriptor(), nargs);
// TODO(mstarzinger): Accessing the builtins object this way prevents sharing
// of code across native contexts. Fix this by loading from given context.
Handle<JSFunction> function(
JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
- Node* stub_code = CodeConstant(stub.GetCode());
+ Node* stub_code = CodeConstant(callable.code());
Node* function_node = FunctionConstant(function);
PatchInsertInput(node, 0, stub_code);
PatchInsertInput(node, 1, function_node);
@@ -361,11 +215,11 @@ void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
Runtime::FunctionId f,
int nargs_override) {
- Operator::Property props = node->op()->properties();
+ Operator::Properties properties = node->op()->properties();
const Runtime::Function* fun = Runtime::FunctionForId(f);
int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
- CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor(
- f, nargs, props, DeoptimizationSupportForNode(node));
+ CallDescriptor* desc =
+ linkage()->GetRuntimeCallDescriptor(f, nargs, properties);
Node* ref = ExternalConstant(ExternalReference(f, isolate()));
Node* arity = Int32Constant(nargs);
if (!centrystub_constant_.is_set()) {
@@ -378,143 +232,144 @@ void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
}
-Node* JSGenericLowering::LowerBranch(Node* node) {
- Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
- jsgraph()->TrueConstant());
- node->ReplaceInput(0, test);
- return node;
+void JSGenericLowering::LowerBranch(Node* node) {
+ if (!info()->is_typing_enabled()) {
+ // TODO(mstarzinger): If typing is enabled then simplified lowering will
+ // have inserted the correct ChangeBoolToBit, otherwise we need to perform
+ // poor-man's representation inference here and insert manual change.
+ Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
+ jsgraph()->TrueConstant());
+ node->ReplaceInput(0, test);
+ }
+}
+
+
+void JSGenericLowering::LowerJSUnaryNot(Node* node) {
+ Callable callable = CodeFactory::ToBoolean(
+ isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
+}
+
+
+void JSGenericLowering::LowerJSToBoolean(Node* node) {
+ Callable callable =
+ CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
-Node* JSGenericLowering::LowerJSUnaryNot(Node* node) {
- ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
- ReplaceWithICStubCall(node, &stub);
- return node;
+void JSGenericLowering::LowerJSToNumber(Node* node) {
+ Callable callable = CodeFactory::ToNumber(isolate());
+ ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags);
}
-Node* JSGenericLowering::LowerJSToBoolean(Node* node) {
- ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
- ReplaceWithICStubCall(node, &stub);
- return node;
+void JSGenericLowering::LowerJSToString(Node* node) {
+ ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1);
}
-Node* JSGenericLowering::LowerJSToObject(Node* node) {
+void JSGenericLowering::LowerJSToObject(Node* node) {
ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1);
- return node;
}
-Node* JSGenericLowering::LowerJSLoadProperty(Node* node) {
- KeyedLoadICStubShim stub(isolate());
- ReplaceWithICStubCall(node, &stub);
- return node;
+void JSGenericLowering::LowerJSLoadProperty(Node* node) {
+ Callable callable = CodeFactory::KeyedLoadIC(isolate());
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
-Node* JSGenericLowering::LowerJSLoadNamed(Node* node) {
+void JSGenericLowering::LowerJSLoadNamed(Node* node) {
LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
- LoadICStubShim stub(isolate(), p.contextual_mode);
+ Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode);
PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
- ReplaceWithICStubCall(node, &stub);
- return node;
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
-Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
- // TODO(mstarzinger): The strict_mode needs to be carried along in the
- // operator so that graphs are fully compositional for inlining.
- StrictMode strict_mode = info()->strict_mode();
- KeyedStoreICStubShim stub(isolate(), strict_mode);
- ReplaceWithICStubCall(node, &stub);
- return node;
+void JSGenericLowering::LowerJSStoreProperty(Node* node) {
+ StrictMode strict_mode = OpParameter<StrictMode>(node);
+ Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode);
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
-Node* JSGenericLowering::LowerJSStoreNamed(Node* node) {
- PrintableUnique<Name> key = OpParameter<PrintableUnique<Name> >(node);
- // TODO(mstarzinger): The strict_mode needs to be carried along in the
- // operator so that graphs are fully compositional for inlining.
- StrictMode strict_mode = info()->strict_mode();
- StoreICStubShim stub(isolate(), strict_mode);
- PatchInsertInput(node, 1, jsgraph()->HeapConstant(key));
- ReplaceWithICStubCall(node, &stub);
- return node;
+void JSGenericLowering::LowerJSStoreNamed(Node* node) {
+ StoreNamedParameters params = OpParameter<StoreNamedParameters>(node);
+ Callable callable = CodeFactory::StoreIC(isolate(), params.strict_mode);
+ PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name));
+ ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
}
-Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) {
+void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
StrictMode strict_mode = OpParameter<StrictMode>(node);
PatchInsertInput(node, 2, SmiConstant(strict_mode));
ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
- return node;
}
-Node* JSGenericLowering::LowerJSHasProperty(Node* node) {
+void JSGenericLowering::LowerJSHasProperty(Node* node) {
ReplaceWithBuiltinCall(node, Builtins::IN, 2);
- return node;
}
-Node* JSGenericLowering::LowerJSInstanceOf(Node* node) {
+void JSGenericLowering::LowerJSInstanceOf(Node* node) {
InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>(
InstanceofStub::kReturnTrueFalseObject |
InstanceofStub::kArgsInRegisters);
InstanceofStub stub(isolate(), flags);
- CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
+ CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0);
Node* stub_code = CodeConstant(stub.GetCode());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
- return node;
}
-Node* JSGenericLowering::LowerJSLoadContext(Node* node) {
+void JSGenericLowering::LowerJSLoadContext(Node* node) {
ContextAccess access = OpParameter<ContextAccess>(node);
// TODO(mstarzinger): Use simplified operators instead of machine operators
// here so that load/store optimization can be applied afterwards.
for (int i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
- machine()->Load(kMachineTagged),
+ machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node)));
}
node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
- PatchOperator(node, machine()->Load(kMachineTagged));
- return node;
+ PatchOperator(node, machine()->Load(kMachAnyTagged));
}
-Node* JSGenericLowering::LowerJSStoreContext(Node* node) {
+void JSGenericLowering::LowerJSStoreContext(Node* node) {
ContextAccess access = OpParameter<ContextAccess>(node);
// TODO(mstarzinger): Use simplified operators instead of machine operators
// here so that load/store optimization can be applied afterwards.
for (int i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
- machine()->Load(kMachineTagged),
+ machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node)));
}
node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
- PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier));
- return node;
+ PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged,
+ kFullWriteBarrier)));
}
-Node* JSGenericLowering::LowerJSCallConstruct(Node* node) {
+void JSGenericLowering::LowerJSCallConstruct(Node* node) {
int arity = OpParameter<int>(node);
CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
- CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
- CallDescriptor* desc = linkage()->GetStubCallDescriptor(
- d, arity, DeoptimizationSupportForNode(node));
+ CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
+ CallDescriptor* desc =
+ linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node));
Node* stub_code = CodeConstant(stub.GetCode());
Node* construct = NodeProperties::GetValueInput(node, 0);
PatchInsertInput(node, 0, stub_code);
@@ -522,29 +377,27 @@ Node* JSGenericLowering::LowerJSCallConstruct(Node* node) {
PatchInsertInput(node, 2, construct);
PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
PatchOperator(node, common()->Call(desc));
- return node;
}
-Node* JSGenericLowering::LowerJSCallFunction(Node* node) {
+void JSGenericLowering::LowerJSCallFunction(Node* node) {
CallParameters p = OpParameter<CallParameters>(node);
CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
- CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
- CallDescriptor* desc = linkage()->GetStubCallDescriptor(
- d, p.arity - 1, DeoptimizationSupportForNode(node));
+ CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
+ CallDescriptor* desc =
+ linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node));
Node* stub_code = CodeConstant(stub.GetCode());
PatchInsertInput(node, 0, stub_code);
PatchOperator(node, common()->Call(desc));
- return node;
}
-Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
+void JSGenericLowering::LowerJSCallRuntime(Node* node) {
Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
int arity = OperatorProperties::GetValueInputCount(node->op());
ReplaceWithRuntimeCall(node, function, arity);
- return node;
}
-}
-}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8