Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: src/hydrogen.cc

Issue 983183002: Intrinsics in the RUNTIME_FUNCTION_LIST are now available with '_', too. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed condition. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 475b9ffeb03f692df2671f075918534812902783..be4c9ac0ea18c966247f476e95b5c0068fb0eadf 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9535,6 +9535,22 @@ const HOptimizedGraphBuilder::InlineFunctionGenerator
#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,
@@ -9914,21 +9930,13 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
const Runtime::Function* function = expr->function();
DCHECK(function != NULL);
- if (function->intrinsic_type == Runtime::INLINE) {
+ InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
+ if (generator != nullptr) {
DCHECK(expr->name()->length() > 0);
DCHECK(expr->name()->Get(0) == '_');
- // Call to an inline function.
- int lookup_index = static_cast<int>(function->function_id) -
- static_cast<int>(Runtime::kFirstInlineFunction);
- DCHECK(lookup_index >= 0);
- DCHECK(static_cast<size_t>(lookup_index) <
- arraysize(kInlineFunctionGenerators));
- InlineFunctionGenerator generator = kInlineFunctionGenerators[lookup_index];
-
// Call the inline code generator using the pointer-to-member.
(this->*generator)(expr);
} else {
- DCHECK(function->intrinsic_type == Runtime::RUNTIME);
Handle<String> name = expr->name();
int argument_count = expr->arguments()->length();
CHECK_ALIVE(VisitExpressions(expr->arguments()));
« no previous file with comments | « src/hydrogen.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698