summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/builtins.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/builtins.cc')
-rw-r--r--deps/v8/src/builtins/builtins.cc87
1 files changed, 65 insertions, 22 deletions
diff --git a/deps/v8/src/builtins/builtins.cc b/deps/v8/src/builtins/builtins.cc
index ee4031d71a..b2c7433e8d 100644
--- a/deps/v8/src/builtins/builtins.cc
+++ b/deps/v8/src/builtins/builtins.cc
@@ -3,10 +3,12 @@
// found in the LICENSE file.
#include "src/builtins/builtins.h"
-#include "src/api.h"
+
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/builtins/builtins-descriptors.h"
#include "src/callable.h"
+#include "src/instruction-stream.h"
#include "src/isolate.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
@@ -49,10 +51,13 @@ struct BuiltinMetadata {
#define DECL_TFC(Name, ...) { #Name, Builtins::TFC, {} },
#define DECL_TFS(Name, ...) { #Name, Builtins::TFS, {} },
#define DECL_TFH(Name, ...) { #Name, Builtins::TFH, {} },
+#define DECL_BCH(Name, ...) { #Name "Handler", Builtins::BCH, {} }, \
+ { #Name "WideHandler", Builtins::BCH, {} }, \
+ { #Name "ExtraWideHandler", Builtins::BCH, {} },
#define DECL_ASM(Name, ...) { #Name, Builtins::ASM, {} },
const BuiltinMetadata builtin_metadata[] = {
BUILTIN_LIST(DECL_CPP, DECL_API, DECL_TFJ, DECL_TFC, DECL_TFS, DECL_TFH,
- DECL_ASM)
+ DECL_BCH, DECL_ASM)
};
#undef DECL_CPP
#undef DECL_API
@@ -60,6 +65,7 @@ const BuiltinMetadata builtin_metadata[] = {
#undef DECL_TFC
#undef DECL_TFS
#undef DECL_TFH
+#undef DECL_BCH
#undef DECL_ASM
// clang-format on
@@ -80,7 +86,13 @@ Builtins::Name Builtins::GetBuiltinFromBailoutId(BailoutId id) {
void Builtins::TearDown() { initialized_ = false; }
const char* Builtins::Lookup(Address pc) {
- // may be called during initialization (disassembler!)
+ // Off-heap pc's can be looked up through binary search.
+ if (FLAG_embedded_builtins) {
+ Code* maybe_builtin = InstructionStream::TryLookupCode(isolate_, pc);
+ if (maybe_builtin != nullptr) return name(maybe_builtin->builtin_index());
+ }
+
+ // May be called during initialization (disassembler).
if (initialized_) {
for (int i = 0; i < builtin_count; i++) {
if (isolate_->heap()->builtin(i)->contains(pc)) return name(i);
@@ -154,10 +166,11 @@ Callable Builtins::CallableFor(Isolate* isolate, Name name) {
break; \
}
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE_OTHER,
- CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN)
+ CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN, IGNORE_BUILTIN)
#undef CASE_OTHER
default:
Builtins::Kind kind = Builtins::KindOf(name);
+ DCHECK_NE(kind, BCH);
if (kind == TFJ || kind == CPP) {
return Callable(code, JSTrampolineDescriptor{});
}
@@ -287,7 +300,7 @@ bool Builtins::IsLazy(int index) {
case kThrowWasmTrapUnreachable: // Required by wasm.
case kToBooleanLazyDeoptContinuation:
case kToNumber: // Required by wasm.
- case kTypedArrayConstructorLazyDeoptContinuation:
+ case kGenericConstructorLazyDeoptContinuation:
case kWasmCompileLazy: // Required by wasm.
case kWasmStackGuard: // Required by wasm.
return false;
@@ -301,7 +314,19 @@ bool Builtins::IsLazy(int index) {
// static
bool Builtins::IsIsolateIndependent(int index) {
DCHECK(IsBuiltinId(index));
+#ifndef V8_TARGET_ARCH_IA32
switch (index) {
+// Bytecode handlers do not yet support being embedded.
+#ifdef V8_EMBEDDED_BYTECODE_HANDLERS
+#define BYTECODE_BUILTIN(Name, ...) \
+ case k##Name##Handler: \
+ case k##Name##WideHandler: \
+ case k##Name##ExtraWideHandler: \
+ return false;
+ BUILTIN_LIST_BYTECODE_HANDLERS(BYTECODE_BUILTIN)
+#undef BYTECODE_BUILTIN
+#endif // V8_EMBEDDED_BYTECODE_HANDLERS
+
// TODO(jgruber): There's currently two blockers for moving
// InterpreterEntryTrampoline into the binary:
// 1. InterpreterEnterBytecode calculates a pointer into the middle of
@@ -316,26 +341,43 @@ bool Builtins::IsIsolateIndependent(int index) {
// of the builtin itself (and not just the trampoline).
case kInterpreterEntryTrampoline:
return false;
-#if V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_MIPS
- // TODO(7882): The size of these builtins on MIP64 and MIPS32 is greater
- // than 128KB, and this triggers generation of MIPS specific trampolines.
- // Trampoline code is not PIC and therefore the builtin is not isolate
- // independent.
- case kArraySpliceTorque:
- case kKeyedLoadIC_Megamorphic:
- case kKeyedStoreIC_Megamorphic:
- case kObjectAssign:
- case kObjectGetOwnPropertyDescriptor:
- case kRegExpMatchFast:
- case kRegExpReplace:
- case kRegExpSplit:
- case kRegExpStringIteratorPrototypeNext:
- case kStoreIC_Uninitialized:
- return false;
-#endif
default:
return true;
}
+#else // V8_TARGET_ARCH_IA32
+ // TODO(jgruber, v8:6666): Implement support.
+ // ia32 is a work-in-progress. This will let us make builtins
+ // isolate-independent one-by-one.
+ switch (index) {
+ case kContinueToCodeStubBuiltin:
+ case kContinueToCodeStubBuiltinWithResult:
+ case kContinueToJavaScriptBuiltin:
+ case kContinueToJavaScriptBuiltinWithResult:
+ case kWasmAllocateHeapNumber:
+ case kWasmCallJavaScript:
+ case kWasmToNumber:
+ case kDoubleToI:
+ return true;
+ default:
+ return false;
+ }
+#endif // V8_TARGET_ARCH_IA32
+ UNREACHABLE();
+}
+
+// static
+bool Builtins::IsWasmRuntimeStub(int index) {
+ DCHECK(IsBuiltinId(index));
+ switch (index) {
+#define CASE_TRAP(Name) case kThrowWasm##Name:
+#define CASE(Name) case k##Name:
+ WASM_RUNTIME_STUB_LIST(CASE, CASE_TRAP)
+#undef CASE_TRAP
+#undef CASE
+ return true;
+ default:
+ return false;
+ }
UNREACHABLE();
}
@@ -380,6 +422,7 @@ const char* Builtins::KindNameOf(int index) {
case TFC: return "TFC";
case TFS: return "TFS";
case TFH: return "TFH";
+ case BCH: return "BCH";
case ASM: return "ASM";
}
// clang-format on