Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 1c1375b06b8d84b4f55b6b92169ec3112e265e97..545031b7185648fcaa5b0e7798c89788f31792f6 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -9524,38 +9524,6 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { |
} |
-// Support for generating inlined runtime functions. |
- |
-// Lookup table for generators for runtime calls that are generated inline. |
-// Elements of the table are member pointers to functions of |
-// HOptimizedGraphBuilder. |
-#define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ |
- &HOptimizedGraphBuilder::Generate##Name, |
- |
-const HOptimizedGraphBuilder::InlineFunctionGenerator |
- HOptimizedGraphBuilder::kInlineFunctionGenerators[] = { |
- INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
- INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
-}; |
-#undef INLINE_FUNCTION_GENERATOR_ADDRESS |
- |
- |
-HOptimizedGraphBuilder::InlineFunctionGenerator |
-HOptimizedGraphBuilder::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) return nullptr; |
- int lookup_index = |
- static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction); |
- DCHECK(static_cast<size_t>(lookup_index) < |
- arraysize(kInlineFunctionGenerators)); |
- return kInlineFunctionGenerators[lookup_index]; |
-} |
- |
- |
template <class ViewClass> |
void HGraphBuilder::BuildArrayBufferViewInitialization( |
HValue* obj, |
@@ -9934,21 +9902,21 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
const Runtime::Function* function = expr->function(); |
DCHECK(function != NULL); |
- |
- InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); |
- if (generator != nullptr) { |
- DCHECK(expr->name()->length() > 0); |
- DCHECK(expr->name()->Get(0) == '_'); |
- // Call the inline code generator using the pointer-to-member. |
- (this->*generator)(expr); |
- } else { |
- Handle<String> name = expr->name(); |
- int argument_count = expr->arguments()->length(); |
- CHECK_ALIVE(VisitExpressions(expr->arguments())); |
- PushArgumentsFromEnvironment(argument_count); |
- HCallRuntime* call = New<HCallRuntime>(name, function, |
- argument_count); |
- return ast_context()->ReturnInstruction(call, expr->id()); |
+ switch (function->function_id) { |
+#define CALL_INTRINSIC_GENERATOR(Name) \ |
+ case Runtime::kInline##Name: \ |
+ return Generate##Name(expr); |
+ |
+ FOR_EACH_HYDROGEN_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
+#undef CALL_INTRINSIC_GENERATOR |
+ default: { |
+ Handle<String> name = expr->name(); |
+ int argument_count = expr->arguments()->length(); |
+ CHECK_ALIVE(VisitExpressions(expr->arguments())); |
+ PushArgumentsFromEnvironment(argument_count); |
+ HCallRuntime* call = New<HCallRuntime>(name, function, argument_count); |
+ return ast_context()->ReturnInstruction(call, expr->id()); |
+ } |
} |
} |