| 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 7051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7062 if (target_shared->dont_inline() || target_shared->dont_optimize()) { | 7062 if (target_shared->dont_inline() || target_shared->dont_optimize()) { |
| 7063 TraceInline(target, caller, "target contains unsupported syntax [early]"); | 7063 TraceInline(target, caller, "target contains unsupported syntax [early]"); |
| 7064 return kNotInlinable; | 7064 return kNotInlinable; |
| 7065 } | 7065 } |
| 7066 | 7066 |
| 7067 int nodes_added = target_shared->ast_node_count(); | 7067 int nodes_added = target_shared->ast_node_count(); |
| 7068 return nodes_added; | 7068 return nodes_added; |
| 7069 } | 7069 } |
| 7070 | 7070 |
| 7071 | 7071 |
| 7072 bool HOptimizedGraphBuilder::TryInline(CallKind call_kind, | 7072 bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target, |
| 7073 Handle<JSFunction> target, | |
| 7074 int arguments_count, | 7073 int arguments_count, |
| 7075 HValue* implicit_return_value, | 7074 HValue* implicit_return_value, |
| 7076 BailoutId ast_id, | 7075 BailoutId ast_id, |
| 7077 BailoutId return_id, | 7076 BailoutId return_id, |
| 7078 InliningKind inlining_kind) { | 7077 InliningKind inlining_kind) { |
| 7079 int nodes_added = InliningAstSize(target); | 7078 int nodes_added = InliningAstSize(target); |
| 7080 if (nodes_added == kNotInlinable) return false; | 7079 if (nodes_added == kNotInlinable) return false; |
| 7081 | 7080 |
| 7082 Handle<JSFunction> caller = current_info()->closure(); | 7081 Handle<JSFunction> caller = current_info()->closure(); |
| 7083 | 7082 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7346 set_current_block(function_return()); | 7345 set_current_block(function_return()); |
| 7347 } else { | 7346 } else { |
| 7348 set_current_block(NULL); | 7347 set_current_block(NULL); |
| 7349 } | 7348 } |
| 7350 delete target_state; | 7349 delete target_state; |
| 7351 return true; | 7350 return true; |
| 7352 } | 7351 } |
| 7353 | 7352 |
| 7354 | 7353 |
| 7355 bool HOptimizedGraphBuilder::TryInlineCall(Call* expr, bool drop_extra) { | 7354 bool HOptimizedGraphBuilder::TryInlineCall(Call* expr, bool drop_extra) { |
| 7356 // The function call we are inlining is a method call if the call | 7355 return TryInline(expr->target(), |
| 7357 // is a property call. | |
| 7358 CallKind call_kind = (expr->expression()->AsProperty() == NULL) | |
| 7359 ? CALL_AS_FUNCTION | |
| 7360 : CALL_AS_METHOD; | |
| 7361 | |
| 7362 return TryInline(call_kind, | |
| 7363 expr->target(), | |
| 7364 expr->arguments()->length(), | 7356 expr->arguments()->length(), |
| 7365 NULL, | 7357 NULL, |
| 7366 expr->id(), | 7358 expr->id(), |
| 7367 expr->ReturnId(), | 7359 expr->ReturnId(), |
| 7368 drop_extra ? DROP_EXTRA_ON_RETURN : NORMAL_RETURN); | 7360 drop_extra ? DROP_EXTRA_ON_RETURN : NORMAL_RETURN); |
| 7369 } | 7361 } |
| 7370 | 7362 |
| 7371 | 7363 |
| 7372 bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr, | 7364 bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr, |
| 7373 HValue* implicit_return_value) { | 7365 HValue* implicit_return_value) { |
| 7374 return TryInline(CALL_AS_FUNCTION, | 7366 return TryInline(expr->target(), |
| 7375 expr->target(), | |
| 7376 expr->arguments()->length(), | 7367 expr->arguments()->length(), |
| 7377 implicit_return_value, | 7368 implicit_return_value, |
| 7378 expr->id(), | 7369 expr->id(), |
| 7379 expr->ReturnId(), | 7370 expr->ReturnId(), |
| 7380 CONSTRUCT_CALL_RETURN); | 7371 CONSTRUCT_CALL_RETURN); |
| 7381 } | 7372 } |
| 7382 | 7373 |
| 7383 | 7374 |
| 7384 bool HOptimizedGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, | 7375 bool HOptimizedGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
| 7385 BailoutId ast_id, | 7376 BailoutId ast_id, |
| 7386 BailoutId return_id) { | 7377 BailoutId return_id) { |
| 7387 return TryInline(CALL_AS_METHOD, | 7378 return TryInline(getter, |
| 7388 getter, | |
| 7389 0, | 7379 0, |
| 7390 NULL, | 7380 NULL, |
| 7391 ast_id, | 7381 ast_id, |
| 7392 return_id, | 7382 return_id, |
| 7393 GETTER_CALL_RETURN); | 7383 GETTER_CALL_RETURN); |
| 7394 } | 7384 } |
| 7395 | 7385 |
| 7396 | 7386 |
| 7397 bool HOptimizedGraphBuilder::TryInlineSetter(Handle<JSFunction> setter, | 7387 bool HOptimizedGraphBuilder::TryInlineSetter(Handle<JSFunction> setter, |
| 7398 BailoutId id, | 7388 BailoutId id, |
| 7399 BailoutId assignment_id, | 7389 BailoutId assignment_id, |
| 7400 HValue* implicit_return_value) { | 7390 HValue* implicit_return_value) { |
| 7401 return TryInline(CALL_AS_METHOD, | 7391 return TryInline(setter, |
| 7402 setter, | |
| 7403 1, | 7392 1, |
| 7404 implicit_return_value, | 7393 implicit_return_value, |
| 7405 id, assignment_id, | 7394 id, assignment_id, |
| 7406 SETTER_CALL_RETURN); | 7395 SETTER_CALL_RETURN); |
| 7407 } | 7396 } |
| 7408 | 7397 |
| 7409 | 7398 |
| 7410 bool HOptimizedGraphBuilder::TryInlineApply(Handle<JSFunction> function, | 7399 bool HOptimizedGraphBuilder::TryInlineApply(Handle<JSFunction> function, |
| 7411 Call* expr, | 7400 Call* expr, |
| 7412 int arguments_count) { | 7401 int arguments_count) { |
| 7413 return TryInline(CALL_AS_METHOD, | 7402 return TryInline(function, |
| 7414 function, | |
| 7415 arguments_count, | 7403 arguments_count, |
| 7416 NULL, | 7404 NULL, |
| 7417 expr->id(), | 7405 expr->id(), |
| 7418 expr->ReturnId(), | 7406 expr->ReturnId(), |
| 7419 NORMAL_RETURN); | 7407 NORMAL_RETURN); |
| 7420 } | 7408 } |
| 7421 | 7409 |
| 7422 | 7410 |
| 7423 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, | 7411 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, |
| 7424 bool drop_extra) { | 7412 bool drop_extra) { |
| (...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10966 if (ShouldProduceTraceOutput()) { | 10954 if (ShouldProduceTraceOutput()) { |
| 10967 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10955 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10968 } | 10956 } |
| 10969 | 10957 |
| 10970 #ifdef DEBUG | 10958 #ifdef DEBUG |
| 10971 graph_->Verify(false); // No full verify. | 10959 graph_->Verify(false); // No full verify. |
| 10972 #endif | 10960 #endif |
| 10973 } | 10961 } |
| 10974 | 10962 |
| 10975 } } // namespace v8::internal | 10963 } } // namespace v8::internal |
| OLD | NEW |