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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <sstream> | 8 #include <sstream> |
8 | 9 |
9 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 11 #include "src/ast/ast-numbering.h" |
11 #include "src/ast/scopeinfo.h" | 12 #include "src/ast/scopeinfo.h" |
12 #include "src/code-factory.h" | 13 #include "src/code-factory.h" |
13 #include "src/crankshaft/hydrogen-bce.h" | 14 #include "src/crankshaft/hydrogen-bce.h" |
14 #include "src/crankshaft/hydrogen-canonicalize.h" | 15 #include "src/crankshaft/hydrogen-canonicalize.h" |
15 #include "src/crankshaft/hydrogen-check-elimination.h" | 16 #include "src/crankshaft/hydrogen-check-elimination.h" |
16 #include "src/crankshaft/hydrogen-dce.h" | 17 #include "src/crankshaft/hydrogen-dce.h" |
(...skipping 8130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8147 AddCheckPrototypeMaps(info.holder(), map); | 8148 AddCheckPrototypeMaps(info.holder(), map); |
8148 | 8149 |
8149 HValue* function = Add<HConstant>(expr->target()); | 8150 HValue* function = Add<HConstant>(expr->target()); |
8150 environment()->SetExpressionStackAt(0, function); | 8151 environment()->SetExpressionStackAt(0, function); |
8151 Push(receiver); | 8152 Push(receiver); |
8152 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 8153 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
8153 bool needs_wrapping = info.NeedsWrappingFor(target); | 8154 bool needs_wrapping = info.NeedsWrappingFor(target); |
8154 bool try_inline = FLAG_polymorphic_inlining && !needs_wrapping; | 8155 bool try_inline = FLAG_polymorphic_inlining && !needs_wrapping; |
8155 if (FLAG_trace_inlining && try_inline) { | 8156 if (FLAG_trace_inlining && try_inline) { |
8156 Handle<JSFunction> caller = current_info()->closure(); | 8157 Handle<JSFunction> caller = current_info()->closure(); |
8157 base::SmartArrayPointer<char> caller_name = | 8158 std::unique_ptr<char[]> caller_name = |
8158 caller->shared()->DebugName()->ToCString(); | 8159 caller->shared()->DebugName()->ToCString(); |
8159 PrintF("Trying to inline the polymorphic call to %s from %s\n", | 8160 PrintF("Trying to inline the polymorphic call to %s from %s\n", |
8160 name->ToCString().get(), | 8161 name->ToCString().get(), |
8161 caller_name.get()); | 8162 caller_name.get()); |
8162 } | 8163 } |
8163 if (try_inline && TryInlineCall(expr)) { | 8164 if (try_inline && TryInlineCall(expr)) { |
8164 // Trying to inline will signal that we should bailout from the | 8165 // Trying to inline will signal that we should bailout from the |
8165 // entire compilation by setting stack overflow on the visitor. | 8166 // entire compilation by setting stack overflow on the visitor. |
8166 if (HasStackOverflow()) return; | 8167 if (HasStackOverflow()) return; |
8167 } else { | 8168 } else { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8234 } else { | 8235 } else { |
8235 set_current_block(NULL); | 8236 set_current_block(NULL); |
8236 } | 8237 } |
8237 } | 8238 } |
8238 | 8239 |
8239 void HOptimizedGraphBuilder::TraceInline(Handle<JSFunction> target, | 8240 void HOptimizedGraphBuilder::TraceInline(Handle<JSFunction> target, |
8240 Handle<JSFunction> caller, | 8241 Handle<JSFunction> caller, |
8241 const char* reason, | 8242 const char* reason, |
8242 TailCallMode tail_call_mode) { | 8243 TailCallMode tail_call_mode) { |
8243 if (FLAG_trace_inlining) { | 8244 if (FLAG_trace_inlining) { |
8244 base::SmartArrayPointer<char> target_name = | 8245 std::unique_ptr<char[]> target_name = |
8245 target->shared()->DebugName()->ToCString(); | 8246 target->shared()->DebugName()->ToCString(); |
8246 base::SmartArrayPointer<char> caller_name = | 8247 std::unique_ptr<char[]> caller_name = |
8247 caller->shared()->DebugName()->ToCString(); | 8248 caller->shared()->DebugName()->ToCString(); |
8248 if (reason == NULL) { | 8249 if (reason == NULL) { |
8249 const char* call_mode = | 8250 const char* call_mode = |
8250 tail_call_mode == TailCallMode::kAllow ? "tail called" : "called"; | 8251 tail_call_mode == TailCallMode::kAllow ? "tail called" : "called"; |
8251 PrintF("Inlined %s %s from %s.\n", target_name.get(), call_mode, | 8252 PrintF("Inlined %s %s from %s.\n", target_name.get(), call_mode, |
8252 caller_name.get()); | 8253 caller_name.get()); |
8253 } else { | 8254 } else { |
8254 PrintF("Did not inline %s called from %s (%s).\n", | 8255 PrintF("Did not inline %s called from %s (%s).\n", |
8255 target_name.get(), caller_name.get(), reason); | 8256 target_name.get(), caller_name.get(), reason); |
8256 } | 8257 } |
(...skipping 4829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13086 if (info->parse_info()) { | 13087 if (info->parse_info()) { |
13087 Object* source_name = info->script()->name(); | 13088 Object* source_name = info->script()->name(); |
13088 if (source_name->IsString()) { | 13089 if (source_name->IsString()) { |
13089 String* str = String::cast(source_name); | 13090 String* str = String::cast(source_name); |
13090 if (str->length() > 0) { | 13091 if (str->length() > 0) { |
13091 name.append(str->ToCString().get()); | 13092 name.append(str->ToCString().get()); |
13092 name.append(":"); | 13093 name.append(":"); |
13093 } | 13094 } |
13094 } | 13095 } |
13095 } | 13096 } |
13096 base::SmartArrayPointer<char> method_name = info->GetDebugName(); | 13097 std::unique_ptr<char[]> method_name = info->GetDebugName(); |
13097 name.append(method_name.get()); | 13098 name.append(method_name.get()); |
13098 if (info->IsOptimizing()) { | 13099 if (info->IsOptimizing()) { |
13099 PrintStringProperty("name", name.c_str()); | 13100 PrintStringProperty("name", name.c_str()); |
13100 PrintIndent(); | 13101 PrintIndent(); |
13101 trace_.Add("method \"%s:%d\"\n", method_name.get(), | 13102 trace_.Add("method \"%s:%d\"\n", method_name.get(), |
13102 info->optimization_id()); | 13103 info->optimization_id()); |
13103 } else { | 13104 } else { |
13104 PrintStringProperty("name", name.c_str()); | 13105 PrintStringProperty("name", name.c_str()); |
13105 PrintStringProperty("method", "stub"); | 13106 PrintStringProperty("method", "stub"); |
13106 } | 13107 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13420 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13421 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13421 } | 13422 } |
13422 | 13423 |
13423 #ifdef DEBUG | 13424 #ifdef DEBUG |
13424 graph_->Verify(false); // No full verify. | 13425 graph_->Verify(false); // No full verify. |
13425 #endif | 13426 #endif |
13426 } | 13427 } |
13427 | 13428 |
13428 } // namespace internal | 13429 } // namespace internal |
13429 } // namespace v8 | 13430 } // namespace v8 |
OLD | NEW |