Commit e61d3564 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[builtins] Associate ASM builtins with descriptors

Post-stub-to-builtin migration, all explicit connection between
descriptors and their associated ASM code has been lost. This restores
the connection where possible. Builtins without an associated
descriptor are marked with the DummyDescriptor.

Drive-by: alpha-sort the descriptor list.
Drive-by: use Builtins::CallableFor in code factory.

Bug: v8:8562, v8:8553
Change-Id: If1f13bbaf7e42453b3235cc97c58ada91b5fa7b8
Reviewed-on: https://chromium-review.googlesource.com/c/1373552Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58212}
parent 996cf219
......@@ -1700,7 +1700,6 @@ v8_source_set("v8_base") {
"src/builtins/builtins-function.cc",
"src/builtins/builtins-global.cc",
"src/builtins/builtins-internal.cc",
"src/builtins/builtins-interpreter.cc",
"src/builtins/builtins-intl.cc",
"src/builtins/builtins-json.cc",
"src/builtins/builtins-math.cc",
......
This diff is collapsed.
......@@ -41,14 +41,19 @@ namespace internal {
#define DEFINE_TFH_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
#define DEFINE_ASM_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR,
DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN, IGNORE_BUILTIN)
DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN,
DEFINE_ASM_INTERFACE_DESCRIPTOR)
#undef DEFINE_TFJ_INTERFACE_DESCRIPTOR
#undef DEFINE_TFC_INTERFACE_DESCRIPTOR
#undef DEFINE_TFS_INTERFACE_DESCRIPTOR
#undef DEFINE_TFH_INTERFACE_DESCRIPTOR
#undef DEFINE_ASM_INTERFACE_DESCRIPTOR
} // namespace internal
} // namespace v8
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/builtins/builtins-utils.h"
#include "src/builtins/builtins.h"
#include "src/globals.h"
#include "src/handles-inl.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
Handle<Code> Builtins::InterpreterPushArgsThenCall(
ConvertReceiverMode receiver_mode, InterpreterPushArgsMode mode) {
switch (mode) {
case InterpreterPushArgsMode::kArrayFunction:
// There is no special-case handling of calls to Array. They will all go
// through the kOther case below.
UNREACHABLE();
case InterpreterPushArgsMode::kWithFinalSpread:
return builtin_handle(kInterpreterPushArgsThenCallWithFinalSpread);
case InterpreterPushArgsMode::kOther:
switch (receiver_mode) {
case ConvertReceiverMode::kNullOrUndefined:
return builtin_handle(kInterpreterPushUndefinedAndArgsThenCall);
case ConvertReceiverMode::kNotNullOrUndefined:
case ConvertReceiverMode::kAny:
return builtin_handle(kInterpreterPushArgsThenCall);
}
}
UNREACHABLE();
}
Handle<Code> Builtins::InterpreterPushArgsThenConstruct(
InterpreterPushArgsMode mode) {
switch (mode) {
case InterpreterPushArgsMode::kArrayFunction:
return builtin_handle(kInterpreterPushArgsThenConstructArrayFunction);
case InterpreterPushArgsMode::kWithFinalSpread:
return builtin_handle(kInterpreterPushArgsThenConstructWithFinalSpread);
case InterpreterPushArgsMode::kOther:
return builtin_handle(kInterpreterPushArgsThenConstruct);
}
UNREACHABLE();
}
} // namespace internal
} // namespace v8
......@@ -101,18 +101,6 @@ const char* Builtins::Lookup(Address pc) {
return nullptr;
}
Handle<Code> Builtins::NewFunctionContext(ScopeType scope_type) {
switch (scope_type) {
case ScopeType::EVAL_SCOPE:
return builtin_handle(kFastNewFunctionContextEval);
case ScopeType::FUNCTION_SCOPE:
return builtin_handle(kFastNewFunctionContextFunction);
default:
UNREACHABLE();
}
return Handle<Code>::null();
}
Handle<Code> Builtins::NonPrimitiveToPrimitive(ToPrimitiveHint hint) {
switch (hint) {
case ToPrimitiveHint::kDefault:
......@@ -166,7 +154,7 @@ Callable Builtins::CallableFor(Isolate* isolate, Name name) {
break; \
}
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE_OTHER,
CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN, IGNORE_BUILTIN)
CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN, CASE_OTHER)
#undef CASE_OTHER
default:
Builtins::Kind kind = Builtins::KindOf(name);
......
......@@ -76,10 +76,6 @@ class Builtins {
Handle<Code> NonPrimitiveToPrimitive(
ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
Handle<Code> OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint);
Handle<Code> InterpreterPushArgsThenCall(ConvertReceiverMode receiver_mode,
InterpreterPushArgsMode mode);
Handle<Code> InterpreterPushArgsThenConstruct(InterpreterPushArgsMode mode);
Handle<Code> NewFunctionContext(ScopeType scope_type);
Handle<Code> JSConstructStubGeneric();
// Used by CreateOffHeapTrampolines in isolate.cc.
......
......@@ -335,7 +335,7 @@ void SetupIsolateDelegate::SetupBuiltinsInternal(Isolate* isolate) {
OperandScale, Bytecode); \
AddBuiltin(builtins, index++, code);
#define BUILD_ASM(Name) \
#define BUILD_ASM(Name, InterfaceDescriptor) \
code = BuildWithMacroAssembler(isolate, index, Builtins::Generate_##Name, \
#Name); \
AddBuiltin(builtins, index++, code);
......
This diff is collapsed.
......@@ -16,71 +16,71 @@ namespace v8 {
namespace internal {
#define INTERFACE_DESCRIPTOR_LIST(V) \
V(CppBuiltinAdaptor) \
V(CEntry1ArgvOnStack) \
V(Abort) \
V(Allocate) \
V(Void) \
V(ContextOnly) \
V(NoContext) \
V(Load) \
V(LoadWithVector) \
V(LoadGlobal) \
V(LoadGlobalWithVector) \
V(Store) \
V(StoreWithVector) \
V(StoreTransition) \
V(StoreGlobal) \
V(StoreGlobalWithVector) \
V(FastNewFunctionContext) \
V(FastNewObject) \
V(RecordWrite) \
V(TypeConversion) \
V(TypeConversionStackParameter) \
V(Typeof) \
V(AllocateHeapNumber) \
V(ApiCallback) \
V(ApiGetter) \
V(ArgumentsAdaptor) \
V(ArrayConstructor) \
V(ArrayNArgumentsConstructor) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
V(AsyncFunctionStackParameter) \
V(CallVarargs) \
V(BigIntToI64) \
V(BigIntToWasmI64) \
V(BinaryOp) \
V(CallForwardVarargs) \
V(CallWithSpread) \
V(CallWithArrayLike) \
V(CallTrampoline) \
V(CallVarargs) \
V(CallWithArrayLike) \
V(CallWithSpread) \
V(CEntry1ArgvOnStack) \
V(CloneObjectWithVector) \
V(Compare) \
V(ConstructForwardVarargs) \
V(ConstructStub) \
V(ConstructVarargs) \
V(ConstructForwardVarargs) \
V(ConstructWithSpread) \
V(ConstructWithArrayLike) \
V(JSTrampoline) \
V(Abort) \
V(AllocateHeapNumber) \
V(ArrayConstructor) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
V(ArrayNArgumentsConstructor) \
V(Compare) \
V(BinaryOp) \
V(StringAt) \
V(StringSubstring) \
V(ConstructWithSpread) \
V(ContextOnly) \
V(CppBuiltinAdaptor) \
V(FastNewFunctionContext) \
V(FastNewObject) \
V(FrameDropperTrampoline) \
V(GetProperty) \
V(ArgumentsAdaptor) \
V(ApiCallback) \
V(ApiGetter) \
V(GrowArrayElements) \
V(NewArgumentsElements) \
V(InterpreterCEntry1) \
V(InterpreterCEntry2) \
V(InterpreterDispatch) \
V(InterpreterPushArgsThenCall) \
V(InterpreterPushArgsThenConstruct) \
V(InterpreterCEntry1) \
V(InterpreterCEntry2) \
V(JSTrampoline) \
V(Load) \
V(LoadGlobal) \
V(LoadGlobalWithVector) \
V(LoadWithVector) \
V(NewArgumentsElements) \
V(NoContext) \
V(RecordWrite) \
V(ResumeGenerator) \
V(FrameDropperTrampoline) \
V(RunMicrotasks) \
V(WasmMemoryGrow) \
V(WasmThrow) \
V(Store) \
V(StoreGlobal) \
V(StoreGlobalWithVector) \
V(StoreTransition) \
V(StoreWithVector) \
V(StringAt) \
V(StringSubstring) \
V(TypeConversion) \
V(TypeConversionStackParameter) \
V(Typeof) \
V(Void) \
V(WasmAtomicWake) \
V(WasmI32AtomicWait) \
V(WasmI64AtomicWait) \
V(CloneObjectWithVector) \
V(BigIntToWasmI64) \
V(BigIntToI64) \
V(WasmMemoryGrow) \
V(WasmThrow) \
BUILTIN_LIST_TFS(V)
class V8_EXPORT_PRIVATE CallInterfaceDescriptorData {
......@@ -444,6 +444,10 @@ class V8_EXPORT_PRIVATE VoidDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor)
};
// Dummy descriptor used to mark builtins that don't yet have their proper
// descriptor associated.
typedef VoidDescriptor DummyDescriptor;
class AllocateDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS_NO_CONTEXT(kRequestedSize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment