Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 merge_block_(NULL) { | 687 merge_block_(NULL) { |
| 688 continuation->Continue(&first_true_block_, | 688 continuation->Continue(&first_true_block_, |
| 689 &first_false_block_, | 689 &first_false_block_, |
| 690 &position_); | 690 &position_); |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 HInstruction* HGraphBuilder::IfBuilder::IfCompare( | 694 HInstruction* HGraphBuilder::IfBuilder::IfCompare( |
| 695 HValue* left, | 695 HValue* left, |
| 696 HValue* right, | 696 HValue* right, |
| 697 Token::Value token, | 697 Token::Value token) { |
| 698 Representation input_representation) { | |
| 699 HCompareIDAndBranch* compare = | 698 HCompareIDAndBranch* compare = |
| 700 new(zone()) HCompareIDAndBranch(left, right, token); | 699 new(zone()) HCompareIDAndBranch(left, right, token); |
| 701 compare->set_observed_input_representation(input_representation, | |
| 702 input_representation); | |
| 703 compare->AssumeRepresentation(input_representation); | |
| 704 AddCompare(compare); | 700 AddCompare(compare); |
| 705 return compare; | 701 return compare; |
| 706 } | 702 } |
| 707 | 703 |
| 708 | 704 |
| 709 HInstruction* HGraphBuilder::IfBuilder::IfCompareMap(HValue* left, | 705 HInstruction* HGraphBuilder::IfBuilder::IfCompareMap(HValue* left, |
| 710 Handle<Map> map) { | 706 Handle<Map> map) { |
| 711 HCompareMap* compare = | 707 HCompareMap* compare = |
| 712 new(zone()) HCompareMap(left, map, | 708 new(zone()) HCompareMap(left, map, |
| 713 first_true_block_, first_false_block_); | 709 first_true_block_, first_false_block_); |
| (...skipping 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3465 for (int i = 0; i < blocks_.length(); ++i) { | 3461 for (int i = 0; i < blocks_.length(); ++i) { |
| 3466 for (HInstruction* current = blocks_[i]->first(); | 3462 for (HInstruction* current = blocks_[i]->first(); |
| 3467 current != NULL; | 3463 current != NULL; |
| 3468 current = current->next()) { | 3464 current = current->next()) { |
| 3469 if (current->IsChange()) { | 3465 if (current->IsChange()) { |
| 3470 HChange* change = HChange::cast(current); | 3466 HChange* change = HChange::cast(current); |
| 3471 // Propagate flags for negative zero checks upwards from conversions | 3467 // Propagate flags for negative zero checks upwards from conversions |
| 3472 // int32-to-tagged and int32-to-double. | 3468 // int32-to-tagged and int32-to-double. |
| 3473 Representation from = change->value()->representation(); | 3469 Representation from = change->value()->representation(); |
| 3474 ASSERT(from.Equals(change->from())); | 3470 ASSERT(from.Equals(change->from())); |
| 3475 if (from.IsInteger32()) { | 3471 if (from.IsSmiOrInteger32()) { |
| 3476 ASSERT(change->to().IsTagged() || | 3472 ASSERT(change->to().IsTagged() || |
| 3477 change->to().IsDouble() || | 3473 change->to().IsDouble() || |
| 3478 change->to().IsSmi()); | 3474 (change->to().IsSmiOrInteger32() && |
| 3475 !from.Equals(change->to()))); | |
|
danno
2013/06/06 12:32:13
Why did you add the Equals() clause? This should a
| |
| 3479 ASSERT(visited.IsEmpty()); | 3476 ASSERT(visited.IsEmpty()); |
| 3480 PropagateMinusZeroChecks(change->value(), &visited); | 3477 PropagateMinusZeroChecks(change->value(), &visited); |
| 3481 visited.Clear(); | 3478 visited.Clear(); |
| 3482 } | 3479 } |
| 3483 } | 3480 } |
| 3484 } | 3481 } |
| 3485 } | 3482 } |
| 3486 } | 3483 } |
| 3487 | 3484 |
| 3488 | 3485 |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4976 // account for invisible uses. | 4973 // account for invisible uses. |
| 4977 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | 4974 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); |
| 4978 set_current_block(NULL); | 4975 set_current_block(NULL); |
| 4979 break; | 4976 break; |
| 4980 } | 4977 } |
| 4981 | 4978 |
| 4982 HCompareIDAndBranch* compare_ = | 4979 HCompareIDAndBranch* compare_ = |
| 4983 new(zone()) HCompareIDAndBranch(tag_value, | 4980 new(zone()) HCompareIDAndBranch(tag_value, |
| 4984 label_value, | 4981 label_value, |
| 4985 Token::EQ_STRICT); | 4982 Token::EQ_STRICT); |
| 4986 compare_->set_observed_input_representation( | |
| 4987 Representation::Integer32(), Representation::Integer32()); | |
| 4988 compare = compare_; | 4983 compare = compare_; |
| 4989 } else { | 4984 } else { |
| 4990 compare = new(zone()) HStringCompareAndBranch(context, tag_value, | 4985 compare = new(zone()) HStringCompareAndBranch(context, tag_value, |
| 4991 label_value, | 4986 label_value, |
| 4992 Token::EQ_STRICT); | 4987 Token::EQ_STRICT); |
| 4993 } | 4988 } |
| 4994 | 4989 |
| 4995 compare->SetSuccessorAt(0, body_block); | 4990 compare->SetSuccessorAt(0, body_block); |
| 4996 compare->SetSuccessorAt(1, next_test_block); | 4991 compare->SetSuccessorAt(1, next_test_block); |
| 4997 current_block()->Finish(compare); | 4992 current_block()->Finish(compare); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5341 current_block()->Goto(loop_entry); | 5336 current_block()->Goto(loop_entry); |
| 5342 set_current_block(loop_entry); | 5337 set_current_block(loop_entry); |
| 5343 if (osr_entry) graph()->set_osr_loop_entry(loop_entry); | 5338 if (osr_entry) graph()->set_osr_loop_entry(loop_entry); |
| 5344 | 5339 |
| 5345 HValue* index = environment()->ExpressionStackAt(0); | 5340 HValue* index = environment()->ExpressionStackAt(0); |
| 5346 HValue* limit = environment()->ExpressionStackAt(1); | 5341 HValue* limit = environment()->ExpressionStackAt(1); |
| 5347 | 5342 |
| 5348 // Check that we still have more keys. | 5343 // Check that we still have more keys. |
| 5349 HCompareIDAndBranch* compare_index = | 5344 HCompareIDAndBranch* compare_index = |
| 5350 new(zone()) HCompareIDAndBranch(index, limit, Token::LT); | 5345 new(zone()) HCompareIDAndBranch(index, limit, Token::LT); |
| 5351 compare_index->set_observed_input_representation( | |
| 5352 Representation::Integer32(), Representation::Integer32()); | |
| 5353 | 5346 |
| 5354 HBasicBlock* loop_body = graph()->CreateBasicBlock(); | 5347 HBasicBlock* loop_body = graph()->CreateBasicBlock(); |
| 5355 HBasicBlock* loop_successor = graph()->CreateBasicBlock(); | 5348 HBasicBlock* loop_successor = graph()->CreateBasicBlock(); |
| 5356 | 5349 |
| 5357 compare_index->SetSuccessorAt(0, loop_body); | 5350 compare_index->SetSuccessorAt(0, loop_body); |
| 5358 compare_index->SetSuccessorAt(1, loop_successor); | 5351 compare_index->SetSuccessorAt(1, loop_successor); |
| 5359 current_block()->Finish(compare_index); | 5352 current_block()->Finish(compare_index); |
| 5360 | 5353 |
| 5361 set_current_block(loop_successor); | 5354 set_current_block(loop_successor); |
| 5362 Drop(5); | 5355 Drop(5); |
| (...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9080 if (join != NULL) return ast_context()->ReturnValue(Pop()); | 9073 if (join != NULL) return ast_context()->ReturnValue(Pop()); |
| 9081 } | 9074 } |
| 9082 | 9075 |
| 9083 | 9076 |
| 9084 HInstruction* HOptimizedGraphBuilder::BuildIncrement( | 9077 HInstruction* HOptimizedGraphBuilder::BuildIncrement( |
| 9085 bool returns_original_input, | 9078 bool returns_original_input, |
| 9086 CountOperation* expr) { | 9079 CountOperation* expr) { |
| 9087 // The input to the count operation is on top of the expression stack. | 9080 // The input to the count operation is on top of the expression stack. |
| 9088 TypeInfo info = expr->type(); | 9081 TypeInfo info = expr->type(); |
| 9089 Representation rep = ToRepresentation(info); | 9082 Representation rep = ToRepresentation(info); |
| 9090 if (rep.IsTagged()) { | 9083 |
| 9091 rep = Representation::Integer32(); | 9084 // TODO(verwaest): Explicitly turn off smi for now. Try to turn back on later. |
| 9092 } | 9085 if (rep.IsSmiOrTagged()) rep = Representation::Integer32(); |
| 9093 | 9086 |
| 9094 if (returns_original_input) { | 9087 if (returns_original_input) { |
| 9095 // We need an explicit HValue representing ToNumber(input). The | 9088 // We need an explicit HValue representing ToNumber(input). The |
| 9096 // actual HChange instruction we need is (sometimes) added in a later | 9089 // actual HChange instruction we need is (sometimes) added in a later |
| 9097 // phase, so it is not available now to be used as an input to HAdd and | 9090 // phase, so it is not available now to be used as an input to HAdd and |
| 9098 // as the return value. | 9091 // as the return value. |
| 9099 HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep); | 9092 HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep); |
| 9100 AddInstruction(number_input); | 9093 AddInstruction(number_input); |
| 9101 Push(number_input); | 9094 Push(number_input); |
| 9102 } | 9095 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9620 HValue* right = Pop(); | 9613 HValue* right = Pop(); |
| 9621 HValue* left = Pop(); | 9614 HValue* left = Pop(); |
| 9622 HInstruction* instr = BuildBinaryOperation(expr, left, right); | 9615 HInstruction* instr = BuildBinaryOperation(expr, left, right); |
| 9623 instr->set_position(expr->position()); | 9616 instr->set_position(expr->position()); |
| 9624 return ast_context()->ReturnInstruction(instr, expr->id()); | 9617 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 9625 } | 9618 } |
| 9626 | 9619 |
| 9627 | 9620 |
| 9628 Representation HOptimizedGraphBuilder::ToRepresentation(TypeInfo info) { | 9621 Representation HOptimizedGraphBuilder::ToRepresentation(TypeInfo info) { |
| 9629 if (info.IsUninitialized()) return Representation::None(); | 9622 if (info.IsUninitialized()) return Representation::None(); |
| 9630 if (info.IsSmi()) return Representation::Integer32(); | 9623 if (info.IsSmi()) return Representation::Smi(); |
| 9631 if (info.IsInteger32()) return Representation::Integer32(); | 9624 if (info.IsInteger32()) return Representation::Integer32(); |
| 9632 if (info.IsDouble()) return Representation::Double(); | 9625 if (info.IsDouble()) return Representation::Double(); |
| 9633 if (info.IsNumber()) return Representation::Double(); | 9626 if (info.IsNumber()) return Representation::Double(); |
| 9634 return Representation::Tagged(); | 9627 return Representation::Tagged(); |
| 9635 } | 9628 } |
| 9636 | 9629 |
| 9637 | 9630 |
| 9638 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, | 9631 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, |
| 9639 HTypeof* typeof_expr, | 9632 HTypeof* typeof_expr, |
| 9640 Handle<String> check) { | 9633 Handle<String> check) { |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11545 } | 11538 } |
| 11546 } | 11539 } |
| 11547 | 11540 |
| 11548 #ifdef DEBUG | 11541 #ifdef DEBUG |
| 11549 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11542 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11550 if (allocator_ != NULL) allocator_->Verify(); | 11543 if (allocator_ != NULL) allocator_->Verify(); |
| 11551 #endif | 11544 #endif |
| 11552 } | 11545 } |
| 11553 | 11546 |
| 11554 } } // namespace v8::internal | 11547 } } // namespace v8::internal |
| OLD | NEW |