Reviewers: Michael Starzinger,

Message:
PTAL.

I don't think we can create a regression test for this, as our test suite
specifies --enable-slow-asserts in debug mode. Also, even if it were possible, given the nature of this CL I don't think there'd be much value in a regression
test.

Description:
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;});");


Please review this at https://chromiumcodereview.appspot.com/10704078/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/contexts.cc


Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 76784bd704602b955924c6255c8883b013b1e624..7e671252c8f34def676b7147a6801d7a412c5d59 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -243,10 +243,12 @@ Handle<Object> Context::Lookup(Handle<String> name,
 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