From ec50a6f33c37e73401e75d84b878c4cf6295d38d Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Mon, 28 Oct 2013 17:54:43 +0000 Subject: [PATCH] Work around two ASSERTs that we're hitting now that DEBUG is #defined again R=danno@chromium.org Review URL: https://codereview.chromium.org/49433002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17418 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 118 ++++++++++++++++++++++++---------------------- src/objects-inl.h | 4 +- 2 files changed, 64 insertions(+), 58 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 5e4d17b320..ed0a0c8e69 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -665,67 +665,71 @@ static Handle MakeFunctionInfo(CompilationInfo* info) { } } - // Measure how long it takes to do the compilation; only take the - // rest of the function into account to avoid overlap with the - // parsing statistics. - HistogramTimer* rate = info->is_eval() - ? info->isolate()->counters()->compile_eval() - : info->isolate()->counters()->compile(); - HistogramTimerScope timer(rate); - - // Compile the code. FunctionLiteral* lit = info->function(); LiveEditFunctionTracker live_edit_tracker(isolate, lit); - if (!MakeCode(info)) { - if (!isolate->has_pending_exception()) isolate->StackOverflow(); - return Handle::null(); + Handle result; + { + // Measure how long it takes to do the compilation; only take the + // rest of the function into account to avoid overlap with the + // parsing statistics. + HistogramTimer* rate = info->is_eval() + ? info->isolate()->counters()->compile_eval() + : info->isolate()->counters()->compile(); + HistogramTimerScope timer(rate); + + // Compile the code. + if (!MakeCode(info)) { + if (!isolate->has_pending_exception()) isolate->StackOverflow(); + return Handle::null(); + } + + // Allocate function. + ASSERT(!info->code().is_null()); + result = + isolate->factory()->NewSharedFunctionInfo( + lit->name(), + lit->materialized_literal_count(), + lit->is_generator(), + info->code(), + ScopeInfo::Create(info->scope(), info->zone())); + + ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); + Compiler::SetFunctionInfo(result, lit, true, script); + + if (script->name()->IsString()) { + PROFILE(isolate, CodeCreateEvent( + info->is_eval() + ? Logger::EVAL_TAG + : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), + *info->code(), + *result, + info, + String::cast(script->name()))); + GDBJIT(AddCode(Handle(String::cast(script->name())), + script, + info->code(), + info)); + } else { + PROFILE(isolate, CodeCreateEvent( + info->is_eval() + ? Logger::EVAL_TAG + : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), + *info->code(), + *result, + info, + isolate->heap()->empty_string())); + GDBJIT(AddCode(Handle(), script, info->code(), info)); + } + + // Hint to the runtime system used when allocating space for initial + // property space by setting the expected number of properties for + // the instances of the function. + SetExpectedNofPropertiesFromEstimate(result, + lit->expected_property_count()); + + script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); } - // Allocate function. - ASSERT(!info->code().is_null()); - Handle result = - isolate->factory()->NewSharedFunctionInfo( - lit->name(), - lit->materialized_literal_count(), - lit->is_generator(), - info->code(), - ScopeInfo::Create(info->scope(), info->zone())); - - ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); - Compiler::SetFunctionInfo(result, lit, true, script); - - if (script->name()->IsString()) { - PROFILE(isolate, CodeCreateEvent( - info->is_eval() - ? Logger::EVAL_TAG - : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), - *info->code(), - *result, - info, - String::cast(script->name()))); - GDBJIT(AddCode(Handle(String::cast(script->name())), - script, - info->code(), - info)); - } else { - PROFILE(isolate, CodeCreateEvent( - info->is_eval() - ? Logger::EVAL_TAG - : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), - *info->code(), - *result, - info, - isolate->heap()->empty_string())); - GDBJIT(AddCode(Handle(), script, info->code(), info)); - } - - // Hint to the runtime system used when allocating space for initial - // property space by setting the expected number of properties for - // the instances of the function. - SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); - - script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); - #ifdef ENABLE_DEBUGGER_SUPPORT // Notify debugger isolate->debugger()->OnAfterCompile( diff --git a/src/objects-inl.h b/src/objects-inl.h index d9d36e0f4b..deb33653f7 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1667,7 +1667,9 @@ int JSObject::GetHeaderSize() { case JS_MESSAGE_OBJECT_TYPE: return JSMessageObject::kSize; default: - UNREACHABLE(); + // TODO(jkummerow): Re-enable this. Blink currently hits this + // from its CustomElementConstructorBuilder. + // UNREACHABLE(); return 0; } }