OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6772 if (!expr->ComputeTarget(info.map(), name)) return false; | 6772 if (!expr->ComputeTarget(info.map(), name)) return false; |
6773 | 6773 |
6774 BuildCheckHeapObject(receiver); | 6774 BuildCheckHeapObject(receiver); |
6775 Add<HCheckMaps>(receiver, types); | 6775 Add<HCheckMaps>(receiver, types); |
6776 AddCheckPrototypeMaps(expr->holder(), info.map()); | 6776 AddCheckPrototypeMaps(expr->holder(), info.map()); |
6777 if (FLAG_trace_inlining) { | 6777 if (FLAG_trace_inlining) { |
6778 Handle<JSFunction> caller = current_info()->closure(); | 6778 Handle<JSFunction> caller = current_info()->closure(); |
6779 SmartArrayPointer<char> caller_name = | 6779 SmartArrayPointer<char> caller_name = |
6780 caller->shared()->DebugName()->ToCString(); | 6780 caller->shared()->DebugName()->ToCString(); |
6781 PrintF("Trying to inline the polymorphic call to %s from %s\n", | 6781 PrintF("Trying to inline the polymorphic call to %s from %s\n", |
6782 *name->ToCString(), *caller_name); | 6782 name->ToCString().get(), caller_name.get()); |
6783 } | 6783 } |
6784 | 6784 |
6785 if (!TryInlineCall(expr)) { | 6785 if (!TryInlineCall(expr)) { |
6786 int argument_count = expr->arguments()->length() + 1; // Includes receiver. | 6786 int argument_count = expr->arguments()->length() + 1; // Includes receiver. |
6787 HCallConstantFunction* call = | 6787 HCallConstantFunction* call = |
6788 New<HCallConstantFunction>(expr->target(), argument_count); | 6788 New<HCallConstantFunction>(expr->target(), argument_count); |
6789 PreProcessCall(call); | 6789 PreProcessCall(call); |
6790 AddInstruction(call); | 6790 AddInstruction(call); |
6791 if (!ast_context()->IsEffect()) Push(call); | 6791 if (!ast_context()->IsEffect()) Push(call); |
6792 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 6792 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6885 } | 6885 } |
6886 set_current_block(if_true); | 6886 set_current_block(if_true); |
6887 | 6887 |
6888 expr->ComputeTarget(map, name); | 6888 expr->ComputeTarget(map, name); |
6889 AddCheckPrototypeMaps(expr->holder(), map); | 6889 AddCheckPrototypeMaps(expr->holder(), map); |
6890 if (FLAG_trace_inlining && FLAG_polymorphic_inlining) { | 6890 if (FLAG_trace_inlining && FLAG_polymorphic_inlining) { |
6891 Handle<JSFunction> caller = current_info()->closure(); | 6891 Handle<JSFunction> caller = current_info()->closure(); |
6892 SmartArrayPointer<char> caller_name = | 6892 SmartArrayPointer<char> caller_name = |
6893 caller->shared()->DebugName()->ToCString(); | 6893 caller->shared()->DebugName()->ToCString(); |
6894 PrintF("Trying to inline the polymorphic call to %s from %s\n", | 6894 PrintF("Trying to inline the polymorphic call to %s from %s\n", |
6895 *name->ToCString(), | 6895 name->ToCString().get(), |
6896 *caller_name); | 6896 caller_name.get()); |
6897 } | 6897 } |
6898 if (FLAG_polymorphic_inlining && TryInlineCall(expr)) { | 6898 if (FLAG_polymorphic_inlining && TryInlineCall(expr)) { |
6899 // Trying to inline will signal that we should bailout from the | 6899 // Trying to inline will signal that we should bailout from the |
6900 // entire compilation by setting stack overflow on the visitor. | 6900 // entire compilation by setting stack overflow on the visitor. |
6901 if (HasStackOverflow()) return; | 6901 if (HasStackOverflow()) return; |
6902 } else { | 6902 } else { |
6903 HCallConstantFunction* call = | 6903 HCallConstantFunction* call = |
6904 New<HCallConstantFunction>(expr->target(), argument_count); | 6904 New<HCallConstantFunction>(expr->target(), argument_count); |
6905 PreProcessCall(call); | 6905 PreProcessCall(call); |
6906 AddInstruction(call); | 6906 AddInstruction(call); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6950 | 6950 |
6951 void HOptimizedGraphBuilder::TraceInline(Handle<JSFunction> target, | 6951 void HOptimizedGraphBuilder::TraceInline(Handle<JSFunction> target, |
6952 Handle<JSFunction> caller, | 6952 Handle<JSFunction> caller, |
6953 const char* reason) { | 6953 const char* reason) { |
6954 if (FLAG_trace_inlining) { | 6954 if (FLAG_trace_inlining) { |
6955 SmartArrayPointer<char> target_name = | 6955 SmartArrayPointer<char> target_name = |
6956 target->shared()->DebugName()->ToCString(); | 6956 target->shared()->DebugName()->ToCString(); |
6957 SmartArrayPointer<char> caller_name = | 6957 SmartArrayPointer<char> caller_name = |
6958 caller->shared()->DebugName()->ToCString(); | 6958 caller->shared()->DebugName()->ToCString(); |
6959 if (reason == NULL) { | 6959 if (reason == NULL) { |
6960 PrintF("Inlined %s called from %s.\n", *target_name, *caller_name); | 6960 PrintF("Inlined %s called from %s.\n", target_name.get(), |
| 6961 caller_name.get()); |
6961 } else { | 6962 } else { |
6962 PrintF("Did not inline %s called from %s (%s).\n", | 6963 PrintF("Did not inline %s called from %s (%s).\n", |
6963 *target_name, *caller_name, reason); | 6964 target_name.get(), caller_name.get(), reason); |
6964 } | 6965 } |
6965 } | 6966 } |
6966 } | 6967 } |
6967 | 6968 |
6968 | 6969 |
6969 static const int kNotInlinable = 1000000000; | 6970 static const int kNotInlinable = 1000000000; |
6970 | 6971 |
6971 | 6972 |
6972 int HOptimizedGraphBuilder::InliningAstSize(Handle<JSFunction> target) { | 6973 int HOptimizedGraphBuilder::InliningAstSize(Handle<JSFunction> target) { |
6973 if (!FLAG_use_inlining) return kNotInlinable; | 6974 if (!FLAG_use_inlining) return kNotInlinable; |
(...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10489 stream->Add("\n"); | 10490 stream->Add("\n"); |
10490 } | 10491 } |
10491 PrintF("\n"); | 10492 PrintF("\n"); |
10492 } | 10493 } |
10493 | 10494 |
10494 | 10495 |
10495 void HEnvironment::PrintToStd() { | 10496 void HEnvironment::PrintToStd() { |
10496 HeapStringAllocator string_allocator; | 10497 HeapStringAllocator string_allocator; |
10497 StringStream trace(&string_allocator); | 10498 StringStream trace(&string_allocator); |
10498 PrintTo(&trace); | 10499 PrintTo(&trace); |
10499 PrintF("%s", *trace.ToCString()); | 10500 PrintF("%s", trace.ToCString().get()); |
10500 } | 10501 } |
10501 | 10502 |
10502 | 10503 |
10503 void HTracer::TraceCompilation(CompilationInfo* info) { | 10504 void HTracer::TraceCompilation(CompilationInfo* info) { |
10504 Tag tag(this, "compilation"); | 10505 Tag tag(this, "compilation"); |
10505 if (info->IsOptimizing()) { | 10506 if (info->IsOptimizing()) { |
10506 Handle<String> name = info->function()->debug_name(); | 10507 Handle<String> name = info->function()->debug_name(); |
10507 PrintStringProperty("name", *name->ToCString()); | 10508 PrintStringProperty("name", name->ToCString().get()); |
10508 PrintStringProperty("method", *name->ToCString()); | 10509 PrintStringProperty("method", name->ToCString().get()); |
10509 } else { | 10510 } else { |
10510 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 10511 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
10511 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); | 10512 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); |
10512 PrintStringProperty("method", "stub"); | 10513 PrintStringProperty("method", "stub"); |
10513 } | 10514 } |
10514 PrintLongProperty("date", static_cast<int64_t>(OS::TimeCurrentMillis())); | 10515 PrintLongProperty("date", static_cast<int64_t>(OS::TimeCurrentMillis())); |
10515 } | 10516 } |
10516 | 10517 |
10517 | 10518 |
10518 void HTracer::TraceLithium(const char* name, LChunk* chunk) { | 10519 void HTracer::TraceLithium(const char* name, LChunk* chunk) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10718 } | 10719 } |
10719 current_pos = current_pos->next(); | 10720 current_pos = current_pos->next(); |
10720 } | 10721 } |
10721 | 10722 |
10722 trace_.Add(" \"\"\n"); | 10723 trace_.Add(" \"\"\n"); |
10723 } | 10724 } |
10724 } | 10725 } |
10725 | 10726 |
10726 | 10727 |
10727 void HTracer::FlushToFile() { | 10728 void HTracer::FlushToFile() { |
10728 AppendChars(filename_.start(), *trace_.ToCString(), trace_.length(), false); | 10729 AppendChars(filename_.start(), trace_.ToCString().get(), trace_.length(), |
| 10730 false); |
10729 trace_.Reset(); | 10731 trace_.Reset(); |
10730 } | 10732 } |
10731 | 10733 |
10732 | 10734 |
10733 void HStatistics::Initialize(CompilationInfo* info) { | 10735 void HStatistics::Initialize(CompilationInfo* info) { |
10734 if (info->shared_info().is_null()) return; | 10736 if (info->shared_info().is_null()) return; |
10735 source_size_ += info->shared_info()->SourceSize(); | 10737 source_size_ += info->shared_info()->SourceSize(); |
10736 } | 10738 } |
10737 | 10739 |
10738 | 10740 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10808 if (ShouldProduceTraceOutput()) { | 10810 if (ShouldProduceTraceOutput()) { |
10809 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10811 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10810 } | 10812 } |
10811 | 10813 |
10812 #ifdef DEBUG | 10814 #ifdef DEBUG |
10813 graph_->Verify(false); // No full verify. | 10815 graph_->Verify(false); // No full verify. |
10814 #endif | 10816 #endif |
10815 } | 10817 } |
10816 | 10818 |
10817 } } // namespace v8::internal | 10819 } } // namespace v8::internal |
OLD | NEW |