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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3338 ast_context_(NULL), | 3338 ast_context_(NULL), |
3339 break_scope_(NULL), | 3339 break_scope_(NULL), |
3340 inlined_count_(0), | 3340 inlined_count_(0), |
3341 globals_(10, info->zone()), | 3341 globals_(10, info->zone()), |
3342 osr_(new(info->zone()) HOsrBuilder(this)) { | 3342 osr_(new(info->zone()) HOsrBuilder(this)) { |
3343 // This is not initialized in the initializer list because the | 3343 // This is not initialized in the initializer list because the |
3344 // constructor for the initial state relies on function_state_ == NULL | 3344 // constructor for the initial state relies on function_state_ == NULL |
3345 // to know it's the initial state. | 3345 // to know it's the initial state. |
3346 function_state_ = &initial_function_state_; | 3346 function_state_ = &initial_function_state_; |
3347 InitializeAstVisitor(info->isolate(), info->zone()); | 3347 InitializeAstVisitor(info->isolate(), info->zone()); |
3348 if (FLAG_hydrogen_track_positions) { | 3348 if (top_info()->is_tracking_positions()) { |
3349 SetSourcePosition(info->shared_info()->start_position()); | 3349 SetSourcePosition(info->shared_info()->start_position()); |
3350 } | 3350 } |
3351 } | 3351 } |
3352 | 3352 |
3353 | 3353 |
3354 HBasicBlock* HOptimizedGraphBuilder::CreateJoin(HBasicBlock* first, | 3354 HBasicBlock* HOptimizedGraphBuilder::CreateJoin(HBasicBlock* first, |
3355 HBasicBlock* second, | 3355 HBasicBlock* second, |
3356 BailoutId join_id) { | 3356 BailoutId join_id) { |
3357 if (first == NULL) { | 3357 if (first == NULL) { |
3358 return second; | 3358 return second; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 type_change_checksum_(0), | 3443 type_change_checksum_(0), |
3444 maximum_environment_size_(0), | 3444 maximum_environment_size_(0), |
3445 no_side_effects_scope_count_(0), | 3445 no_side_effects_scope_count_(0), |
3446 disallow_adding_new_values_(false) { | 3446 disallow_adding_new_values_(false) { |
3447 if (info->IsStub()) { | 3447 if (info->IsStub()) { |
3448 CallInterfaceDescriptor descriptor = | 3448 CallInterfaceDescriptor descriptor = |
3449 info->code_stub()->GetCallInterfaceDescriptor(); | 3449 info->code_stub()->GetCallInterfaceDescriptor(); |
3450 start_environment_ = new (zone_) | 3450 start_environment_ = new (zone_) |
3451 HEnvironment(zone_, descriptor.GetEnvironmentParameterCount()); | 3451 HEnvironment(zone_, descriptor.GetEnvironmentParameterCount()); |
3452 } else { | 3452 } else { |
3453 if (FLAG_hydrogen_track_positions) { | 3453 if (info->is_tracking_positions()) { |
3454 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), | 3454 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), |
3455 InlinedFunctionInfo::kNoParentId); | 3455 InlinedFunctionInfo::kNoParentId); |
3456 } | 3456 } |
3457 start_environment_ = | 3457 start_environment_ = |
3458 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 3458 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
3459 } | 3459 } |
3460 start_environment_->set_ast_id(BailoutId::FunctionEntry()); | 3460 start_environment_->set_ast_id(BailoutId::FunctionEntry()); |
3461 entry_block_ = CreateBasicBlock(); | 3461 entry_block_ = CreateBasicBlock(); |
3462 entry_block_->SetInitialEnvironment(start_environment_); | 3462 entry_block_->SetInitialEnvironment(start_environment_); |
3463 } | 3463 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3904 function_return_ = owner->graph()->CreateBasicBlock(); | 3904 function_return_ = owner->graph()->CreateBasicBlock(); |
3905 function_return()->MarkAsInlineReturnTarget(owner->current_block()); | 3905 function_return()->MarkAsInlineReturnTarget(owner->current_block()); |
3906 } | 3906 } |
3907 // Set this after possibly allocating a new TestContext above. | 3907 // Set this after possibly allocating a new TestContext above. |
3908 call_context_ = owner->ast_context(); | 3908 call_context_ = owner->ast_context(); |
3909 } | 3909 } |
3910 | 3910 |
3911 // Push on the state stack. | 3911 // Push on the state stack. |
3912 owner->set_function_state(this); | 3912 owner->set_function_state(this); |
3913 | 3913 |
3914 if (FLAG_hydrogen_track_positions) { | 3914 if (compilation_info_->is_tracking_positions()) { |
3915 outer_source_position_ = owner->source_position(); | 3915 outer_source_position_ = owner->source_position(); |
3916 owner->EnterInlinedSource( | 3916 owner->EnterInlinedSource( |
3917 info->shared_info()->start_position(), | 3917 info->shared_info()->start_position(), |
3918 inlining_id); | 3918 inlining_id); |
3919 owner->SetSourcePosition(info->shared_info()->start_position()); | 3919 owner->SetSourcePosition(info->shared_info()->start_position()); |
3920 } | 3920 } |
3921 } | 3921 } |
3922 | 3922 |
3923 | 3923 |
3924 FunctionState::~FunctionState() { | 3924 FunctionState::~FunctionState() { |
3925 delete test_context_; | 3925 delete test_context_; |
3926 owner_->set_function_state(outer_); | 3926 owner_->set_function_state(outer_); |
3927 | 3927 |
3928 if (FLAG_hydrogen_track_positions) { | 3928 if (compilation_info_->is_tracking_positions()) { |
3929 owner_->set_source_position(outer_source_position_); | 3929 owner_->set_source_position(outer_source_position_); |
3930 owner_->EnterInlinedSource( | 3930 owner_->EnterInlinedSource( |
3931 outer_->compilation_info()->shared_info()->start_position(), | 3931 outer_->compilation_info()->shared_info()->start_position(), |
3932 outer_->inlining_id()); | 3932 outer_->inlining_id()); |
3933 } | 3933 } |
3934 } | 3934 } |
3935 | 3935 |
3936 | 3936 |
3937 // Implementation of utility classes to represent an expression's context in | 3937 // Implementation of utility classes to represent an expression's context in |
3938 // the AST. | 3938 // the AST. |
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6798 DCHECK(current_block()->HasPredecessor()); | 6798 DCHECK(current_block()->HasPredecessor()); |
6799 if (!ast_context()->IsEffect()) { | 6799 if (!ast_context()->IsEffect()) { |
6800 // The parser turns invalid left-hand sides in assignments into throw | 6800 // The parser turns invalid left-hand sides in assignments into throw |
6801 // statements, which may not be in effect contexts. We might still try | 6801 // statements, which may not be in effect contexts. We might still try |
6802 // to optimize such functions; bail out now if we do. | 6802 // to optimize such functions; bail out now if we do. |
6803 return Bailout(kInvalidLeftHandSideInAssignment); | 6803 return Bailout(kInvalidLeftHandSideInAssignment); |
6804 } | 6804 } |
6805 CHECK_ALIVE(VisitForValue(expr->exception())); | 6805 CHECK_ALIVE(VisitForValue(expr->exception())); |
6806 | 6806 |
6807 HValue* value = environment()->Pop(); | 6807 HValue* value = environment()->Pop(); |
6808 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 6808 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
6809 Add<HPushArguments>(value); | 6809 Add<HPushArguments>(value); |
6810 Add<HCallRuntime>(isolate()->factory()->empty_string(), | 6810 Add<HCallRuntime>(isolate()->factory()->empty_string(), |
6811 Runtime::FunctionForId(Runtime::kThrow), 1); | 6811 Runtime::FunctionForId(Runtime::kThrow), 1); |
6812 Add<HSimulate>(expr->id()); | 6812 Add<HSimulate>(expr->id()); |
6813 | 6813 |
6814 // If the throw definitely exits the function, we can finish with a dummy | 6814 // If the throw definitely exits the function, we can finish with a dummy |
6815 // control flow at this point. This is not the case if the throw is inside | 6815 // control flow at this point. This is not the case if the throw is inside |
6816 // an inlined function which may be replaced. | 6816 // an inlined function which may be replaced. |
6817 if (call_context() == NULL) { | 6817 if (call_context() == NULL) { |
6818 FinishExitCurrentBlock(New<HAbnormalExit>()); | 6818 FinishExitCurrentBlock(New<HAbnormalExit>()); |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7922 } | 7922 } |
7923 | 7923 |
7924 // ---------------------------------------------------------------- | 7924 // ---------------------------------------------------------------- |
7925 // After this point, we've made a decision to inline this function (so | 7925 // After this point, we've made a decision to inline this function (so |
7926 // TryInline should always return true). | 7926 // TryInline should always return true). |
7927 | 7927 |
7928 // Type-check the inlined function. | 7928 // Type-check the inlined function. |
7929 DCHECK(target_shared->has_deoptimization_support()); | 7929 DCHECK(target_shared->has_deoptimization_support()); |
7930 AstTyper::Run(&target_info); | 7930 AstTyper::Run(&target_info); |
7931 | 7931 |
7932 int function_id = 0; | 7932 int inlining_id = 0; |
7933 if (FLAG_hydrogen_track_positions) { | 7933 if (top_info()->is_tracking_positions()) { |
7934 function_id = top_info()->TraceInlinedFunction( | 7934 inlining_id = top_info()->TraceInlinedFunction( |
7935 target_shared, source_position(), function_state()->inlining_id()); | 7935 target_shared, source_position(), function_state()->inlining_id()); |
7936 } | 7936 } |
7937 | 7937 |
7938 // Save the pending call context. Set up new one for the inlined function. | 7938 // Save the pending call context. Set up new one for the inlined function. |
7939 // The function state is new-allocated because we need to delete it | 7939 // The function state is new-allocated because we need to delete it |
7940 // in two different places. | 7940 // in two different places. |
7941 FunctionState* target_state = new FunctionState( | 7941 FunctionState* target_state = |
7942 this, &target_info, inlining_kind, function_id); | 7942 new FunctionState(this, &target_info, inlining_kind, inlining_id); |
7943 | 7943 |
7944 HConstant* undefined = graph()->GetConstantUndefined(); | 7944 HConstant* undefined = graph()->GetConstantUndefined(); |
7945 | 7945 |
7946 HEnvironment* inner_env = | 7946 HEnvironment* inner_env = |
7947 environment()->CopyForInlining(target, | 7947 environment()->CopyForInlining(target, |
7948 arguments_count, | 7948 arguments_count, |
7949 function, | 7949 function, |
7950 undefined, | 7950 undefined, |
7951 function_state()->inlining_kind()); | 7951 function_state()->inlining_kind()); |
7952 | 7952 |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9421 TraceInline(target, caller, NULL); | 9421 TraceInline(target, caller, NULL); |
9422 } | 9422 } |
9423 return inline_ok; | 9423 return inline_ok; |
9424 } | 9424 } |
9425 | 9425 |
9426 | 9426 |
9427 void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { | 9427 void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { |
9428 DCHECK(!HasStackOverflow()); | 9428 DCHECK(!HasStackOverflow()); |
9429 DCHECK(current_block() != NULL); | 9429 DCHECK(current_block() != NULL); |
9430 DCHECK(current_block()->HasPredecessor()); | 9430 DCHECK(current_block()->HasPredecessor()); |
9431 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 9431 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
9432 int argument_count = expr->arguments()->length() + 1; // Plus constructor. | 9432 int argument_count = expr->arguments()->length() + 1; // Plus constructor. |
9433 Factory* factory = isolate()->factory(); | 9433 Factory* factory = isolate()->factory(); |
9434 | 9434 |
9435 // The constructor function is on the stack in the unoptimized code | 9435 // The constructor function is on the stack in the unoptimized code |
9436 // during evaluation of the arguments. | 9436 // during evaluation of the arguments. |
9437 CHECK_ALIVE(VisitForValue(expr->expression())); | 9437 CHECK_ALIVE(VisitForValue(expr->expression())); |
9438 HValue* function = Top(); | 9438 HValue* function = Top(); |
9439 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 9439 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
9440 | 9440 |
9441 if (FLAG_inline_construct && | 9441 if (FLAG_inline_construct && |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10100 if (key != NULL) Push(key); | 10100 if (key != NULL) Push(key); |
10101 Push(value); | 10101 Push(value); |
10102 BuildStore(expr, prop, ast_id, return_id); | 10102 BuildStore(expr, prop, ast_id, return_id); |
10103 } | 10103 } |
10104 | 10104 |
10105 | 10105 |
10106 void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) { | 10106 void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) { |
10107 DCHECK(!HasStackOverflow()); | 10107 DCHECK(!HasStackOverflow()); |
10108 DCHECK(current_block() != NULL); | 10108 DCHECK(current_block() != NULL); |
10109 DCHECK(current_block()->HasPredecessor()); | 10109 DCHECK(current_block()->HasPredecessor()); |
10110 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 10110 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
10111 Expression* target = expr->expression(); | 10111 Expression* target = expr->expression(); |
10112 VariableProxy* proxy = target->AsVariableProxy(); | 10112 VariableProxy* proxy = target->AsVariableProxy(); |
10113 Property* prop = target->AsProperty(); | 10113 Property* prop = target->AsProperty(); |
10114 if (proxy == NULL && prop == NULL) { | 10114 if (proxy == NULL && prop == NULL) { |
10115 return Bailout(kInvalidLhsInCountOperation); | 10115 return Bailout(kInvalidLhsInCountOperation); |
10116 } | 10116 } |
10117 | 10117 |
10118 // Match the full code generator stack by simulating an extra stack | 10118 // Match the full code generator stack by simulating an extra stack |
10119 // element for postfix operations in a non-effect context. The return | 10119 // element for postfix operations in a non-effect context. The return |
10120 // value is ToNumber(input). | 10120 // value is ToNumber(input). |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10756 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { | 10756 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { |
10757 CHECK_ALIVE(VisitForValue(expr->left())); | 10757 CHECK_ALIVE(VisitForValue(expr->left())); |
10758 CHECK_ALIVE(VisitForValue(expr->right())); | 10758 CHECK_ALIVE(VisitForValue(expr->right())); |
10759 SetSourcePosition(expr->position()); | 10759 SetSourcePosition(expr->position()); |
10760 HValue* right = Pop(); | 10760 HValue* right = Pop(); |
10761 HValue* left = Pop(); | 10761 HValue* left = Pop(); |
10762 HValue* result = | 10762 HValue* result = |
10763 BuildBinaryOperation(expr, left, right, | 10763 BuildBinaryOperation(expr, left, right, |
10764 ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE | 10764 ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE |
10765 : PUSH_BEFORE_SIMULATE); | 10765 : PUSH_BEFORE_SIMULATE); |
10766 if (FLAG_hydrogen_track_positions && result->IsBinaryOperation()) { | 10766 if (top_info()->is_tracking_positions() && result->IsBinaryOperation()) { |
10767 HBinaryOperation::cast(result)->SetOperandPositions( | 10767 HBinaryOperation::cast(result)->SetOperandPositions( |
10768 zone(), | 10768 zone(), |
10769 ScriptPositionToSourcePosition(expr->left()->position()), | 10769 ScriptPositionToSourcePosition(expr->left()->position()), |
10770 ScriptPositionToSourcePosition(expr->right()->position())); | 10770 ScriptPositionToSourcePosition(expr->right()->position())); |
10771 } | 10771 } |
10772 return ast_context()->ReturnValue(result); | 10772 return ast_context()->ReturnValue(result); |
10773 } | 10773 } |
10774 | 10774 |
10775 | 10775 |
10776 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, | 10776 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, |
(...skipping 17 matching lines...) Expand all Loading... |
10794 (right->IsConstant() && | 10794 (right->IsConstant() && |
10795 HConstant::cast(right)->handle(isolate)->IsBoolean())); | 10795 HConstant::cast(right)->handle(isolate)->IsBoolean())); |
10796 } | 10796 } |
10797 | 10797 |
10798 | 10798 |
10799 void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) { | 10799 void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) { |
10800 DCHECK(!HasStackOverflow()); | 10800 DCHECK(!HasStackOverflow()); |
10801 DCHECK(current_block() != NULL); | 10801 DCHECK(current_block() != NULL); |
10802 DCHECK(current_block()->HasPredecessor()); | 10802 DCHECK(current_block()->HasPredecessor()); |
10803 | 10803 |
10804 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 10804 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
10805 | 10805 |
10806 // Check for a few fast cases. The AST visiting behavior must be in sync | 10806 // Check for a few fast cases. The AST visiting behavior must be in sync |
10807 // with the full codegen: We don't push both left and right values onto | 10807 // with the full codegen: We don't push both left and right values onto |
10808 // the expression stack when one side is a special-case literal. | 10808 // the expression stack when one side is a special-case literal. |
10809 Expression* sub_expr = NULL; | 10809 Expression* sub_expr = NULL; |
10810 Handle<String> check; | 10810 Handle<String> check; |
10811 if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) { | 10811 if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) { |
10812 return HandleLiteralCompareTypeof(expr, sub_expr, check); | 10812 return HandleLiteralCompareTypeof(expr, sub_expr, check); |
10813 } | 10813 } |
10814 if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) { | 10814 if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10936 return New<HBranch>(graph()->GetConstantTrue()); | 10936 return New<HBranch>(graph()->GetConstantTrue()); |
10937 } | 10937 } |
10938 // Can we get away with map check and not instance type check? | 10938 // Can we get away with map check and not instance type check? |
10939 HValue* operand_to_check = | 10939 HValue* operand_to_check = |
10940 left->block()->block_id() < right->block()->block_id() ? left : right; | 10940 left->block()->block_id() < right->block()->block_id() ? left : right; |
10941 if (combined_type->IsClass()) { | 10941 if (combined_type->IsClass()) { |
10942 Handle<Map> map = combined_type->AsClass()->Map(); | 10942 Handle<Map> map = combined_type->AsClass()->Map(); |
10943 AddCheckMap(operand_to_check, map); | 10943 AddCheckMap(operand_to_check, map); |
10944 HCompareObjectEqAndBranch* result = | 10944 HCompareObjectEqAndBranch* result = |
10945 New<HCompareObjectEqAndBranch>(left, right); | 10945 New<HCompareObjectEqAndBranch>(left, right); |
10946 if (FLAG_hydrogen_track_positions) { | 10946 if (top_info()->is_tracking_positions()) { |
10947 result->set_operand_position(zone(), 0, left_position); | 10947 result->set_operand_position(zone(), 0, left_position); |
10948 result->set_operand_position(zone(), 1, right_position); | 10948 result->set_operand_position(zone(), 1, right_position); |
10949 } | 10949 } |
10950 return result; | 10950 return result; |
10951 } else { | 10951 } else { |
10952 BuildCheckHeapObject(operand_to_check); | 10952 BuildCheckHeapObject(operand_to_check); |
10953 Add<HCheckInstanceType>(operand_to_check, | 10953 Add<HCheckInstanceType>(operand_to_check, |
10954 HCheckInstanceType::IS_SPEC_OBJECT); | 10954 HCheckInstanceType::IS_SPEC_OBJECT); |
10955 HCompareObjectEqAndBranch* result = | 10955 HCompareObjectEqAndBranch* result = |
10956 New<HCompareObjectEqAndBranch>(left, right); | 10956 New<HCompareObjectEqAndBranch>(left, right); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11002 AddSimulate(bailout_id, REMOVABLE_SIMULATE); | 11002 AddSimulate(bailout_id, REMOVABLE_SIMULATE); |
11003 } | 11003 } |
11004 } | 11004 } |
11005 // TODO(jkummerow): Can we make this more efficient? | 11005 // TODO(jkummerow): Can we make this more efficient? |
11006 HBranch* branch = New<HBranch>(result); | 11006 HBranch* branch = New<HBranch>(result); |
11007 return branch; | 11007 return branch; |
11008 } else { | 11008 } else { |
11009 HCompareNumericAndBranch* result = | 11009 HCompareNumericAndBranch* result = |
11010 New<HCompareNumericAndBranch>(left, right, op); | 11010 New<HCompareNumericAndBranch>(left, right, op); |
11011 result->set_observed_input_representation(left_rep, right_rep); | 11011 result->set_observed_input_representation(left_rep, right_rep); |
11012 if (FLAG_hydrogen_track_positions) { | 11012 if (top_info()->is_tracking_positions()) { |
11013 result->SetOperandPositions(zone(), left_position, right_position); | 11013 result->SetOperandPositions(zone(), left_position, right_position); |
11014 } | 11014 } |
11015 return result; | 11015 return result; |
11016 } | 11016 } |
11017 } | 11017 } |
11018 } | 11018 } |
11019 | 11019 |
11020 | 11020 |
11021 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, | 11021 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, |
11022 Expression* sub_expr, | 11022 Expression* sub_expr, |
11023 NilValue nil) { | 11023 NilValue nil) { |
11024 DCHECK(!HasStackOverflow()); | 11024 DCHECK(!HasStackOverflow()); |
11025 DCHECK(current_block() != NULL); | 11025 DCHECK(current_block() != NULL); |
11026 DCHECK(current_block()->HasPredecessor()); | 11026 DCHECK(current_block()->HasPredecessor()); |
11027 DCHECK(expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT); | 11027 DCHECK(expr->op() == Token::EQ || expr->op() == Token::EQ_STRICT); |
11028 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 11028 if (!top_info()->is_tracking_positions()) SetSourcePosition(expr->position()); |
11029 CHECK_ALIVE(VisitForValue(sub_expr)); | 11029 CHECK_ALIVE(VisitForValue(sub_expr)); |
11030 HValue* value = Pop(); | 11030 HValue* value = Pop(); |
11031 if (expr->op() == Token::EQ_STRICT) { | 11031 if (expr->op() == Token::EQ_STRICT) { |
11032 HConstant* nil_constant = nil == kNullValue | 11032 HConstant* nil_constant = nil == kNullValue |
11033 ? graph()->GetConstantNull() | 11033 ? graph()->GetConstantNull() |
11034 : graph()->GetConstantUndefined(); | 11034 : graph()->GetConstantUndefined(); |
11035 HCompareObjectEqAndBranch* instr = | 11035 HCompareObjectEqAndBranch* instr = |
11036 New<HCompareObjectEqAndBranch>(value, nil_constant); | 11036 New<HCompareObjectEqAndBranch>(value, nil_constant); |
11037 return ast_context()->ReturnControl(instr, expr->id()); | 11037 return ast_context()->ReturnControl(instr, expr->id()); |
11038 } else { | 11038 } else { |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13179 } | 13179 } |
13180 | 13180 |
13181 { | 13181 { |
13182 Tag HIR_tag(this, "HIR"); | 13182 Tag HIR_tag(this, "HIR"); |
13183 for (HInstructionIterator it(current); !it.Done(); it.Advance()) { | 13183 for (HInstructionIterator it(current); !it.Done(); it.Advance()) { |
13184 HInstruction* instruction = it.Current(); | 13184 HInstruction* instruction = it.Current(); |
13185 int uses = instruction->UseCount(); | 13185 int uses = instruction->UseCount(); |
13186 PrintIndent(); | 13186 PrintIndent(); |
13187 std::ostringstream os; | 13187 std::ostringstream os; |
13188 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction; | 13188 os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction; |
13189 if (FLAG_hydrogen_track_positions && | 13189 if (graph->info()->is_tracking_positions() && |
13190 instruction->has_position() && | 13190 instruction->has_position() && instruction->position().raw() != 0) { |
13191 instruction->position().raw() != 0) { | |
13192 const SourcePosition pos = instruction->position(); | 13191 const SourcePosition pos = instruction->position(); |
13193 os << " pos:"; | 13192 os << " pos:"; |
13194 if (pos.inlining_id() != 0) os << pos.inlining_id() << "_"; | 13193 if (pos.inlining_id() != 0) os << pos.inlining_id() << "_"; |
13195 os << pos.position(); | 13194 os << pos.position(); |
13196 } | 13195 } |
13197 os << " <|@\n"; | 13196 os << " <|@\n"; |
13198 trace_.Add(os.str().c_str()); | 13197 trace_.Add(os.str().c_str()); |
13199 } | 13198 } |
13200 } | 13199 } |
13201 | 13200 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13390 if (ShouldProduceTraceOutput()) { | 13389 if (ShouldProduceTraceOutput()) { |
13391 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13390 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13392 } | 13391 } |
13393 | 13392 |
13394 #ifdef DEBUG | 13393 #ifdef DEBUG |
13395 graph_->Verify(false); // No full verify. | 13394 graph_->Verify(false); // No full verify. |
13396 #endif | 13395 #endif |
13397 } | 13396 } |
13398 | 13397 |
13399 } } // namespace v8::internal | 13398 } } // namespace v8::internal |
OLD | NEW |