Merged INLINE_OPTIMIZED intrinsic type into INLINE.
BUG=v8:3947 LOG=n Review URL: https://codereview.chromium.org/978123003 Cr-Commit-Position: refs/heads/master@{#27039}
This commit is contained in:
parent
b9bf2051cd
commit
4e7acce180
@ -4605,10 +4605,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4295,10 +4295,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,12 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
|
||||
return ReduceInlineIsInstanceType(node, JS_ARRAY_TYPE);
|
||||
case Runtime::kInlineIsFunction:
|
||||
return ReduceInlineIsInstanceType(node, JS_FUNCTION_TYPE);
|
||||
case Runtime::kInlineOptimizedConstructDouble:
|
||||
return ReduceInlineOptimizedConstructDouble(node);
|
||||
case Runtime::kInlineOptimizedDoubleLo:
|
||||
return ReduceInlineOptimizedDoubleLo(node);
|
||||
case Runtime::kInlineOptimizedDoubleHi:
|
||||
return ReduceInlineOptimizedDoubleHi(node);
|
||||
case Runtime::kInlineConstructDouble:
|
||||
return ReduceInlineConstructDouble(node);
|
||||
case Runtime::kInlineDoubleLo:
|
||||
return ReduceInlineDoubleLo(node);
|
||||
case Runtime::kInlineDoubleHi:
|
||||
return ReduceInlineDoubleHi(node);
|
||||
case Runtime::kInlineIsRegExp:
|
||||
return ReduceInlineIsInstanceType(node, JS_REGEXP_TYPE);
|
||||
case Runtime::kInlineValueOf:
|
||||
@ -98,8 +98,7 @@ Reduction JSIntrinsicLowering::ReduceInlineIsNonNegativeSmi(Node* node) {
|
||||
}
|
||||
|
||||
|
||||
Reduction JSIntrinsicLowering::ReduceInlineOptimizedConstructDouble(
|
||||
Node* node) {
|
||||
Reduction JSIntrinsicLowering::ReduceInlineConstructDouble(Node* node) {
|
||||
Node* high = NodeProperties::GetValueInput(node, 0);
|
||||
Node* low = NodeProperties::GetValueInput(node, 1);
|
||||
Node* value =
|
||||
@ -112,12 +111,12 @@ Reduction JSIntrinsicLowering::ReduceInlineOptimizedConstructDouble(
|
||||
}
|
||||
|
||||
|
||||
Reduction JSIntrinsicLowering::ReduceInlineOptimizedDoubleLo(Node* node) {
|
||||
Reduction JSIntrinsicLowering::ReduceInlineDoubleLo(Node* node) {
|
||||
return Change(node, machine()->Float64ExtractLowWord32());
|
||||
}
|
||||
|
||||
|
||||
Reduction JSIntrinsicLowering::ReduceInlineOptimizedDoubleHi(Node* node) {
|
||||
Reduction JSIntrinsicLowering::ReduceInlineDoubleHi(Node* node) {
|
||||
return Change(node, machine()->Float64ExtractHighWord32());
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,9 @@ class JSIntrinsicLowering FINAL : public Reducer {
|
||||
Reduction ReduceInlineIsSmi(Node* node);
|
||||
Reduction ReduceInlineIsNonNegativeSmi(Node* node);
|
||||
Reduction ReduceInlineIsInstanceType(Node* node, InstanceType instance_type);
|
||||
Reduction ReduceInlineOptimizedConstructDouble(Node* node);
|
||||
Reduction ReduceInlineOptimizedDoubleLo(Node* node);
|
||||
Reduction ReduceInlineOptimizedDoubleHi(Node* node);
|
||||
Reduction ReduceInlineConstructDouble(Node* node);
|
||||
Reduction ReduceInlineDoubleLo(Node* node);
|
||||
Reduction ReduceInlineDoubleHi(Node* node);
|
||||
Reduction ReduceInlineValueOf(Node* node);
|
||||
|
||||
Reduction Change(Node* node, const Operator* op);
|
||||
|
@ -129,7 +129,7 @@ bool Linkage::NeedsFrameState(Runtime::FunctionId function) {
|
||||
case Runtime::kInlineArguments:
|
||||
case Runtime::kInlineCallFunction:
|
||||
case Runtime::kInlineDateField:
|
||||
case Runtime::kInlineOptimizedGetPrototype:
|
||||
case Runtime::kInlineGetPrototype:
|
||||
case Runtime::kInlineRegExpExec:
|
||||
return true;
|
||||
default:
|
||||
|
@ -1506,10 +1506,10 @@ Bounds Typer::Visitor::TypeJSCallRuntime(Node* node) {
|
||||
case Runtime::kInlineIsFunction:
|
||||
case Runtime::kInlineIsRegExp:
|
||||
return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
||||
case Runtime::kInlineOptimizedDoubleLo:
|
||||
case Runtime::kInlineOptimizedDoubleHi:
|
||||
case Runtime::kInlineDoubleLo:
|
||||
case Runtime::kInlineDoubleHi:
|
||||
return Bounds(Type::None(zone()), Type::Signed32());
|
||||
case Runtime::kInlineOptimizedConstructDouble:
|
||||
case Runtime::kInlineConstructDouble:
|
||||
return Bounds(Type::None(zone()), Type::Number());
|
||||
default:
|
||||
break;
|
||||
|
@ -895,22 +895,23 @@ const FullCodeGenerator::InlineFunctionGenerator
|
||||
|
||||
|
||||
FullCodeGenerator::InlineFunctionGenerator
|
||||
FullCodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) {
|
||||
int lookup_index =
|
||||
static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction);
|
||||
DCHECK(lookup_index >= 0);
|
||||
DCHECK(static_cast<size_t>(lookup_index) <
|
||||
arraysize(kInlineFunctionGenerators));
|
||||
return kInlineFunctionGenerators[lookup_index];
|
||||
FullCodeGenerator::FindInlineFunctionGenerator(CallRuntime* expr) {
|
||||
const Runtime::Function* function = expr->function();
|
||||
if (function == nullptr || function->intrinsic_type != Runtime::INLINE) {
|
||||
return nullptr;
|
||||
}
|
||||
Runtime::FunctionId id = function->function_id;
|
||||
if (id < Runtime::kFirstInlineFunction || Runtime::kLastInlineFunction < id) {
|
||||
return nullptr;
|
||||
}
|
||||
return kInlineFunctionGenerators[static_cast<int>(id) -
|
||||
static_cast<int>(
|
||||
Runtime::kFirstInlineFunction)];
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* expr) {
|
||||
const Runtime::Function* function = expr->function();
|
||||
DCHECK(function != NULL);
|
||||
DCHECK(function->intrinsic_type == Runtime::INLINE);
|
||||
InlineFunctionGenerator generator =
|
||||
FindInlineFunctionGenerator(function->function_id);
|
||||
void FullCodeGenerator::EmitInlineRuntimeCall(
|
||||
CallRuntime* expr, InlineFunctionGenerator generator) {
|
||||
((*this).*(generator))(expr);
|
||||
}
|
||||
|
||||
|
@ -496,9 +496,10 @@ class FullCodeGenerator: public AstVisitor {
|
||||
void EmitKeyedSuperCallWithLoadIC(Call* expr);
|
||||
|
||||
// Platform-specific code for inline runtime calls.
|
||||
InlineFunctionGenerator FindInlineFunctionGenerator(Runtime::FunctionId id);
|
||||
InlineFunctionGenerator FindInlineFunctionGenerator(CallRuntime* expr);
|
||||
|
||||
void EmitInlineRuntimeCall(CallRuntime* expr);
|
||||
void EmitInlineRuntimeCall(CallRuntime* expr,
|
||||
InlineFunctionGenerator generator);
|
||||
|
||||
#define EMIT_INLINE_RUNTIME_CALL(name, x, y) \
|
||||
void Emit##name(CallRuntime* expr);
|
||||
|
@ -9916,8 +9916,7 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
|
||||
const Runtime::Function* function = expr->function();
|
||||
DCHECK(function != NULL);
|
||||
|
||||
if (function->intrinsic_type == Runtime::INLINE ||
|
||||
function->intrinsic_type == Runtime::INLINE_OPTIMIZED) {
|
||||
if (function->intrinsic_type == Runtime::INLINE) {
|
||||
DCHECK(expr->name()->length() > 0);
|
||||
DCHECK(expr->name()->Get(0) == '_');
|
||||
// Call to an inline function.
|
||||
|
@ -4530,10 +4530,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4613,10 +4613,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4616,10 +4616,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4590,10 +4590,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,19 +47,10 @@ INLINE_FUNCTION_LIST(F)
|
||||
,
|
||||
|
||||
|
||||
#define IO(name, number_of_args, result_size) \
|
||||
{ \
|
||||
Runtime::kInlineOptimized##name, Runtime::INLINE_OPTIMIZED, "_" #name, \
|
||||
FUNCTION_ADDR(Runtime_##name), number_of_args, result_size \
|
||||
} \
|
||||
,
|
||||
|
||||
|
||||
static const Runtime::Function kIntrinsicFunctions[] = {
|
||||
RUNTIME_FUNCTION_LIST(F) INLINE_OPTIMIZED_FUNCTION_LIST(F)
|
||||
INLINE_FUNCTION_LIST(I) INLINE_OPTIMIZED_FUNCTION_LIST(IO)};
|
||||
INLINE_FUNCTION_LIST(I) INLINE_OPTIMIZED_FUNCTION_LIST(I)};
|
||||
|
||||
#undef IO
|
||||
#undef I
|
||||
#undef F
|
||||
|
||||
|
@ -772,16 +772,15 @@ class Runtime : public AllStatic {
|
||||
RUNTIME_FUNCTION_LIST(F) INLINE_OPTIMIZED_FUNCTION_LIST(F)
|
||||
#undef F
|
||||
#define F(name, nargs, ressize) kInline##name,
|
||||
INLINE_FUNCTION_LIST(F)
|
||||
INLINE_FUNCTION_LIST(F) INLINE_OPTIMIZED_FUNCTION_LIST(F)
|
||||
#undef F
|
||||
#define F(name, nargs, ressize) kInlineOptimized##name,
|
||||
INLINE_OPTIMIZED_FUNCTION_LIST(F)
|
||||
#undef F
|
||||
kNumFunctions,
|
||||
kFirstInlineFunction = kInlineIsSmi
|
||||
kNumFunctions,
|
||||
// TODO(svenpanne) The values below are cruel hacks, remove them!
|
||||
kFirstInlineFunction = kInlineIsSmi,
|
||||
kLastInlineFunction = kInlineDebugIsActive
|
||||
};
|
||||
|
||||
enum IntrinsicType { RUNTIME, INLINE, INLINE_OPTIMIZED };
|
||||
enum IntrinsicType { RUNTIME, INLINE };
|
||||
|
||||
// Intrinsic function descriptor.
|
||||
struct Function {
|
||||
|
@ -4554,10 +4554,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4495,10 +4495,10 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||
if (expr->function() != NULL &&
|
||||
expr->function()->intrinsic_type == Runtime::INLINE) {
|
||||
InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
|
||||
if (generator != nullptr) {
|
||||
Comment cmnt(masm_, "[ InlineRuntimeCall");
|
||||
EmitInlineRuntimeCall(expr);
|
||||
EmitInlineRuntimeCall(expr, generator);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) {
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
javascript()->CallRuntime(Runtime::kInlineOptimizedConstructDouble, 2),
|
||||
input0, input1, context, effect, control));
|
||||
javascript()->CallRuntime(Runtime::kInlineConstructDouble, 2), input0,
|
||||
input1, context, effect, control));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64InsertHighWord32(
|
||||
IsFloat64InsertLowWord32(
|
||||
@ -71,9 +71,9 @@ TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleLo) {
|
||||
Node* const context = Parameter(1);
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleLo, 1), input,
|
||||
context, effect, control));
|
||||
Reduction const r = Reduce(
|
||||
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1),
|
||||
input, context, effect, control));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input));
|
||||
}
|
||||
@ -88,9 +88,9 @@ TEST_F(JSIntrinsicLoweringTest, InlineOptimizedDoubleHi) {
|
||||
Node* const context = Parameter(1);
|
||||
Node* const effect = graph()->start();
|
||||
Node* const control = graph()->start();
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
javascript()->CallRuntime(Runtime::kInlineOptimizedDoubleHi, 1), input,
|
||||
context, effect, control));
|
||||
Reduction const r = Reduce(
|
||||
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1),
|
||||
input, context, effect, control));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user