diff options
Diffstat (limited to 'src/compiler/js-generic-lowering.cc')
-rw-r--r-- | src/compiler/js-generic-lowering.cc | 307 |
1 files changed, 152 insertions, 155 deletions
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc index 250a9c26..79a33774 100644 --- a/src/compiler/js-generic-lowering.cc +++ b/src/compiler/js-generic-lowering.cc @@ -5,6 +5,7 @@ #include "src/compiler/js-generic-lowering.h" #include "src/ast/ast.h" +#include "src/builtins/builtins-constructor.h" #include "src/code-factory.h" #include "src/code-stubs.h" #include "src/compiler/common-operator.h" @@ -13,6 +14,7 @@ #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties.h" #include "src/compiler/operator-properties.h" +#include "src/objects-inl.h" namespace v8 { namespace internal { @@ -87,11 +89,12 @@ void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, CallDescriptor::Flags flags, - Operator::Properties properties) { + Operator::Properties properties, + int result_size) { const CallInterfaceDescriptor& descriptor = callable.descriptor(); CallDescriptor* desc = Linkage::GetStubCallDescriptor( isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), flags, - properties); + properties, MachineType::AnyTagged(), result_size); Node* stub_code = jsgraph()->HeapConstant(callable.code()); node->InsertInput(zone(), 0, stub_code); NodeProperties::ChangeOp(node, common()->Call(desc)); @@ -142,6 +145,15 @@ void JSGenericLowering::LowerJSToBoolean(Node* node) { Operator::kEliminatable); } +void JSGenericLowering::LowerJSClassOf(Node* node) { + // The %_ClassOf intrinsic doesn't need the current context. + NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); + Callable callable = CodeFactory::ClassOf(isolate()); + node->AppendInput(zone(), graph()->start()); + ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate, + Operator::kEliminatable); +} + void JSGenericLowering::LowerJSTypeOf(Node* node) { // The typeof operator doesn't need the current context. NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant()); @@ -153,75 +165,37 @@ void JSGenericLowering::LowerJSTypeOf(Node* node) { void JSGenericLowering::LowerJSLoadProperty(Node* node) { - Node* closure = NodeProperties::GetValueInput(node, 2); - Node* effect = NodeProperties::GetEffectInput(node); - Node* control = NodeProperties::GetControlInput(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node); const PropertyAccess& p = PropertyAccessOf(node->op()); Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate()); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); - node->ReplaceInput(3, vector); - node->ReplaceInput(6, effect); + node->InsertInput(zone(), 3, vector); ReplaceWithStubCall(node, callable, flags); } void JSGenericLowering::LowerJSLoadNamed(Node* node) { - Node* closure = NodeProperties::GetValueInput(node, 1); - Node* effect = NodeProperties::GetEffectInput(node); - Node* control = NodeProperties::GetControlInput(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node); NamedAccess const& p = NamedAccessOf(node->op()); Callable callable = CodeFactory::LoadICInOptimizedCode(isolate()); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); - node->ReplaceInput(3, vector); - node->ReplaceInput(6, effect); + node->InsertInput(zone(), 3, vector); ReplaceWithStubCall(node, callable, flags); } void JSGenericLowering::LowerJSLoadGlobal(Node* node) { - Node* closure = NodeProperties::GetValueInput(node, 0); - Node* effect = NodeProperties::GetEffectInput(node); - Node* control = NodeProperties::GetControlInput(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node); const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); Callable callable = CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode()); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); - node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index())); - node->ReplaceInput(1, vector); - node->ReplaceInput(4, effect); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); + node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name())); + node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index())); + node->InsertInput(zone(), 2, vector); ReplaceWithStubCall(node, callable, flags); } @@ -230,33 +204,19 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) { Node* receiver = NodeProperties::GetValueInput(node, 0); Node* key = NodeProperties::GetValueInput(node, 1); Node* value = NodeProperties::GetValueInput(node, 2); - Node* closure = NodeProperties::GetValueInput(node, 3); - Node* effect = NodeProperties::GetEffectInput(node); - Node* control = NodeProperties::GetControlInput(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node); PropertyAccess const& p = PropertyAccessOf(node->op()); - LanguageMode language_mode = p.language_mode(); Callable callable = - CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); + CodeFactory::KeyedStoreICInOptimizedCode(isolate(), p.language_mode()); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); typedef StoreWithVectorDescriptor Descriptor; - node->InsertInputs(zone(), 0, 1); + node->InsertInputs(zone(), 0, 2); node->ReplaceInput(Descriptor::kReceiver, receiver); node->ReplaceInput(Descriptor::kName, key); node->ReplaceInput(Descriptor::kValue, value); node->ReplaceInput(Descriptor::kSlot, jsgraph()->SmiConstant(p.feedback().index())); node->ReplaceInput(Descriptor::kVector, vector); - node->ReplaceInput(7, effect); ReplaceWithStubCall(node, callable, flags); } @@ -264,39 +224,42 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) { void JSGenericLowering::LowerJSStoreNamed(Node* node) { Node* receiver = NodeProperties::GetValueInput(node, 0); Node* value = NodeProperties::GetValueInput(node, 1); - Node* closure = NodeProperties::GetValueInput(node, 2); - Node* effect = NodeProperties::GetEffectInput(node); - Node* control = NodeProperties::GetControlInput(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node); NamedAccess const& p = NamedAccessOf(node->op()); Callable callable = CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); typedef StoreWithVectorDescriptor Descriptor; - node->InsertInputs(zone(), 0, 2); + node->InsertInputs(zone(), 0, 3); node->ReplaceInput(Descriptor::kReceiver, receiver); node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); node->ReplaceInput(Descriptor::kValue, value); node->ReplaceInput(Descriptor::kSlot, jsgraph()->SmiConstant(p.feedback().index())); node->ReplaceInput(Descriptor::kVector, vector); - node->ReplaceInput(7, effect); ReplaceWithStubCall(node, callable, flags); } +void JSGenericLowering::LowerJSStoreNamedOwn(Node* node) { + Node* receiver = NodeProperties::GetValueInput(node, 0); + Node* value = NodeProperties::GetValueInput(node, 1); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + StoreNamedOwnParameters const& p = StoreNamedOwnParametersOf(node->op()); + Callable callable = CodeFactory::StoreOwnICInOptimizedCode(isolate()); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); + typedef StoreWithVectorDescriptor Descriptor; + node->InsertInputs(zone(), 0, 3); + node->ReplaceInput(Descriptor::kReceiver, receiver); + node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); + node->ReplaceInput(Descriptor::kValue, value); + node->ReplaceInput(Descriptor::kSlot, + jsgraph()->SmiConstant(p.feedback().index())); + node->ReplaceInput(Descriptor::kVector, vector); + ReplaceWithStubCall(node, callable, flags); +} void JSGenericLowering::LowerJSStoreGlobal(Node* node) { Node* value = NodeProperties::GetValueInput(node, 0); - Node* closure = NodeProperties::GetValueInput(node, 1); Node* context = NodeProperties::GetContextInput(node); Node* effect = NodeProperties::GetEffectInput(node); Node* control = NodeProperties::GetControlInput(node); @@ -304,16 +267,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) { const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); Callable callable = CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); - // Load the type feedback vector from the closure. - Node* literals = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), closure, - jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), - effect, control); - Node* vector = effect = graph()->NewNode( - machine()->Load(MachineType::AnyTagged()), literals, - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - - kHeapObjectTag), - effect, control); + Node* vector = jsgraph()->HeapConstant(p.feedback().vector()); // Load global object from the context. Node* native_context = effect = graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, @@ -325,7 +279,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) { jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), effect, control); typedef StoreWithVectorDescriptor Descriptor; - node->InsertInputs(zone(), 0, 3); + node->InsertInputs(zone(), 0, 4); node->ReplaceInput(Descriptor::kReceiver, global); node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); node->ReplaceInput(Descriptor::kValue, value); @@ -336,6 +290,13 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) { ReplaceWithStubCall(node, callable, flags); } +void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) { + DataPropertyParameters const& p = DataPropertyParametersOf(node->op()); + node->InsertInputs(zone(), 4, 2); + node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector())); + node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index())); + ReplaceWithRuntimeCall(node, Runtime::kDefineDataPropertyInLiteral); +} void JSGenericLowering::LowerJSDeleteProperty(Node* node) { LanguageMode language_mode = OpParameter<LanguageMode>(node); @@ -344,6 +305,11 @@ void JSGenericLowering::LowerJSDeleteProperty(Node* node) { : Runtime::kDeleteProperty_Sloppy); } +void JSGenericLowering::LowerJSGetSuperConstructor(Node* node) { + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + Callable callable = CodeFactory::GetSuperConstructor(isolate()); + ReplaceWithStubCall(node, callable, flags); +} void JSGenericLowering::LowerJSInstanceOf(Node* node) { CallDescriptor::Flags flags = FrameStateFlagForCall(node); @@ -358,40 +324,12 @@ void JSGenericLowering::LowerJSOrdinaryHasInstance(Node* node) { } void JSGenericLowering::LowerJSLoadContext(Node* node) { - const ContextAccess& access = ContextAccessOf(node->op()); - for (size_t i = 0; i < access.depth(); ++i) { - node->ReplaceInput( - 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), - NodeProperties::GetValueInput(node, 0), - jsgraph()->Int32Constant( - Context::SlotOffset(Context::PREVIOUS_INDEX)), - NodeProperties::GetEffectInput(node), - graph()->start())); - } - node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( - static_cast<int>(access.index())))); - node->AppendInput(zone(), graph()->start()); - NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged())); + UNREACHABLE(); // Eliminated in typed lowering. } void JSGenericLowering::LowerJSStoreContext(Node* node) { - const ContextAccess& access = ContextAccessOf(node->op()); - for (size_t i = 0; i < access.depth(); ++i) { - node->ReplaceInput( - 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), - NodeProperties::GetValueInput(node, 0), - jsgraph()->Int32Constant( - Context::SlotOffset(Context::PREVIOUS_INDEX)), - NodeProperties::GetEffectInput(node), - graph()->start())); - } - node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); - node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( - static_cast<int>(access.index())))); - NodeProperties::ChangeOp( - node, machine()->Store(StoreRepresentation(MachineRepresentation::kTagged, - kFullWriteBarrier))); + UNREACHABLE(); // Eliminated in typed lowering. } @@ -438,11 +376,18 @@ void JSGenericLowering::LowerJSCreateClosure(Node* node) { Handle<SharedFunctionInfo> const shared_info = p.shared_info(); node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info)); - // Use the FastNewClosureStub only for functions allocated in new space. + // Use the FastNewClosurebuiltin only for functions allocated in new + // space. if (p.pretenure() == NOT_TENURED) { Callable callable = CodeFactory::FastNewClosure(isolate()); + node->InsertInput(zone(), 1, + jsgraph()->HeapConstant(p.feedback().vector())); + node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); ReplaceWithStubCall(node, callable, flags); } else { + node->InsertInput(zone(), 1, + jsgraph()->HeapConstant(p.feedback().vector())); + node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure); @@ -451,14 +396,20 @@ void JSGenericLowering::LowerJSCreateClosure(Node* node) { void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) { - int const slot_count = OpParameter<int>(node->op()); + const CreateFunctionContextParameters& parameters = + CreateFunctionContextParametersOf(node->op()); + int slot_count = parameters.slot_count(); + ScopeType scope_type = parameters.scope_type(); CallDescriptor::Flags flags = FrameStateFlagForCall(node); - if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { - Callable callable = CodeFactory::FastNewFunctionContext(isolate()); + if (slot_count <= + ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { + Callable callable = + CodeFactory::FastNewFunctionContext(isolate(), scope_type); node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count)); ReplaceWithStubCall(node, callable, flags); } else { + node->InsertInput(zone(), 1, jsgraph()->SmiConstant(scope_type)); ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext); } } @@ -478,11 +429,13 @@ void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) { node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); - // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the - // initial length limit for arrays with "fast" elements kind. + // Use the FastCloneShallowArray builtin only for shallow boilerplates without + // properties up to the number of elements that the stubs can handle. if ((p.flags() & ArrayLiteral::kShallowElements) != 0 && - p.length() < JSArray::kInitialMaxFastElementArray) { - Callable callable = CodeFactory::FastCloneShallowArray(isolate()); + p.length() < + ConstructorBuiltinsAssembler::kMaximumClonedShallowArrayElements) { + Callable callable = CodeFactory::FastCloneShallowArray( + isolate(), DONT_TRACK_ALLOCATION_SITE); ReplaceWithStubCall(node, callable, flags); } else { node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); @@ -498,10 +451,11 @@ void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); - // Use the FastCloneShallowObjectStub only for shallow boilerplates without - // elements up to the number of properties that the stubs can handle. + // Use the FastCloneShallowObject builtin only for shallow boilerplates + // without elements up to the number of properties that the stubs can handle. if ((p.flags() & ObjectLiteral::kShallowProperties) != 0 && - p.length() <= FastCloneShallowObjectStub::kMaximumClonedProperties) { + p.length() <= + ConstructorBuiltinsAssembler::kMaximumClonedShallowObjectProperties) { Callable callable = CodeFactory::FastCloneShallowObject(isolate(), p.length()); ReplaceWithStubCall(node, callable, flags); @@ -554,9 +508,8 @@ void JSGenericLowering::LowerJSCreateScriptContext(Node* node) { ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext); } - -void JSGenericLowering::LowerJSCallConstruct(Node* node) { - CallConstructParameters const& p = CallConstructParametersOf(node->op()); +void JSGenericLowering::LowerJSConstruct(Node* node) { + ConstructParameters const& p = ConstructParametersOf(node->op()); int const arg_count = static_cast<int>(p.arity() - 2); CallDescriptor::Flags flags = FrameStateFlagForCall(node); Callable callable = CodeFactory::Construct(isolate()); @@ -574,9 +527,44 @@ void JSGenericLowering::LowerJSCallConstruct(Node* node) { NodeProperties::ChangeOp(node, common()->Call(desc)); } +void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { + ConstructWithSpreadParameters const& p = + ConstructWithSpreadParametersOf(node->op()); + int const arg_count = static_cast<int>(p.arity() - 2); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + Callable callable = CodeFactory::ConstructWithSpread(isolate()); + CallDescriptor* desc = Linkage::GetStubCallDescriptor( + isolate(), zone(), callable.descriptor(), arg_count + 1, flags); + Node* stub_code = jsgraph()->HeapConstant(callable.code()); + Node* stub_arity = jsgraph()->Int32Constant(arg_count); + Node* new_target = node->InputAt(arg_count + 1); + Node* receiver = jsgraph()->UndefinedConstant(); + node->RemoveInput(arg_count + 1); // Drop new target. + node->InsertInput(zone(), 0, stub_code); + node->InsertInput(zone(), 2, new_target); + node->InsertInput(zone(), 3, stub_arity); + node->InsertInput(zone(), 4, receiver); + NodeProperties::ChangeOp(node, common()->Call(desc)); +} -void JSGenericLowering::LowerJSCallFunction(Node* node) { - CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); +void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { + CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op()); + Callable callable = CodeFactory::CallForwardVarargs(isolate()); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + if (p.tail_call_mode() == TailCallMode::kAllow) { + flags |= CallDescriptor::kSupportsTailCalls; + } + CallDescriptor* desc = Linkage::GetStubCallDescriptor( + isolate(), zone(), callable.descriptor(), 1, flags); + Node* stub_code = jsgraph()->HeapConstant(callable.code()); + Node* start_index = jsgraph()->Uint32Constant(p.start_index()); + node->InsertInput(zone(), 0, stub_code); + node->InsertInput(zone(), 2, start_index); + NodeProperties::ChangeOp(node, common()->Call(desc)); +} + +void JSGenericLowering::LowerJSCall(Node* node) { + CallParameters const& p = CallParametersOf(node->op()); int const arg_count = static_cast<int>(p.arity() - 2); ConvertReceiverMode const mode = p.convert_mode(); Callable callable = CodeFactory::Call(isolate(), mode); @@ -593,6 +581,19 @@ void JSGenericLowering::LowerJSCallFunction(Node* node) { NodeProperties::ChangeOp(node, common()->Call(desc)); } +void JSGenericLowering::LowerJSCallWithSpread(Node* node) { + CallWithSpreadParameters const& p = CallWithSpreadParametersOf(node->op()); + int const arg_count = static_cast<int>(p.arity() - 2); + Callable callable = CodeFactory::CallWithSpread(isolate()); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + CallDescriptor* desc = Linkage::GetStubCallDescriptor( + isolate(), zone(), callable.descriptor(), arg_count + 1, flags); + Node* stub_code = jsgraph()->HeapConstant(callable.code()); + Node* stub_arity = jsgraph()->Int32Constant(arg_count); + node->InsertInput(zone(), 0, stub_code); + node->InsertInput(zone(), 2, stub_arity); + NodeProperties::ChangeOp(node, common()->Call(desc)); +} void JSGenericLowering::LowerJSCallRuntime(Node* node) { const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); @@ -604,33 +605,24 @@ void JSGenericLowering::LowerJSConvertReceiver(Node* node) { } void JSGenericLowering::LowerJSForInNext(Node* node) { - ReplaceWithRuntimeCall(node, Runtime::kForInNext); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + Callable callable = CodeFactory::ForInNext(isolate()); + ReplaceWithStubCall(node, callable, flags); } - void JSGenericLowering::LowerJSForInPrepare(Node* node) { - ReplaceWithRuntimeCall(node, Runtime::kForInPrepare); + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + Callable callable = CodeFactory::ForInPrepare(isolate()); + ReplaceWithStubCall(node, callable, flags, node->op()->properties(), 3); } void JSGenericLowering::LowerJSLoadMessage(Node* node) { - ExternalReference message_address = - ExternalReference::address_of_pending_message_obj(isolate()); - node->RemoveInput(NodeProperties::FirstContextIndex(node)); - node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); - node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); - NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged())); + UNREACHABLE(); // Eliminated in typed lowering. } void JSGenericLowering::LowerJSStoreMessage(Node* node) { - ExternalReference message_address = - ExternalReference::address_of_pending_message_obj(isolate()); - node->RemoveInput(NodeProperties::FirstContextIndex(node)); - node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); - node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); - StoreRepresentation representation(MachineRepresentation::kTagged, - kNoWriteBarrier); - NodeProperties::ChangeOp(node, machine()->Store(representation)); + UNREACHABLE(); // Eliminated in typed lowering. } void JSGenericLowering::LowerJSLoadModule(Node* node) { @@ -695,6 +687,11 @@ void JSGenericLowering::LowerJSStackCheck(Node* node) { ReplaceWithRuntimeCall(node, Runtime::kStackGuard); } +void JSGenericLowering::LowerJSDebugger(Node* node) { + CallDescriptor::Flags flags = FrameStateFlagForCall(node); + Callable callable = CodeFactory::HandleDebuggerStatement(isolate()); + ReplaceWithStubCall(node, callable, flags); +} Zone* JSGenericLowering::zone() const { return graph()->zone(); } |