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

Unified Diff: src/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/codegen.h ('k') | src/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.cc
===================================================================
--- src/codegen.cc (revision 5450)
+++ src/codegen.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright 2009 the V8 project authors. All rights reserved.
+// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -344,40 +344,35 @@
}
-// List of special runtime calls which are generated inline. For some of these
-// functions the code will be generated inline, and for others a call to a code
-// stub will be inlined.
+// Lookup table for code generators for special runtime calls which are
+// generated inline.
+#define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \
+ &CodeGenerator::Generate##Name,
-#define INLINE_RUNTIME_ENTRY(Name, argc, ressize) \
- {&CodeGenerator::Generate##Name, "_" #Name, argc}, \
-
-CodeGenerator::InlineRuntimeLUT CodeGenerator::kInlineRuntimeLUT[] = {
- INLINE_RUNTIME_FUNCTION_LIST(INLINE_RUNTIME_ENTRY)
+const CodeGenerator::InlineFunctionGenerator
+ CodeGenerator::kInlineFunctionGenerators[] = {
+ INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
+ INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
};
+#undef INLINE_FUNCTION_GENERATOR_ADDRESS
-#undef INLINE_RUNTIME_ENTRY
-CodeGenerator::InlineRuntimeLUT* CodeGenerator::FindInlineRuntimeLUT(
- Handle<String> name) {
- const int entries_count =
- sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT);
- for (int i = 0; i < entries_count; i++) {
- InlineRuntimeLUT* entry = &kInlineRuntimeLUT[i];
- if (name->IsEqualTo(CStrVector(entry->name))) {
- return entry;
- }
- }
- return NULL;
+CodeGenerator::InlineFunctionGenerator
+ CodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) {
+ return kInlineFunctionGenerators[
+ static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction)];
}
bool CodeGenerator::CheckForInlineRuntimeCall(CallRuntime* node) {
ZoneList<Expression*>* args = node->arguments();
Handle<String> name = node->name();
- if (name->length() > 0 && name->Get(0) == '_') {
- InlineRuntimeLUT* entry = FindInlineRuntimeLUT(name);
- if (entry != NULL) {
- ((*this).*(entry->method))(args);
+ Runtime::Function* function = node->function();
+ if (function != NULL && function->intrinsic_type == Runtime::INLINE) {
+ InlineFunctionGenerator generator =
+ FindInlineFunctionGenerator(function->function_id);
+ if (generator != NULL) {
+ ((*this).*(generator))(args);
return true;
}
}
@@ -385,14 +380,6 @@
}
-int CodeGenerator::InlineRuntimeCallArgumentsCount(Handle<String> name) {
- CodeGenerator::InlineRuntimeLUT* f =
- CodeGenerator::FindInlineRuntimeLUT(name);
- if (f != NULL) return f->nargs;
- return -1;
-}
-
-
// Simple condition analysis. ALWAYS_TRUE and ALWAYS_FALSE represent a
// known result for the test expression, with no side effects.
CodeGenerator::ConditionAnalysis CodeGenerator::AnalyzeCondition(
« no previous file with comments | « src/codegen.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698