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

Unified Diff: src/full-codegen.cc

Issue 3293002: Move inlined function declarations and support from codegen.* to runtime.*. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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/full-codegen.h ('k') | src/handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.cc
===================================================================
--- src/full-codegen.cc (revision 5450)
+++ src/full-codegen.cc (working copy)
@@ -505,21 +505,39 @@
}
-void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* expr) {
- Handle<String> name = expr->name();
- SmartPointer<char> cstring = name->ToCString();
+// Lookup table for code generators for special runtime calls which are
+// generated inline.
+#define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \
+ &FullCodeGenerator::Emit##Name,
-#define CHECK_EMIT_INLINE_CALL(name, x, y) \
- if (strcmp("_"#name, *cstring) == 0) { \
- Emit##name(expr->arguments()); \
- return; \
- }
- INLINE_RUNTIME_FUNCTION_LIST(CHECK_EMIT_INLINE_CALL)
-#undef CHECK_EMIT_INLINE_CALL
- UNREACHABLE();
+const FullCodeGenerator::InlineFunctionGenerator
+ FullCodeGenerator::kInlineFunctionGenerators[] = {
+ INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
+ INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
+ };
+#undef INLINE_FUNCTION_GENERATOR_ADDRESS
+
+
+FullCodeGenerator::InlineFunctionGenerator
+ FullCodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) {
+ return kInlineFunctionGenerators[
+ static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction)];
}
+void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) {
+ ZoneList<Expression*>* args = node->arguments();
+ Handle<String> name = node->name();
+ Runtime::Function* function = node->function();
+ ASSERT(function != NULL);
+ ASSERT(function->intrinsic_type == Runtime::INLINE);
+ InlineFunctionGenerator generator =
+ FindInlineFunctionGenerator(function->function_id);
+ ASSERT(generator != NULL);
+ ((*this).*(generator))(args);
+}
+
+
void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
Comment cmnt(masm_, "[ BinaryOperation");
Token::Value op = expr->op();
« no previous file with comments | « src/full-codegen.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698