| Index: src/compiler.cc
|
| diff --git a/src/compiler.cc b/src/compiler.cc
|
| index 342ed8a7069803f5660f4eb47faf2fa33e17ebd7..e496aee62d6760f3f13325fe5e84147aa1b7a91d 100644
|
| --- a/src/compiler.cc
|
| +++ b/src/compiler.cc
|
| @@ -36,7 +36,7 @@ ScriptData::ScriptData(const byte* data, int length)
|
| : owns_data_(false), data_(data), length_(length) {
|
| if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) {
|
| byte* copy = NewArray<byte>(length);
|
| - ASSERT(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment));
|
| + DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment));
|
| CopyBytes(copy, data, length);
|
| data_ = copy;
|
| AcquireDataOwnership();
|
| @@ -148,7 +148,7 @@ void CompilationInfo::Initialize(Isolate* isolate,
|
| if (isolate_->debug()->is_active()) MarkAsDebug();
|
|
|
| if (!shared_info_.is_null()) {
|
| - ASSERT(strict_mode() == SLOPPY);
|
| + DCHECK(strict_mode() == SLOPPY);
|
| SetStrictMode(shared_info_->strict_mode());
|
| }
|
| set_bailout_reason(kUnknown);
|
| @@ -170,7 +170,7 @@ CompilationInfo::~CompilationInfo() {
|
| // Check that no dependent maps have been added or added dependent maps have
|
| // been rolled back or committed.
|
| for (int i = 0; i < DependentCode::kGroupCount; i++) {
|
| - ASSERT_EQ(NULL, dependencies_[i]);
|
| + DCHECK_EQ(NULL, dependencies_[i]);
|
| }
|
| #endif // DEBUG
|
| }
|
| @@ -180,7 +180,7 @@ void CompilationInfo::CommitDependencies(Handle<Code> code) {
|
| for (int i = 0; i < DependentCode::kGroupCount; i++) {
|
| ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i];
|
| if (group_objects == NULL) continue;
|
| - ASSERT(!object_wrapper_.is_null());
|
| + DCHECK(!object_wrapper_.is_null());
|
| for (int j = 0; j < group_objects->length(); j++) {
|
| DependentCode::DependencyGroup group =
|
| static_cast<DependentCode::DependencyGroup>(i);
|
| @@ -212,7 +212,7 @@ void CompilationInfo::RollbackDependencies() {
|
|
|
| int CompilationInfo::num_parameters() const {
|
| if (IsStub()) {
|
| - ASSERT(parameter_count_ > 0);
|
| + DCHECK(parameter_count_ > 0);
|
| return parameter_count_;
|
| } else {
|
| return scope()->num_parameters();
|
| @@ -266,7 +266,7 @@ bool CompilationInfo::ShouldSelfOptimize() {
|
|
|
|
|
| void CompilationInfo::PrepareForCompilation(Scope* scope) {
|
| - ASSERT(scope_ == NULL);
|
| + DCHECK(scope_ == NULL);
|
| scope_ = scope;
|
|
|
| int length = function()->slot_count();
|
| @@ -274,7 +274,7 @@ void CompilationInfo::PrepareForCompilation(Scope* scope) {
|
| // Allocate the feedback vector too.
|
| feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector(length);
|
| }
|
| - ASSERT(feedback_vector_->length() == length);
|
| + DCHECK(feedback_vector_->length() == length);
|
| }
|
|
|
|
|
| @@ -315,17 +315,17 @@ class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
|
|
|
|
|
| OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
|
| - ASSERT(isolate()->use_crankshaft());
|
| - ASSERT(info()->IsOptimizing());
|
| - ASSERT(!info()->IsCompilingForDebugging());
|
| + DCHECK(isolate()->use_crankshaft());
|
| + DCHECK(info()->IsOptimizing());
|
| + DCHECK(!info()->IsCompilingForDebugging());
|
|
|
| // We should never arrive here if there is no code object on the
|
| // shared function object.
|
| - ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION);
|
| + DCHECK(info()->shared_info()->code()->kind() == Code::FUNCTION);
|
|
|
| // We should never arrive here if optimization has been disabled on the
|
| // shared function info.
|
| - ASSERT(!info()->shared_info()->optimization_disabled());
|
| + DCHECK(!info()->shared_info()->optimization_disabled());
|
|
|
| // Fall back to using the full code generator if it's not possible
|
| // to use the Hydrogen-based optimizing compiler. We already have
|
| @@ -405,7 +405,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
|
| }
|
| }
|
|
|
| - ASSERT(info()->shared_info()->has_deoptimization_support());
|
| + DCHECK(info()->shared_info()->has_deoptimization_support());
|
|
|
| // Check the whitelist for TurboFan.
|
| if (info()->closure()->PassesFilter(FLAG_turbo_filter) &&
|
| @@ -446,7 +446,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
|
| // The function being compiled may have bailed out due to an inline
|
| // candidate bailing out. In such a case, we don't disable
|
| // optimization on the shared_info.
|
| - ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL);
|
| + DCHECK(!graph_builder_->inline_bailout() || graph_ == NULL);
|
| if (graph_ == NULL) {
|
| if (graph_builder_->inline_bailout()) {
|
| return AbortOptimization();
|
| @@ -469,14 +469,14 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() {
|
| DisallowHandleDereference no_deref;
|
| DisallowCodeDependencyChange no_dependency_change;
|
|
|
| - ASSERT(last_status() == SUCCEEDED);
|
| + DCHECK(last_status() == SUCCEEDED);
|
| // TODO(turbofan): Currently everything is done in the first phase.
|
| if (!info()->code().is_null()) {
|
| return last_status();
|
| }
|
|
|
| Timer t(this, &time_taken_to_optimize_);
|
| - ASSERT(graph_ != NULL);
|
| + DCHECK(graph_ != NULL);
|
| BailoutReason bailout_reason = kNoReason;
|
|
|
| if (graph_->Optimize(&bailout_reason)) {
|
| @@ -491,20 +491,20 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() {
|
|
|
|
|
| OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() {
|
| - ASSERT(last_status() == SUCCEEDED);
|
| + DCHECK(last_status() == SUCCEEDED);
|
| // TODO(turbofan): Currently everything is done in the first phase.
|
| if (!info()->code().is_null()) {
|
| RecordOptimizationStats();
|
| return last_status();
|
| }
|
|
|
| - ASSERT(!info()->HasAbortedDueToDependencyChange());
|
| + DCHECK(!info()->HasAbortedDueToDependencyChange());
|
| DisallowCodeDependencyChange no_dependency_change;
|
| DisallowJavascriptExecution no_js(isolate());
|
| { // Scope for timer.
|
| Timer timer(this, &time_taken_to_codegen_);
|
| - ASSERT(chunk_ != NULL);
|
| - ASSERT(graph_ != NULL);
|
| + DCHECK(chunk_ != NULL);
|
| + DCHECK(graph_ != NULL);
|
| // Deferred handles reference objects that were accessible during
|
| // graph creation. To make sure that we don't encounter inconsistencies
|
| // between graph creation and code generation, we disallow accessing
|
| @@ -605,7 +605,7 @@ static void UpdateSharedFunctionInfo(CompilationInfo* info) {
|
| // Update the shared function info with the compiled code and the
|
| // scope info. Please note, that the order of the shared function
|
| // info initialization is important since set_scope_info might
|
| - // trigger a GC, causing the ASSERT below to be invalid if the code
|
| + // trigger a GC, causing the DCHECK below to be invalid if the code
|
| // was flushed. By setting the code object last we avoid this.
|
| Handle<SharedFunctionInfo> shared = info->shared_info();
|
| Handle<ScopeInfo> scope_info =
|
| @@ -625,7 +625,7 @@ static void UpdateSharedFunctionInfo(CompilationInfo* info) {
|
| SetExpectedNofPropertiesFromEstimate(shared, expected);
|
|
|
| // Check the function has compiled code.
|
| - ASSERT(shared->is_compiled());
|
| + DCHECK(shared->is_compiled());
|
| shared->set_bailout_reason(lit->dont_optimize_reason());
|
| shared->set_ast_node_count(lit->ast_node_count());
|
| shared->set_strict_mode(lit->strict_mode());
|
| @@ -666,11 +666,11 @@ static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info,
|
|
|
|
|
| static bool CompileUnoptimizedCode(CompilationInfo* info) {
|
| - ASSERT(AllowCompilation::IsAllowed(info->isolate()));
|
| - ASSERT(info->function() != NULL);
|
| + DCHECK(AllowCompilation::IsAllowed(info->isolate()));
|
| + DCHECK(info->function() != NULL);
|
| if (!Rewriter::Rewrite(info)) return false;
|
| if (!Scope::Analyze(info)) return false;
|
| - ASSERT(info->scope() != NULL);
|
| + DCHECK(info->scope() != NULL);
|
|
|
| if (!FullCodeGenerator::MakeCode(info)) {
|
| Isolate* isolate = info->isolate();
|
| @@ -692,14 +692,14 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
|
| Compiler::RecordFunctionCompilation(
|
| Logger::LAZY_COMPILE_TAG, info, info->shared_info());
|
| UpdateSharedFunctionInfo(info);
|
| - ASSERT_EQ(Code::FUNCTION, info->code()->kind());
|
| + DCHECK_EQ(Code::FUNCTION, info->code()->kind());
|
| return info->code();
|
| }
|
|
|
|
|
| MaybeHandle<Code> Compiler::GetUnoptimizedCode(Handle<JSFunction> function) {
|
| - ASSERT(!function->GetIsolate()->has_pending_exception());
|
| - ASSERT(!function->is_compiled());
|
| + DCHECK(!function->GetIsolate()->has_pending_exception());
|
| + DCHECK(!function->is_compiled());
|
| if (function->shared()->is_compiled()) {
|
| return Handle<Code>(function->shared()->code());
|
| }
|
| @@ -728,8 +728,8 @@ MaybeHandle<Code> Compiler::GetUnoptimizedCode(Handle<JSFunction> function) {
|
|
|
| MaybeHandle<Code> Compiler::GetUnoptimizedCode(
|
| Handle<SharedFunctionInfo> shared) {
|
| - ASSERT(!shared->GetIsolate()->has_pending_exception());
|
| - ASSERT(!shared->is_compiled());
|
| + DCHECK(!shared->GetIsolate()->has_pending_exception());
|
| + DCHECK(!shared->is_compiled());
|
|
|
| CompilationInfoWithZone info(shared);
|
| return GetUnoptimizedCodeCommon(&info);
|
| @@ -748,7 +748,7 @@ bool Compiler::EnsureCompiled(Handle<JSFunction> function,
|
| return false;
|
| }
|
| function->ReplaceCode(*code);
|
| - ASSERT(function->is_compiled());
|
| + DCHECK(function->is_compiled());
|
| return true;
|
| }
|
|
|
| @@ -769,10 +769,10 @@ MaybeHandle<Code> Compiler::GetCodeForDebugging(Handle<JSFunction> function) {
|
|
|
| info.MarkAsDebug();
|
|
|
| - ASSERT(!isolate->has_pending_exception());
|
| + DCHECK(!isolate->has_pending_exception());
|
| Handle<Code> old_code(function->shared()->code());
|
| - ASSERT(old_code->kind() == Code::FUNCTION);
|
| - ASSERT(!old_code->has_debug_break_slots());
|
| + DCHECK(old_code->kind() == Code::FUNCTION);
|
| + DCHECK(!old_code->has_debug_break_slots());
|
|
|
| info.MarkCompilingForDebugging();
|
| if (old_code->is_compiled_optimizable()) {
|
| @@ -785,7 +785,7 @@ MaybeHandle<Code> Compiler::GetCodeForDebugging(Handle<JSFunction> function) {
|
| if (!maybe_new_code.ToHandle(&new_code)) {
|
| isolate->clear_pending_exception();
|
| } else {
|
| - ASSERT_EQ(old_code->is_compiled_optimizable(),
|
| + DCHECK_EQ(old_code->is_compiled_optimizable(),
|
| new_code->is_compiled_optimizable());
|
| }
|
| return maybe_new_code;
|
| @@ -823,7 +823,7 @@ static bool DebuggerWantsEagerCompilation(CompilationInfo* info,
|
| static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
| Isolate* isolate = info->isolate();
|
| PostponeInterruptsScope postpone(isolate);
|
| - ASSERT(!isolate->native_context().is_null());
|
| + DCHECK(!isolate->native_context().is_null());
|
| Handle<Script> script = info->script();
|
|
|
| // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
|
| @@ -832,7 +832,7 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
|
|
| isolate->debug()->OnBeforeCompile(script);
|
|
|
| - ASSERT(info->is_eval() || info->is_global());
|
| + DCHECK(info->is_eval() || info->is_global());
|
|
|
| bool parse_allow_lazy =
|
| (info->compile_options() == ScriptCompiler::kConsumeParserCache ||
|
| @@ -875,14 +875,14 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
| }
|
|
|
| // Allocate function.
|
| - ASSERT(!info->code().is_null());
|
| + DCHECK(!info->code().is_null());
|
| result = isolate->factory()->NewSharedFunctionInfo(
|
| lit->name(), lit->materialized_literal_count(), lit->is_generator(),
|
| lit->is_arrow(), info->code(),
|
| ScopeInfo::Create(info->scope(), info->zone()),
|
| info->feedback_vector());
|
|
|
| - ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
|
| + DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
|
| SetFunctionInfo(result, lit, true, script);
|
|
|
| Handle<String> script_name = script->name()->IsString()
|
| @@ -951,7 +951,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
| shared_info->DisableOptimization(kEval);
|
|
|
| // If caller is strict mode, the result must be in strict mode as well.
|
| - ASSERT(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT);
|
| + DCHECK(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT);
|
| if (!shared_info->dont_cache()) {
|
| compilation_cache->PutEval(
|
| source, context, shared_info, scope_position);
|
| @@ -975,13 +975,13 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
|
| cached_data = NULL;
|
| } else if (compile_options == ScriptCompiler::kProduceParserCache ||
|
| compile_options == ScriptCompiler::kProduceCodeCache) {
|
| - ASSERT(cached_data && !*cached_data);
|
| - ASSERT(extension == NULL);
|
| + DCHECK(cached_data && !*cached_data);
|
| + DCHECK(extension == NULL);
|
| } else {
|
| - ASSERT(compile_options == ScriptCompiler::kConsumeParserCache ||
|
| + DCHECK(compile_options == ScriptCompiler::kConsumeParserCache ||
|
| compile_options == ScriptCompiler::kConsumeCodeCache);
|
| - ASSERT(cached_data && *cached_data);
|
| - ASSERT(extension == NULL);
|
| + DCHECK(cached_data && *cached_data);
|
| + DCHECK(extension == NULL);
|
| }
|
| Isolate* isolate = source->GetIsolate();
|
| int source_length = source->length();
|
| @@ -1092,7 +1092,7 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(
|
| info.SetCode(code);
|
| scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate));
|
| } else if (FullCodeGenerator::MakeCode(&info)) {
|
| - ASSERT(!info.code().is_null());
|
| + DCHECK(!info.code().is_null());
|
| scope_info = ScopeInfo::Create(info.scope(), info.zone());
|
| } else {
|
| return Handle<SharedFunctionInfo>::null();
|
| @@ -1172,7 +1172,7 @@ static bool CompileOptimizedPrologue(CompilationInfo* info) {
|
|
|
| if (!Rewriter::Rewrite(info)) return false;
|
| if (!Scope::Analyze(info)) return false;
|
| - ASSERT(info->scope() != NULL);
|
| + DCHECK(info->scope() != NULL);
|
| return true;
|
| }
|
|
|
| @@ -1188,7 +1188,7 @@ static bool GetOptimizedCodeNow(CompilationInfo* info) {
|
| if (job.GenerateCode() != OptimizedCompileJob::SUCCEEDED) return false;
|
|
|
| // Success!
|
| - ASSERT(!info->isolate()->has_pending_exception());
|
| + DCHECK(!info->isolate()->has_pending_exception());
|
| InsertCodeIntoOptimizedCodeMap(info);
|
| Compiler::RecordFunctionCompilation(
|
| Logger::LAZY_COMPILE_TAG, info, info->shared_info());
|
| @@ -1243,13 +1243,13 @@ MaybeHandle<Code> Compiler::GetOptimizedCode(Handle<JSFunction> function,
|
|
|
| SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function));
|
| Isolate* isolate = info->isolate();
|
| - ASSERT(AllowCompilation::IsAllowed(isolate));
|
| + DCHECK(AllowCompilation::IsAllowed(isolate));
|
| VMState<COMPILER> state(isolate);
|
| - ASSERT(!isolate->has_pending_exception());
|
| + DCHECK(!isolate->has_pending_exception());
|
| PostponeInterruptsScope postpone(isolate);
|
|
|
| Handle<SharedFunctionInfo> shared = info->shared_info();
|
| - ASSERT_NE(ScopeInfo::Empty(isolate), shared->scope_info());
|
| + DCHECK_NE(ScopeInfo::Empty(isolate), shared->scope_info());
|
| int compiled_size = shared->end_position() - shared->start_position();
|
| isolate->counters()->total_compile_size()->Increment(compiled_size);
|
| current_code->set_profiler_ticks(0);
|
|
|