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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11982 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2012-07-03 13:01:31 +00:00
parent ec4ab693c2
commit 00eb355247

View File

@ -243,10 +243,12 @@ Handle<Object> Context::Lookup(Handle<String> name,
void Context::AddOptimizedFunction(JSFunction* function) { void Context::AddOptimizedFunction(JSFunction* function) {
ASSERT(IsGlobalContext()); ASSERT(IsGlobalContext());
#ifdef DEBUG #ifdef DEBUG
Object* element = get(OPTIMIZED_FUNCTIONS_LIST); if (FLAG_enable_slow_asserts) {
while (!element->IsUndefined()) { Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
CHECK(element != function); while (!element->IsUndefined()) {
element = JSFunction::cast(element)->next_function_link(); CHECK(element != function);
element = JSFunction::cast(element)->next_function_link();
}
} }
CHECK(function->next_function_link()->IsUndefined()); CHECK(function->next_function_link()->IsUndefined());