| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 8370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8381 // Use the same AstValueFactory for creating strings in the sub-compilation | 8381 // Use the same AstValueFactory for creating strings in the sub-compilation |
| 8382 // step, but don't transfer ownership to target_info. | 8382 // step, but don't transfer ownership to target_info. |
| 8383 ParseInfo parse_info(zone(), target); | 8383 ParseInfo parse_info(zone(), target); |
| 8384 parse_info.set_ast_value_factory( | 8384 parse_info.set_ast_value_factory( |
| 8385 top_info()->parse_info()->ast_value_factory()); | 8385 top_info()->parse_info()->ast_value_factory()); |
| 8386 parse_info.set_ast_value_factory_owned(false); | 8386 parse_info.set_ast_value_factory_owned(false); |
| 8387 | 8387 |
| 8388 CompilationInfo target_info(&parse_info); | 8388 CompilationInfo target_info(&parse_info); |
| 8389 Handle<SharedFunctionInfo> target_shared(target->shared()); | 8389 Handle<SharedFunctionInfo> target_shared(target->shared()); |
| 8390 | 8390 |
| 8391 if (IsClassConstructor(target_shared->kind())) { | 8391 if (inlining_kind != CONSTRUCT_CALL_RETURN && |
| 8392 IsClassConstructor(target_shared->kind())) { |
| 8392 TraceInline(target, caller, "target is classConstructor"); | 8393 TraceInline(target, caller, "target is classConstructor"); |
| 8393 return false; | 8394 return false; |
| 8394 } | 8395 } |
| 8396 |
| 8395 if (target_shared->HasDebugInfo()) { | 8397 if (target_shared->HasDebugInfo()) { |
| 8396 TraceInline(target, caller, "target is being debugged"); | 8398 TraceInline(target, caller, "target is being debugged"); |
| 8397 return false; | 8399 return false; |
| 8398 } | 8400 } |
| 8399 if (!Compiler::ParseAndAnalyze(target_info.parse_info())) { | 8401 if (!Compiler::ParseAndAnalyze(target_info.parse_info())) { |
| 8400 if (target_info.isolate()->has_pending_exception()) { | 8402 if (target_info.isolate()->has_pending_exception()) { |
| 8401 // Parse or scope error, never optimize this function. | 8403 // Parse or scope error, never optimize this function. |
| 8402 SetStackOverflow(); | 8404 SetStackOverflow(); |
| 8403 target_shared->DisableOptimization(kParseScopeError); | 8405 target_shared->DisableOptimization(kParseScopeError); |
| 8404 } | 8406 } |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9896 | 9898 |
| 9897 int args_to_drop = argument_count + (expression->IsCall() ? 2 : 1); | 9899 int args_to_drop = argument_count + (expression->IsCall() ? 2 : 1); |
| 9898 Drop(args_to_drop); | 9900 Drop(args_to_drop); |
| 9899 ast_context()->ReturnValue(new_object); | 9901 ast_context()->ReturnValue(new_object); |
| 9900 } | 9902 } |
| 9901 | 9903 |
| 9902 | 9904 |
| 9903 // Checks whether allocation using the given constructor can be inlined. | 9905 // Checks whether allocation using the given constructor can be inlined. |
| 9904 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { | 9906 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { |
| 9905 return constructor->has_initial_map() && | 9907 return constructor->has_initial_map() && |
| 9906 !IsClassConstructor(constructor->shared()->kind()) && | 9908 !IsSubclassConstructor(constructor->shared()->kind()) && |
| 9907 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && | 9909 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && |
| 9908 constructor->initial_map()->instance_size() < | 9910 constructor->initial_map()->instance_size() < |
| 9909 HAllocate::kMaxInlineSize; | 9911 HAllocate::kMaxInlineSize; |
| 9910 } | 9912 } |
| 9911 | 9913 |
| 9912 | 9914 |
| 9913 bool HOptimizedGraphBuilder::IsCallArrayInlineable( | 9915 bool HOptimizedGraphBuilder::IsCallArrayInlineable( |
| 9914 int argument_count, | 9916 int argument_count, |
| 9915 Handle<AllocationSite> site) { | 9917 Handle<AllocationSite> site) { |
| 9916 Handle<JSFunction> caller = current_info()->closure(); | 9918 Handle<JSFunction> caller = current_info()->closure(); |
| (...skipping 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13655 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13657 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13656 } | 13658 } |
| 13657 | 13659 |
| 13658 #ifdef DEBUG | 13660 #ifdef DEBUG |
| 13659 graph_->Verify(false); // No full verify. | 13661 graph_->Verify(false); // No full verify. |
| 13660 #endif | 13662 #endif |
| 13661 } | 13663 } |
| 13662 | 13664 |
| 13663 } // namespace internal | 13665 } // namespace internal |
| 13664 } // namespace v8 | 13666 } // namespace v8 |
| OLD | NEW |