Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.443
diff -u -p -r1.443 bootstrap.inc
--- includes/bootstrap.inc	20 Nov 2010 05:45:48 -0000	1.443
+++ includes/bootstrap.inc	22 Nov 2010 00:35:06 -0000
@@ -902,7 +902,12 @@ function bootstrap_invoke_all($hook) {
   // only.
   foreach (module_list(FALSE, TRUE) as $module) {
     drupal_load('module', $module);
-    module_invoke($module, $hook);
+    // module_invoke() would prime the static cache of module_hook_info(), so
+    // bootstrap hook implementations need to be invoked manually.
+    $function = $module . '_' . $hook;
+    if (function_exists($function)) {
+      $function();
+    }
   }
 }
 
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.206
diff -u -p -r1.206 module.inc
--- includes/module.inc	21 Nov 2010 10:19:48 -0000	1.206
+++ includes/module.inc	22 Nov 2010 00:37:03 -0000
@@ -695,11 +695,12 @@ function module_implements($hook, $sort 
  * Retrieve a list of what hooks are explicitly declared.
  */
 function module_hook_info() {
-  $hook_info = &drupal_static(__FUNCTION__, array());
+  $hook_info = &drupal_static(__FUNCTION__);
 
-  if (empty($hook_info)) {
+  if (!isset($hook_info)) {
+    $hook_info = array();
     $cache = cache_get('hook_info', 'cache_bootstrap');
-    if ($cache === FALSE) {
+    if (!$cache) {
       // Rebuild the cache and save it.
       // We can't use module_invoke_all() here or it would cause an infinite
       // loop.
@@ -763,10 +764,21 @@ function module_invoke() {
   $module = $args[0];
   $hook = $args[1];
   unset($args[0], $args[1]);
-  if (module_hook($module, $hook)) {
+  $hook_exists = function_exists($module . '_' . $hook);
+  // If the hook implementation does not exist, check whether it may live in an
+  // optional include file registered via hook_hook_info().
+  if (!$hook_exists) {
+    $hook_info = module_hook_info();
+    if (isset($hook_info[$hook]['group'])) {
+      module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']);
+      $hook_exists = function_exists($module . '_' . $hook);
+    }
+  }
+  if ($hook_exists) {
     return call_user_func_array($module . '_' . $hook, $args);
   }
 }
+
 /**
  * Invoke a hook in all enabled modules that implement it.
  *
