Revert "[Turbofan] Make JSCallReducer::ReducePromiseConstructor concurrent"

This reverts commit 0c5479df6d.

Reason for revert: Turns out there is a simpler way to do this.

Original change's description:
> [Turbofan] Make JSCallReducer::ReducePromiseConstructor concurrent
> 
> The only piece missing at this point was to serialize the code
> objects for the resolve and reject handlers.
> 
> Bug: v8:7790
> Change-Id: If636f9d74dfc9606cf5f45c4f02dd118fb5d8f00
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1662295
> Commit-Queue: Michael Stanton <mvstanton@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62215}

TBR=mvstanton@chromium.org,jarin@chromium.org

Change-Id: Ie67326c850623eede8a63b50c5705682db784212
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7790
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1664052
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62231}
This commit is contained in:
Michael Stanton 2019-06-18 07:17:08 +00:00 committed by Commit Bot
parent f4053b3131
commit 597d048b81
4 changed files with 8 additions and 100 deletions

View File

@ -5579,7 +5579,6 @@ Node* JSCallReducer::CreateArtificialFrameState(
Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode());
DisallowHeapAccessIf no_heap_acess(FLAG_concurrent_inlining);
ConstructParameters const& p = ConstructParametersOf(node->op());
int arity = static_cast<int>(p.arity() - 2);
// We only inline when we have the executor.
@ -5606,13 +5605,6 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
return NoChange();
}
// Check if we've captured the resolve and reject promise code objects.
if (!native_context().GetPromiseCapabilityDefaultResolveCode().has_value() ||
!native_context().GetPromiseCapabilityDefaultRejectCode().has_value()) {
TRACE_BROKER_MISSING(broker(), "data for native context promise functions");
return NoChange();
}
SharedFunctionInfoRef promise_shared =
native_context().promise_function().shared();
@ -5675,22 +5667,19 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
// Allocate the closure for the resolve case.
SharedFunctionInfoRef resolve_shared =
native_context().promise_capability_default_resolve_shared_fun();
Handle<Code> resolve_code =
native_context().GetPromiseCapabilityDefaultResolveCode()->object();
Node* resolve = effect =
graph()->NewNode(javascript()->CreateClosure(
resolve_shared.object(),
factory()->many_closures_cell(), resolve_code),
promise_context, effect, control);
Node* resolve = effect = graph()->NewNode(
javascript()->CreateClosure(
resolve_shared.object(), factory()->many_closures_cell(),
handle(resolve_shared.object()->GetCode(), isolate())),
promise_context, effect, control);
// Allocate the closure for the reject case.
SharedFunctionInfoRef reject_shared =
native_context().promise_capability_default_reject_shared_fun();
Handle<Code> reject_code =
native_context().GetPromiseCapabilityDefaultRejectCode()->object();
Node* reject = effect = graph()->NewNode(
javascript()->CreateClosure(reject_shared.object(),
factory()->many_closures_cell(), reject_code),
javascript()->CreateClosure(
reject_shared.object(), factory()->many_closures_cell(),
handle(reject_shared.object()->GetCode(), isolate())),
promise_context, effect, control);
const std::vector<Node*> checkpoint_parameters_continuation(

View File

@ -601,19 +601,11 @@ class NativeContextData : public ContextData {
Handle<NativeContext> object);
void Serialize(JSHeapBroker* broker);
void SerializeResolveCode(JSHeapBroker* broker);
CodeData* resolve_code() const { return resolve_code_; }
void SerializeRejectCode(JSHeapBroker* broker);
CodeData* reject_code() const { return reject_code_; }
private:
bool serialized_ = false;
#define DECL_MEMBER(type, name) type##Data* name##_ = nullptr;
BROKER_NATIVE_CONTEXT_FIELDS(DECL_MEMBER)
#undef DECL_MEMBER
CodeData* resolve_code_ = nullptr;
CodeData* reject_code_ = nullptr;
ZoneVector<MapData*> function_maps_;
};
@ -2949,52 +2941,6 @@ base::Optional<JSFunctionRef> NativeContextRef::GetConstructorFunction(
}
}
void NativeContextRef::SerializePromiseCapabilityDefaultResolveCode() {
data()->AsNativeContext()->SerializeResolveCode(broker());
}
base::Optional<CodeRef>
NativeContextRef::GetPromiseCapabilityDefaultResolveCode() const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleDereference allow_handle_dereference;
AllowHandleAllocation allow_handle_allocation;
return CodeRef(
broker(),
handle(
promise_capability_default_resolve_shared_fun().object()->GetCode(),
broker()->isolate()));
}
CodeData* resolve_code = data()->AsNativeContext()->resolve_code();
if (resolve_code != nullptr) {
return CodeRef(broker(), resolve_code);
}
return base::Optional<CodeRef>();
}
void NativeContextRef::SerializePromiseCapabilityDefaultRejectCode() {
data()->AsNativeContext()->SerializeRejectCode(broker());
}
base::Optional<CodeRef>
NativeContextRef::GetPromiseCapabilityDefaultRejectCode() const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleDereference allow_handle_dereference;
AllowHandleAllocation allow_handle_allocation;
return CodeRef(
broker(),
handle(
promise_capability_default_reject_shared_fun().object()->GetCode(),
broker()->isolate()));
}
CodeData* reject_code = data()->AsNativeContext()->reject_code();
if (reject_code != nullptr) {
return CodeRef(broker(), reject_code);
}
return base::Optional<CodeRef>();
}
bool ObjectRef::IsNullOrUndefined() const {
if (IsSmi()) return false;
OddballType type = AsHeapObject().map().oddball_type();
@ -3309,26 +3255,6 @@ void NativeContextData::Serialize(JSHeapBroker* broker) {
}
}
void NativeContextData::SerializeResolveCode(JSHeapBroker* broker) {
resolve_code_ =
broker
->GetOrCreateData(
Handle<SharedFunctionInfo>::cast(
promise_capability_default_resolve_shared_fun()->object())
->GetCode())
->AsCode();
}
void NativeContextData::SerializeRejectCode(JSHeapBroker* broker) {
reject_code_ =
broker
->GetOrCreateData(
Handle<SharedFunctionInfo>::cast(
promise_capability_default_reject_shared_fun()->object())
->GetCode())
->AsCode();
}
void JSFunctionRef::Serialize() {
if (broker()->mode() == JSHeapBroker::kDisabled) return;
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);

View File

@ -389,11 +389,6 @@ class NativeContextRef : public ContextRef {
MapRef GetFunctionMapFromIndex(int index) const;
MapRef GetInitialJSArrayMap(ElementsKind kind) const;
base::Optional<JSFunctionRef> GetConstructorFunction(const MapRef& map) const;
void SerializePromiseCapabilityDefaultResolveCode();
base::Optional<CodeRef> GetPromiseCapabilityDefaultResolveCode() const;
void SerializePromiseCapabilityDefaultRejectCode();
base::Optional<CodeRef> GetPromiseCapabilityDefaultRejectCode() const;
};
class NameRef : public HeapObjectRef {

View File

@ -867,8 +867,6 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
TRACE_BROKER(broker(), "Serializing data for builtin PromiseConstructor");
// For JSCallReducer::ReducePromiseConstructor.
broker()->native_context().SerializeScopeInfo();
broker()->native_context().SerializePromiseCapabilityDefaultResolveCode();
broker()->native_context().SerializePromiseCapabilityDefaultRejectCode();
break;
}
case Builtins::kPromisePrototypeCatch: {