Commit c8a727de authored by jkummerow's avatar jkummerow Committed by Commit bot

[interpreter] Split out intrinsics generation

This frees up the InterpreterAssembler for no longer being linked
into the main library.

BUG=v8:6055

Review-Url: https://codereview.chromium.org/2759093004
Cr-Commit-Position: refs/heads/master@{#43979}
parent 0feed731
...@@ -939,8 +939,12 @@ v8_source_set("v8_builtins_generators") { ...@@ -939,8 +939,12 @@ v8_source_set("v8_builtins_generators") {
"src/ic/accessor-assembler.h", "src/ic/accessor-assembler.h",
"src/ic/keyed-store-generic.cc", "src/ic/keyed-store-generic.cc",
"src/ic/keyed-store-generic.h", "src/ic/keyed-store-generic.h",
"src/interpreter/interpreter-assembler.cc",
"src/interpreter/interpreter-assembler.h",
"src/interpreter/interpreter-generator.cc", "src/interpreter/interpreter-generator.cc",
"src/interpreter/interpreter-generator.h", "src/interpreter/interpreter-generator.h",
"src/interpreter/interpreter-intrinsics-generator.cc",
"src/interpreter/interpreter-intrinsics-generator.h",
] ]
if (v8_current_cpu == "x86") { if (v8_current_cpu == "x86") {
...@@ -1642,8 +1646,6 @@ v8_source_set("v8_base") { ...@@ -1642,8 +1646,6 @@ v8_source_set("v8_base") {
"src/interpreter/control-flow-builders.h", "src/interpreter/control-flow-builders.h",
"src/interpreter/handler-table-builder.cc", "src/interpreter/handler-table-builder.cc",
"src/interpreter/handler-table-builder.h", "src/interpreter/handler-table-builder.h",
"src/interpreter/interpreter-assembler.cc",
"src/interpreter/interpreter-assembler.h",
"src/interpreter/interpreter-generator.h", "src/interpreter/interpreter-generator.h",
"src/interpreter/interpreter-intrinsics.cc", "src/interpreter/interpreter-intrinsics.cc",
"src/interpreter/interpreter-intrinsics.h", "src/interpreter/interpreter-intrinsics.h",
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "src/interpreter/bytecode-flags.h" #include "src/interpreter/bytecode-flags.h"
#include "src/interpreter/bytecodes.h" #include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter-assembler.h" #include "src/interpreter/interpreter-assembler.h"
#include "src/interpreter/interpreter-intrinsics.h" #include "src/interpreter/interpreter-intrinsics-generator.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
namespace v8 { namespace v8 {
...@@ -2123,9 +2123,8 @@ void InterpreterGenerator::DoInvokeIntrinsic(InterpreterAssembler* assembler) { ...@@ -2123,9 +2123,8 @@ void InterpreterGenerator::DoInvokeIntrinsic(InterpreterAssembler* assembler) {
Node* first_arg_reg = __ BytecodeOperandReg(1); Node* first_arg_reg = __ BytecodeOperandReg(1);
Node* arg_count = __ BytecodeOperandCount(2); Node* arg_count = __ BytecodeOperandCount(2);
Node* context = __ GetContext(); Node* context = __ GetContext();
IntrinsicsHelper helper(assembler); Node* result = GenerateInvokeIntrinsic(assembler, function_id, context,
Node* result = first_arg_reg, arg_count);
helper.InvokeIntrinsic(function_id, context, first_arg_reg, arg_count);
__ SetAccumulator(result); __ SetAccumulator(result);
__ Dispatch(); __ Dispatch();
} }
......
This diff is collapsed.
// Copyright 2017 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.
#ifndef V8_INTERPRETER_INTERPRETER_INTRINSICS_GENERATOR_H_
#define V8_INTERPRETER_INTERPRETER_INTRINSICS_GENERATOR_H_
namespace v8 {
namespace internal {
namespace compiler {
class Node;
} // namespace compiler
namespace interpreter {
class InterpreterAssembler;
extern compiler::Node* GenerateInvokeIntrinsic(InterpreterAssembler* assembler,
compiler::Node* function_id,
compiler::Node* context,
compiler::Node* first_arg_reg,
compiler::Node* arg_count);
} // namespace interpreter
} // namespace internal
} // namespace v8
#endif // V8_INTERPRETER_INTERPRETER_INTRINSICS_GENERATOR_H_
This diff is collapsed.
...@@ -5,20 +5,10 @@ ...@@ -5,20 +5,10 @@
#ifndef V8_INTERPRETER_INTERPRETER_INTRINSICS_H_ #ifndef V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
#define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_ #define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
#include "src/allocation.h"
#include "src/builtins/builtins.h"
#include "src/frames.h"
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter-assembler.h"
#include "src/runtime/runtime.h" #include "src/runtime/runtime.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace compiler {
class Node;
} // namespace compiler
namespace interpreter { namespace interpreter {
// List of supported intrisics, with upper case name, lower case name and // List of supported intrisics, with upper case name, lower case name and
...@@ -51,45 +41,12 @@ class IntrinsicsHelper { ...@@ -51,45 +41,12 @@ class IntrinsicsHelper {
}; };
STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8); STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8);
explicit IntrinsicsHelper(InterpreterAssembler* assembler);
compiler::Node* InvokeIntrinsic(compiler::Node* function_id,
compiler::Node* context,
compiler::Node* first_arg_reg,
compiler::Node* arg_count);
static bool IsSupported(Runtime::FunctionId function_id); static bool IsSupported(Runtime::FunctionId function_id);
static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id); static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id);
static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id); static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id);
private: private:
enum InstanceTypeCompareMode { DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper);
kInstanceTypeEqual,
kInstanceTypeGreaterThanOrEqual
};
compiler::Node* IsInstanceType(compiler::Node* input, int type);
compiler::Node* CompareInstanceType(compiler::Node* map, int type,
InstanceTypeCompareMode mode);
compiler::Node* IntrinsicAsStubCall(compiler::Node* input,
compiler::Node* context,
Callable const& callable);
void AbortIfArgCountMismatch(int expected, compiler::Node* actual);
#define DECLARE_INTRINSIC_HELPER(name, lower_case, count) \
compiler::Node* name(compiler::Node* input, compiler::Node* arg_count, \
compiler::Node* context);
INTRINSICS_LIST(DECLARE_INTRINSIC_HELPER)
#undef DECLARE_INTRINSIC_HELPER
Isolate* isolate() { return isolate_; }
Zone* zone() { return zone_; }
Isolate* isolate_;
Zone* zone_;
InterpreterAssembler* assembler_;
DISALLOW_COPY_AND_ASSIGN(IntrinsicsHelper);
}; };
} // namespace interpreter } // namespace interpreter
......
...@@ -1065,6 +1065,8 @@ ...@@ -1065,6 +1065,8 @@
'interpreter/interpreter-generator.h', 'interpreter/interpreter-generator.h',
'interpreter/interpreter-intrinsics.cc', 'interpreter/interpreter-intrinsics.cc',
'interpreter/interpreter-intrinsics.h', 'interpreter/interpreter-intrinsics.h',
'interpreter/interpreter-intrinsics-generator.cc',
'interpreter/interpreter-intrinsics-generator.h',
'isolate-inl.h', 'isolate-inl.h',
'isolate.cc', 'isolate.cc',
'isolate.h', 'isolate.h',
......
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