| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 4393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4404 | 4404 |
| 4405 void HOptimizedGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs, | 4405 void HOptimizedGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs, |
| 4406 ArgumentsAllowedFlag flag) { | 4406 ArgumentsAllowedFlag flag) { |
| 4407 for (int i = 0; i < exprs->length(); ++i) { | 4407 for (int i = 0; i < exprs->length(); ++i) { |
| 4408 CHECK_ALIVE(VisitForValue(exprs->at(i), flag)); | 4408 CHECK_ALIVE(VisitForValue(exprs->at(i), flag)); |
| 4409 } | 4409 } |
| 4410 } | 4410 } |
| 4411 | 4411 |
| 4412 | 4412 |
| 4413 bool HOptimizedGraphBuilder::BuildGraph() { | 4413 bool HOptimizedGraphBuilder::BuildGraph() { |
| 4414 if (IsSubclassConstructor(current_info()->function()->kind())) { | 4414 if (IsSubclassConstructor(current_info()->literal()->kind())) { |
| 4415 Bailout(kSuperReference); | 4415 Bailout(kSuperReference); |
| 4416 return false; | 4416 return false; |
| 4417 } | 4417 } |
| 4418 | 4418 |
| 4419 int slots = current_info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 4419 int slots = current_info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 4420 if (current_info()->scope()->is_script_scope() && slots > 0) { | 4420 if (current_info()->scope()->is_script_scope() && slots > 0) { |
| 4421 Bailout(kScriptContext); | 4421 Bailout(kScriptContext); |
| 4422 return false; | 4422 return false; |
| 4423 } | 4423 } |
| 4424 | 4424 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4444 HBasicBlock* body_entry = CreateBasicBlock(initial_env); | 4444 HBasicBlock* body_entry = CreateBasicBlock(initial_env); |
| 4445 Goto(body_entry); | 4445 Goto(body_entry); |
| 4446 body_entry->SetJoinId(BailoutId::FunctionEntry()); | 4446 body_entry->SetJoinId(BailoutId::FunctionEntry()); |
| 4447 set_current_block(body_entry); | 4447 set_current_block(body_entry); |
| 4448 | 4448 |
| 4449 VisitDeclarations(scope->declarations()); | 4449 VisitDeclarations(scope->declarations()); |
| 4450 Add<HSimulate>(BailoutId::Declarations()); | 4450 Add<HSimulate>(BailoutId::Declarations()); |
| 4451 | 4451 |
| 4452 Add<HStackCheck>(HStackCheck::kFunctionEntry); | 4452 Add<HStackCheck>(HStackCheck::kFunctionEntry); |
| 4453 | 4453 |
| 4454 VisitStatements(current_info()->function()->body()); | 4454 VisitStatements(current_info()->literal()->body()); |
| 4455 if (HasStackOverflow()) return false; | 4455 if (HasStackOverflow()) return false; |
| 4456 | 4456 |
| 4457 if (current_block() != NULL) { | 4457 if (current_block() != NULL) { |
| 4458 Add<HReturn>(graph()->GetConstantUndefined()); | 4458 Add<HReturn>(graph()->GetConstantUndefined()); |
| 4459 set_current_block(NULL); | 4459 set_current_block(NULL); |
| 4460 } | 4460 } |
| 4461 | 4461 |
| 4462 // If the checksum of the number of type info changes is the same as the | 4462 // If the checksum of the number of type info changes is the same as the |
| 4463 // last time this function was compiled, then this recompile is likely not | 4463 // last time this function was compiled, then this recompile is likely not |
| 4464 // due to missing/inadequate type feedback, but rather too aggressive | 4464 // due to missing/inadequate type feedback, but rather too aggressive |
| (...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8274 target_shared->DisableOptimization(kParseScopeError); | 8274 target_shared->DisableOptimization(kParseScopeError); |
| 8275 } | 8275 } |
| 8276 TraceInline(target, caller, "parse failure"); | 8276 TraceInline(target, caller, "parse failure"); |
| 8277 return false; | 8277 return false; |
| 8278 } | 8278 } |
| 8279 | 8279 |
| 8280 if (target_info.scope()->num_heap_slots() > 0) { | 8280 if (target_info.scope()->num_heap_slots() > 0) { |
| 8281 TraceInline(target, caller, "target has context-allocated variables"); | 8281 TraceInline(target, caller, "target has context-allocated variables"); |
| 8282 return false; | 8282 return false; |
| 8283 } | 8283 } |
| 8284 FunctionLiteral* function = target_info.function(); | 8284 FunctionLiteral* function = target_info.literal(); |
| 8285 | 8285 |
| 8286 // The following conditions must be checked again after re-parsing, because | 8286 // The following conditions must be checked again after re-parsing, because |
| 8287 // earlier the information might not have been complete due to lazy parsing. | 8287 // earlier the information might not have been complete due to lazy parsing. |
| 8288 nodes_added = function->ast_node_count(); | 8288 nodes_added = function->ast_node_count(); |
| 8289 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { | 8289 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { |
| 8290 TraceInline(target, caller, "target AST is too large [late]"); | 8290 TraceInline(target, caller, "target AST is too large [late]"); |
| 8291 return false; | 8291 return false; |
| 8292 } | 8292 } |
| 8293 if (function->dont_optimize()) { | 8293 if (function->dont_optimize()) { |
| 8294 TraceInline(target, caller, "target contains unsupported syntax [late]"); | 8294 TraceInline(target, caller, "target contains unsupported syntax [late]"); |
| (...skipping 4809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13104 } | 13104 } |
| 13105 os << "\n"; | 13105 os << "\n"; |
| 13106 } | 13106 } |
| 13107 return os << "\n"; | 13107 return os << "\n"; |
| 13108 } | 13108 } |
| 13109 | 13109 |
| 13110 | 13110 |
| 13111 void HTracer::TraceCompilation(CompilationInfo* info) { | 13111 void HTracer::TraceCompilation(CompilationInfo* info) { |
| 13112 Tag tag(this, "compilation"); | 13112 Tag tag(this, "compilation"); |
| 13113 if (info->IsOptimizing()) { | 13113 if (info->IsOptimizing()) { |
| 13114 Handle<String> name = info->function()->debug_name(); | 13114 Handle<String> name = info->literal()->debug_name(); |
| 13115 PrintStringProperty("name", name->ToCString().get()); | 13115 PrintStringProperty("name", name->ToCString().get()); |
| 13116 PrintIndent(); | 13116 PrintIndent(); |
| 13117 trace_.Add("method \"%s:%d\"\n", | 13117 trace_.Add("method \"%s:%d\"\n", |
| 13118 name->ToCString().get(), | 13118 name->ToCString().get(), |
| 13119 info->optimization_id()); | 13119 info->optimization_id()); |
| 13120 } else { | 13120 } else { |
| 13121 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 13121 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
| 13122 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); | 13122 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); |
| 13123 PrintStringProperty("method", "stub"); | 13123 PrintStringProperty("method", "stub"); |
| 13124 } | 13124 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13437 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13437 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13438 } | 13438 } |
| 13439 | 13439 |
| 13440 #ifdef DEBUG | 13440 #ifdef DEBUG |
| 13441 graph_->Verify(false); // No full verify. | 13441 graph_->Verify(false); // No full verify. |
| 13442 #endif | 13442 #endif |
| 13443 } | 13443 } |
| 13444 | 13444 |
| 13445 } // namespace internal | 13445 } // namespace internal |
| 13446 } // namespace v8 | 13446 } // namespace v8 |
| OLD | NEW |