Revision: 11982
Author:   [email protected]
Date:     Tue Jul  3 06:01:31 2012
Log: Move quadratic behavior of Context's optimized function list verification behind --enable-slow-asserts flag

BUG=webkit:90003
TEST=the following takes only about 1 second in debug mode: var a=[1,2,3,4,5]; eval("for (var i=0;i<50000;i++) a.sort(function(){return 1;});");

Review URL: https://chromiumcodereview.appspot.com/10704078
http://code.google.com/p/v8/source/detail?r=11982

Modified:
 /branches/bleeding_edge/src/contexts.cc

=======================================
--- /branches/bleeding_edge/src/contexts.cc     Tue Nov 15 05:48:40 2011
+++ /branches/bleeding_edge/src/contexts.cc     Tue Jul  3 06:01:31 2012
@@ -243,10 +243,12 @@
 void Context::AddOptimizedFunction(JSFunction* function) {
   ASSERT(IsGlobalContext());
 #ifdef DEBUG
-  Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
-  while (!element->IsUndefined()) {
-    CHECK(element != function);
-    element = JSFunction::cast(element)->next_function_link();
+  if (FLAG_enable_slow_asserts) {
+    Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
+    while (!element->IsUndefined()) {
+      CHECK(element != function);
+      element = JSFunction::cast(element)->next_function_link();
+    }
   }

   CHECK(function->next_function_link()->IsUndefined());

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to