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-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 8343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8354 // Parse and allocate variables. | 8354 // Parse and allocate variables. |
8355 // Use the same AstValueFactory for creating strings in the sub-compilation | 8355 // Use the same AstValueFactory for creating strings in the sub-compilation |
8356 // step, but don't transfer ownership to target_info. | 8356 // step, but don't transfer ownership to target_info. |
8357 ParseInfo parse_info(zone(), target); | 8357 ParseInfo parse_info(zone(), target); |
8358 parse_info.set_ast_value_factory( | 8358 parse_info.set_ast_value_factory( |
8359 top_info()->parse_info()->ast_value_factory()); | 8359 top_info()->parse_info()->ast_value_factory()); |
8360 parse_info.set_ast_value_factory_owned(false); | 8360 parse_info.set_ast_value_factory_owned(false); |
8361 | 8361 |
8362 CompilationInfo target_info(&parse_info); | 8362 CompilationInfo target_info(&parse_info); |
8363 Handle<SharedFunctionInfo> target_shared(target->shared()); | 8363 Handle<SharedFunctionInfo> target_shared(target->shared()); |
| 8364 |
| 8365 if (IsClassConstructor(target_shared->kind())) { |
| 8366 TraceInline(target, caller, "target is classConstructor"); |
| 8367 return false; |
| 8368 } |
8364 if (target_shared->HasDebugInfo()) { | 8369 if (target_shared->HasDebugInfo()) { |
8365 TraceInline(target, caller, "target is being debugged"); | 8370 TraceInline(target, caller, "target is being debugged"); |
8366 return false; | 8371 return false; |
8367 } | 8372 } |
8368 if (!Compiler::ParseAndAnalyze(target_info.parse_info())) { | 8373 if (!Compiler::ParseAndAnalyze(target_info.parse_info())) { |
8369 if (target_info.isolate()->has_pending_exception()) { | 8374 if (target_info.isolate()->has_pending_exception()) { |
8370 // Parse or scope error, never optimize this function. | 8375 // Parse or scope error, never optimize this function. |
8371 SetStackOverflow(); | 8376 SetStackOverflow(); |
8372 target_shared->DisableOptimization(kParseScopeError); | 8377 target_shared->DisableOptimization(kParseScopeError); |
8373 } | 8378 } |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9350 | 9355 |
9351 BuildFunctionApply(expr); | 9356 BuildFunctionApply(expr); |
9352 return true; | 9357 return true; |
9353 } | 9358 } |
9354 default: { return false; } | 9359 default: { return false; } |
9355 } | 9360 } |
9356 UNREACHABLE(); | 9361 UNREACHABLE(); |
9357 } | 9362 } |
9358 | 9363 |
9359 | 9364 |
| 9365 // f.apply(...) |
9360 void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) { | 9366 void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) { |
9361 ZoneList<Expression*>* args = expr->arguments(); | 9367 ZoneList<Expression*>* args = expr->arguments(); |
9362 CHECK_ALIVE(VisitForValue(args->at(0))); | 9368 CHECK_ALIVE(VisitForValue(args->at(0))); |
9363 HValue* receiver = Pop(); // receiver | 9369 HValue* receiver = Pop(); // receiver |
9364 HValue* function = Pop(); // f | 9370 HValue* function = Pop(); // f |
9365 Drop(1); // apply | 9371 Drop(1); // apply |
9366 | 9372 |
9367 Handle<Map> function_map = expr->GetReceiverTypes()->first(); | 9373 Handle<Map> function_map = expr->GetReceiverTypes()->first(); |
9368 HValue* checked_function = AddCheckMap(function, function_map); | 9374 HValue* checked_function = AddCheckMap(function, function_map); |
9369 | 9375 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9751 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { | 9757 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { |
9752 Handle<Object> constant = HConstant::cast(function)->handle(isolate()); | 9758 Handle<Object> constant = HConstant::cast(function)->handle(isolate()); |
9753 Handle<JSFunction> target = Handle<JSFunction>::cast(constant); | 9759 Handle<JSFunction> target = Handle<JSFunction>::cast(constant); |
9754 expr->SetKnownGlobalTarget(target); | 9760 expr->SetKnownGlobalTarget(target); |
9755 } | 9761 } |
9756 | 9762 |
9757 // Placeholder for the receiver. | 9763 // Placeholder for the receiver. |
9758 Push(graph()->GetConstantUndefined()); | 9764 Push(graph()->GetConstantUndefined()); |
9759 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 9765 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
9760 | 9766 |
9761 if (expr->IsMonomorphic()) { | 9767 if (expr->IsMonomorphic() && |
| 9768 !IsClassConstructor(expr->target()->shared()->kind())) { |
9762 Add<HCheckValue>(function, expr->target()); | 9769 Add<HCheckValue>(function, expr->target()); |
9763 | 9770 |
9764 // Patch the global object on the stack by the expected receiver. | 9771 // Patch the global object on the stack by the expected receiver. |
9765 HValue* receiver = ImplicitReceiverFor(function, expr->target()); | 9772 HValue* receiver = ImplicitReceiverFor(function, expr->target()); |
9766 const int receiver_index = argument_count - 1; | 9773 const int receiver_index = argument_count - 1; |
9767 environment()->SetExpressionStackAt(receiver_index, receiver); | 9774 environment()->SetExpressionStackAt(receiver_index, receiver); |
9768 | 9775 |
9769 if (TryInlineBuiltinFunctionCall(expr)) { | 9776 if (TryInlineBuiltinFunctionCall(expr)) { |
9770 if (FLAG_trace_inlining) { | 9777 if (FLAG_trace_inlining) { |
9771 PrintF("Inlining builtin "); | 9778 PrintF("Inlining builtin "); |
(...skipping 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13681 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13688 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13682 } | 13689 } |
13683 | 13690 |
13684 #ifdef DEBUG | 13691 #ifdef DEBUG |
13685 graph_->Verify(false); // No full verify. | 13692 graph_->Verify(false); // No full verify. |
13686 #endif | 13693 #endif |
13687 } | 13694 } |
13688 | 13695 |
13689 } // namespace internal | 13696 } // namespace internal |
13690 } // namespace v8 | 13697 } // namespace v8 |
OLD | NEW |