| 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3319 | 3319 |
| 3320 | 3320 |
| 3321 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) | 3321 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) |
| 3322 : HGraphBuilder(info), | 3322 : HGraphBuilder(info), |
| 3323 function_state_(NULL), | 3323 function_state_(NULL), |
| 3324 initial_function_state_(this, info, NORMAL_RETURN, 0), | 3324 initial_function_state_(this, info, NORMAL_RETURN, 0), |
| 3325 ast_context_(NULL), | 3325 ast_context_(NULL), |
| 3326 break_scope_(NULL), | 3326 break_scope_(NULL), |
| 3327 inlined_count_(0), | 3327 inlined_count_(0), |
| 3328 globals_(10, info->zone()), | 3328 globals_(10, info->zone()), |
| 3329 inline_bailout_(false), | |
| 3330 osr_(new(info->zone()) HOsrBuilder(this)) { | 3329 osr_(new(info->zone()) HOsrBuilder(this)) { |
| 3331 // This is not initialized in the initializer list because the | 3330 // This is not initialized in the initializer list because the |
| 3332 // constructor for the initial state relies on function_state_ == NULL | 3331 // constructor for the initial state relies on function_state_ == NULL |
| 3333 // to know it's the initial state. | 3332 // to know it's the initial state. |
| 3334 function_state_= &initial_function_state_; | 3333 function_state_= &initial_function_state_; |
| 3335 InitializeAstVisitor(info->zone()); | 3334 InitializeAstVisitor(info->zone()); |
| 3336 if (FLAG_hydrogen_track_positions) { | 3335 if (FLAG_hydrogen_track_positions) { |
| 3337 SetSourcePosition(info->shared_info()->start_position()); | 3336 SetSourcePosition(info->shared_info()->start_position()); |
| 3338 } | 3337 } |
| 3339 } | 3338 } |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4204 | 4203 |
| 4205 | 4204 |
| 4206 #define CHECK_ALIVE_OR_RETURN(call, value) \ | 4205 #define CHECK_ALIVE_OR_RETURN(call, value) \ |
| 4207 do { \ | 4206 do { \ |
| 4208 call; \ | 4207 call; \ |
| 4209 if (HasStackOverflow() || current_block() == NULL) return value; \ | 4208 if (HasStackOverflow() || current_block() == NULL) return value; \ |
| 4210 } while (false) | 4209 } while (false) |
| 4211 | 4210 |
| 4212 | 4211 |
| 4213 void HOptimizedGraphBuilder::Bailout(BailoutReason reason) { | 4212 void HOptimizedGraphBuilder::Bailout(BailoutReason reason) { |
| 4214 current_info()->set_bailout_reason(reason); | 4213 current_info()->AbortOptimization(reason); |
| 4215 SetStackOverflow(); | 4214 SetStackOverflow(); |
| 4216 } | 4215 } |
| 4217 | 4216 |
| 4218 | 4217 |
| 4219 void HOptimizedGraphBuilder::VisitForEffect(Expression* expr) { | 4218 void HOptimizedGraphBuilder::VisitForEffect(Expression* expr) { |
| 4220 EffectContext for_effect(this); | 4219 EffectContext for_effect(this); |
| 4221 Visit(expr); | 4220 Visit(expr); |
| 4222 } | 4221 } |
| 4223 | 4222 |
| 4224 | 4223 |
| (...skipping 3699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7924 Add<HEnterInlined>(return_id, target, context, arguments_count, function, | 7923 Add<HEnterInlined>(return_id, target, context, arguments_count, function, |
| 7925 function_state()->inlining_kind(), | 7924 function_state()->inlining_kind(), |
| 7926 function->scope()->arguments(), arguments_object); | 7925 function->scope()->arguments(), arguments_object); |
| 7927 function_state()->set_entry(enter_inlined); | 7926 function_state()->set_entry(enter_inlined); |
| 7928 | 7927 |
| 7929 VisitDeclarations(target_info.scope()->declarations()); | 7928 VisitDeclarations(target_info.scope()->declarations()); |
| 7930 VisitStatements(function->body()); | 7929 VisitStatements(function->body()); |
| 7931 set_scope(saved_scope); | 7930 set_scope(saved_scope); |
| 7932 if (HasStackOverflow()) { | 7931 if (HasStackOverflow()) { |
| 7933 // Bail out if the inline function did, as we cannot residualize a call | 7932 // Bail out if the inline function did, as we cannot residualize a call |
| 7934 // instead. | 7933 // instead, but do not disable optimization for the outer function. |
| 7935 TraceInline(target, caller, "inline graph construction failed"); | 7934 TraceInline(target, caller, "inline graph construction failed"); |
| 7936 target_shared->DisableOptimization(kInliningBailedOut); | 7935 target_shared->DisableOptimization(kInliningBailedOut); |
| 7937 inline_bailout_ = true; | 7936 current_info()->RetryOptimization(kInliningBailedOut); |
| 7938 delete target_state; | 7937 delete target_state; |
| 7939 return true; | 7938 return true; |
| 7940 } | 7939 } |
| 7941 | 7940 |
| 7942 // Update inlined nodes count. | 7941 // Update inlined nodes count. |
| 7943 inlined_count_ += nodes_added; | 7942 inlined_count_ += nodes_added; |
| 7944 | 7943 |
| 7945 Handle<Code> unoptimized_code(target_shared->code()); | 7944 Handle<Code> unoptimized_code(target_shared->code()); |
| 7946 DCHECK(unoptimized_code->kind() == Code::FUNCTION); | 7945 DCHECK(unoptimized_code->kind() == Code::FUNCTION); |
| 7947 Handle<TypeFeedbackInfo> type_info( | 7946 Handle<TypeFeedbackInfo> type_info( |
| (...skipping 4570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12518 if (ShouldProduceTraceOutput()) { | 12517 if (ShouldProduceTraceOutput()) { |
| 12519 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12518 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12520 } | 12519 } |
| 12521 | 12520 |
| 12522 #ifdef DEBUG | 12521 #ifdef DEBUG |
| 12523 graph_->Verify(false); // No full verify. | 12522 graph_->Verify(false); // No full verify. |
| 12524 #endif | 12523 #endif |
| 12525 } | 12524 } |
| 12526 | 12525 |
| 12527 } } // namespace v8::internal | 12526 } } // namespace v8::internal |
| OLD | NEW |