Reviewers: Michael Starzinger,
Description:
Intrinsics in the RUNTIME_FUNCTION_LIST are now available with '_', too.
Now the three intrinsic lists only differ in their compiler
support. Unifying the lists and making the logic what is supported in
which compiler local to the compilers themselves is handled in a
follow-up CL.
BUG=v8:3947
LOG=n
Please review this at https://codereview.chromium.org/983183002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -13 lines):
M src/hydrogen.h
M src/hydrogen.cc
M src/runtime/runtime.h
M src/runtime/runtime.cc
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
475b9ffeb03f692df2671f075918534812902783..e7d2a14b6862f3e1585b0ab52fb32078802cea24
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);
+ InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr);
if (function->intrinsic_type == Runtime::INLINE) {
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()));
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index
831ed20cb11d26ea064eddbbfa94ccd3773302c0..72fb59dfc58f86baaa741182806b25b3ee086db7
100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -2122,6 +2122,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
public AstVisitor {
typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator)
(CallRuntime* call);
+ InlineFunctionGenerator FindInlineFunctionGenerator(CallRuntime* expr);
+
// Forward declarations for inner scope classes.
class SubgraphScope;
Index: src/runtime/runtime.cc
diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc
index
78c83abfdc5d9ebb62faecf8a81df5a86284f085..c8060a7a35f720c8293003304d0e89adfb683162
100644
--- a/src/runtime/runtime.cc
+++ b/src/runtime/runtime.cc
@@ -49,8 +49,8 @@ INLINE_FUNCTION_LIST(F)
static const Runtime::Function kIntrinsicFunctions[] = {
RUNTIME_FUNCTION_LIST(F) INLINE_FUNCTION_LIST(F)
- INLINE_OPTIMIZED_FUNCTION_LIST(F) INLINE_FUNCTION_LIST(I)
- INLINE_OPTIMIZED_FUNCTION_LIST(I)};
+ INLINE_OPTIMIZED_FUNCTION_LIST(F) RUNTIME_FUNCTION_LIST(I)
+ INLINE_FUNCTION_LIST(I) INLINE_OPTIMIZED_FUNCTION_LIST(I)};
#undef I
#undef F
Index: src/runtime/runtime.h
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index
75ddd45e00b934c8679ad9331d39c27c967ebb18..136c37446049b5e2ebb0f90a05ee271d0141d06a
100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -771,8 +771,8 @@ class Runtime : public AllStatic {
#define F(name, nargs, ressize) k##name,
#define I(name, nargs, ressize) kInline##name,
RUNTIME_FUNCTION_LIST(F) INLINE_FUNCTION_LIST(F)
- INLINE_OPTIMIZED_FUNCTION_LIST(F) INLINE_FUNCTION_LIST(I)
- INLINE_OPTIMIZED_FUNCTION_LIST(I)
+ INLINE_OPTIMIZED_FUNCTION_LIST(F) RUNTIME_FUNCTION_LIST(I)
+ INLINE_FUNCTION_LIST(I) INLINE_OPTIMIZED_FUNCTION_LIST(I)
#undef I
#undef F
kNumFunctions,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.