Commit c68644bb authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[embed handlers] Make bytecode handlers isolate independent

Use BuiltinAssemblerOptions to generate AssemblerOptions when generating
the bytecode handlers (assuming v8_enable_embedded_bytecode_handlers is
on).

Mark all but InvokeIntrinsic, InvokeIntrinsicWide,
InvokeIntrinsicExtraWide, TestIn, TestInWide, TestInExtraWide and
TestTypeOf as isolate-independent. The excluded handlers create jump
tables which have absolute addresses.

Bug: v8:8068
Change-Id: Ia29e9c737ec345193e24fc2aa3684daefb113a9a
Reviewed-on: https://chromium-review.googlesource.com/1195508Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55514}
parent cb09d7b7
...@@ -316,15 +316,16 @@ bool Builtins::IsIsolateIndependent(int index) { ...@@ -316,15 +316,16 @@ bool Builtins::IsIsolateIndependent(int index) {
DCHECK(IsBuiltinId(index)); DCHECK(IsBuiltinId(index));
#ifndef V8_TARGET_ARCH_IA32 #ifndef V8_TARGET_ARCH_IA32
switch (index) { switch (index) {
// Bytecode handlers do not yet support being embedded. // The following bytecode handlers do not yet support being embedded as they
// use internal references.
#ifdef V8_EMBEDDED_BYTECODE_HANDLERS #ifdef V8_EMBEDDED_BYTECODE_HANDLERS
#define BYTECODE_BUILTIN(Name, ...) \ case kInvokeIntrinsicHandler:
case k##Name##Handler: \ case kInvokeIntrinsicWideHandler:
case k##Name##WideHandler: \ case kInvokeIntrinsicExtraWideHandler:
case k##Name##ExtraWideHandler: \ case kTestInHandler:
return false; case kTestInWideHandler:
BUILTIN_LIST_BYTECODE_HANDLERS(BYTECODE_BUILTIN) case kTestInExtraWideHandler:
#undef BYTECODE_BUILTIN case kTestTypeOfHandler:
#endif // V8_EMBEDDED_BYTECODE_HANDLERS #endif // V8_EMBEDDED_BYTECODE_HANDLERS
// TODO(jgruber): There's currently two blockers for moving // TODO(jgruber): There's currently two blockers for moving
......
...@@ -258,7 +258,8 @@ Code* GenerateBytecodeHandler(Isolate* isolate, int builtin_index, ...@@ -258,7 +258,8 @@ Code* GenerateBytecodeHandler(Isolate* isolate, int builtin_index,
} }
Handle<Code> code = interpreter::GenerateBytecodeHandler( Handle<Code> code = interpreter::GenerateBytecodeHandler(
isolate, bytecode, operand_scale, builtin_index); isolate, bytecode, operand_scale, builtin_index,
BuiltinAssemblerOptions(isolate, builtin_index));
PostBuildProfileAndTracing(isolate, *code, name); PostBuildProfileAndTracing(isolate, *code, name);
......
...@@ -3128,7 +3128,8 @@ IGNITION_HANDLER(ResumeGenerator, InterpreterAssembler) { ...@@ -3128,7 +3128,8 @@ IGNITION_HANDLER(ResumeGenerator, InterpreterAssembler) {
Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode, Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode,
OperandScale operand_scale, OperandScale operand_scale,
int builtin_index) { int builtin_index,
const AssemblerOptions& options) {
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
compiler::CodeAssemblerState state( compiler::CodeAssemblerState state(
isolate, &zone, InterpreterDispatchDescriptor{}, Code::BYTECODE_HANDLER, isolate, &zone, InterpreterDispatchDescriptor{}, Code::BYTECODE_HANDLER,
...@@ -3147,8 +3148,7 @@ Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode, ...@@ -3147,8 +3148,7 @@ Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode,
#undef CALL_GENERATOR #undef CALL_GENERATOR
} }
Handle<Code> code = compiler::CodeAssembler::GenerateCode( Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state, options);
&state, AssemblerOptions::Default(isolate));
PROFILE(isolate, CodeCreateEvent( PROFILE(isolate, CodeCreateEvent(
CodeEventListener::BYTECODE_HANDLER_TAG, CodeEventListener::BYTECODE_HANDLER_TAG,
AbstractCode::cast(*code), AbstractCode::cast(*code),
......
...@@ -10,11 +10,15 @@ ...@@ -10,11 +10,15 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
struct AssemblerOptions;
namespace interpreter { namespace interpreter {
extern Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode, extern Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode,
OperandScale operand_scale, OperandScale operand_scale,
int builtin_index); int builtin_index,
const AssemblerOptions& options);
extern Handle<Code> GenerateDeserializeLazyHandler(Isolate* isolate, extern Handle<Code> GenerateDeserializeLazyHandler(Isolate* isolate,
OperandScale operand_scale); OperandScale operand_scale);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "src/interpreter/setup-interpreter.h" #include "src/interpreter/setup-interpreter.h"
#include "src/assembler.h"
#include "src/handles-inl.h" #include "src/handles-inl.h"
#include "src/interpreter/bytecodes.h" #include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter-generator.h" #include "src/interpreter/interpreter-generator.h"
...@@ -83,8 +84,9 @@ void SetupInterpreter::InstallBytecodeHandler(Isolate* isolate, ...@@ -83,8 +84,9 @@ void SetupInterpreter::InstallBytecodeHandler(Isolate* isolate,
// Here we explicitly set the bytecode handler to not be a builtin with an // Here we explicitly set the bytecode handler to not be a builtin with an
// index of kNoBuiltinId. // index of kNoBuiltinId.
// TODO(delphick): Use builtins version instead. // TODO(delphick): Use builtins version instead.
Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale, Handle<Code> code = GenerateBytecodeHandler(
Builtins::kNoBuiltinId); isolate, bytecode, operand_scale, Builtins::kNoBuiltinId,
AssemblerOptions::Default(isolate));
dispatch_table[index] = code->entry(); dispatch_table[index] = code->entry();
if (FLAG_print_builtin_size) PrintBuiltinSize(bytecode, operand_scale, code); if (FLAG_print_builtin_size) PrintBuiltinSize(bytecode, operand_scale, code);
......
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