Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: src/hydrogen.cc

Issue 63343003: Revert "Improvements in positions handling in optimizing compiler." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8609 matching lines...) Expand 10 before | Expand all | Expand 10 after
8620 set_current_block(join_block); 8620 set_current_block(join_block);
8621 // We did not materialize any value in the predecessor environments, 8621 // We did not materialize any value in the predecessor environments,
8622 // so there is no need to handle it here. 8622 // so there is no need to handle it here.
8623 } 8623 }
8624 } 8624 }
8625 8625
8626 8626
8627 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { 8627 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
8628 CHECK_ALIVE(VisitForValue(expr->left())); 8628 CHECK_ALIVE(VisitForValue(expr->left()));
8629 CHECK_ALIVE(VisitForValue(expr->right())); 8629 CHECK_ALIVE(VisitForValue(expr->right()));
8630 SetSourcePosition(expr->position()); 8630 if (!FLAG_emit_opt_code_positions) SetSourcePosition(expr->position());
8631 HValue* right = Pop(); 8631 HValue* right = Pop();
8632 HValue* left = Pop(); 8632 HValue* left = Pop();
8633 HInstruction* instr = BuildBinaryOperation(expr, left, right); 8633 HInstruction* instr = BuildBinaryOperation(expr, left, right);
8634 if (FLAG_emit_opt_code_positions && instr->IsBinaryOperation()) {
8635 HBinaryOperation::cast(instr)->SetOperandPositions(
8636 zone(), expr->left()->position(), expr->right()->position());
8637 }
8638 return ast_context()->ReturnInstruction(instr, expr->id()); 8634 return ast_context()->ReturnInstruction(instr, expr->id());
8639 } 8635 }
8640 8636
8641 8637
8642 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, 8638 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
8643 Expression* sub_expr, 8639 Expression* sub_expr,
8644 Handle<String> check) { 8640 Handle<String> check) {
8645 CHECK_ALIVE(VisitForTypeOf(sub_expr)); 8641 CHECK_ALIVE(VisitForTypeOf(sub_expr));
8646 SetSourcePosition(expr->position()); 8642 if (!FLAG_emit_opt_code_positions) SetSourcePosition(expr->position());
8647 HValue* value = Pop(); 8643 HValue* value = Pop();
8648 HTypeofIsAndBranch* instr = New<HTypeofIsAndBranch>(value, check); 8644 HTypeofIsAndBranch* instr = New<HTypeofIsAndBranch>(value, check);
8649 return ast_context()->ReturnControl(instr, expr->id()); 8645 return ast_context()->ReturnControl(instr, expr->id());
8650 } 8646 }
8651 8647
8652 8648
8653 static bool IsLiteralCompareBool(Isolate* isolate, 8649 static bool IsLiteralCompareBool(Isolate* isolate,
8654 HValue* left, 8650 HValue* left,
8655 Token::Value op, 8651 Token::Value op,
8656 HValue* right) { 8652 HValue* right) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
8698 Handle<Type> left_type = expr->left()->bounds().lower; 8694 Handle<Type> left_type = expr->left()->bounds().lower;
8699 Handle<Type> right_type = expr->right()->bounds().lower; 8695 Handle<Type> right_type = expr->right()->bounds().lower;
8700 Handle<Type> combined_type = expr->combined_type(); 8696 Handle<Type> combined_type = expr->combined_type();
8701 Representation combined_rep = Representation::FromType(combined_type); 8697 Representation combined_rep = Representation::FromType(combined_type);
8702 Representation left_rep = Representation::FromType(left_type); 8698 Representation left_rep = Representation::FromType(left_type);
8703 Representation right_rep = Representation::FromType(right_type); 8699 Representation right_rep = Representation::FromType(right_type);
8704 8700
8705 CHECK_ALIVE(VisitForValue(expr->left())); 8701 CHECK_ALIVE(VisitForValue(expr->left()));
8706 CHECK_ALIVE(VisitForValue(expr->right())); 8702 CHECK_ALIVE(VisitForValue(expr->right()));
8707 8703
8708 if (FLAG_emit_opt_code_positions) SetSourcePosition(expr->position());
8709
8710 HValue* right = Pop(); 8704 HValue* right = Pop();
8711 HValue* left = Pop(); 8705 HValue* left = Pop();
8712 Token::Value op = expr->op(); 8706 Token::Value op = expr->op();
8713 8707
8714 if (IsLiteralCompareBool(isolate(), left, op, right)) { 8708 if (IsLiteralCompareBool(isolate(), left, op, right)) {
8715 HCompareObjectEqAndBranch* result = 8709 HCompareObjectEqAndBranch* result =
8716 New<HCompareObjectEqAndBranch>(left, right); 8710 New<HCompareObjectEqAndBranch>(left, right);
8717 return ast_context()->ReturnControl(result, expr->id()); 8711 return ast_context()->ReturnControl(result, expr->id());
8718 } 8712 }
8719 8713
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
8778 switch (op) { 8772 switch (op) {
8779 case Token::EQ: 8773 case Token::EQ:
8780 case Token::EQ_STRICT: { 8774 case Token::EQ_STRICT: {
8781 // Can we get away with map check and not instance type check? 8775 // Can we get away with map check and not instance type check?
8782 if (combined_type->IsClass()) { 8776 if (combined_type->IsClass()) {
8783 Handle<Map> map = combined_type->AsClass(); 8777 Handle<Map> map = combined_type->AsClass();
8784 AddCheckMap(left, map); 8778 AddCheckMap(left, map);
8785 AddCheckMap(right, map); 8779 AddCheckMap(right, map);
8786 HCompareObjectEqAndBranch* result = 8780 HCompareObjectEqAndBranch* result =
8787 New<HCompareObjectEqAndBranch>(left, right); 8781 New<HCompareObjectEqAndBranch>(left, right);
8788 if (FLAG_emit_opt_code_positions) {
8789 result->set_operand_position(zone(), 0, expr->left()->position());
8790 result->set_operand_position(zone(), 1, expr->right()->position());
8791 }
8792 return ast_context()->ReturnControl(result, expr->id()); 8782 return ast_context()->ReturnControl(result, expr->id());
8793 } else { 8783 } else {
8794 BuildCheckHeapObject(left); 8784 BuildCheckHeapObject(left);
8795 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_SPEC_OBJECT); 8785 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_SPEC_OBJECT);
8796 BuildCheckHeapObject(right); 8786 BuildCheckHeapObject(right);
8797 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_SPEC_OBJECT); 8787 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_SPEC_OBJECT);
8798 HCompareObjectEqAndBranch* result = 8788 HCompareObjectEqAndBranch* result =
8799 New<HCompareObjectEqAndBranch>(left, right); 8789 New<HCompareObjectEqAndBranch>(left, right);
8800 return ast_context()->ReturnControl(result, expr->id()); 8790 return ast_context()->ReturnControl(result, expr->id());
8801 } 8791 }
(...skipping 21 matching lines...) Expand all
8823 } else { 8813 } else {
8824 if (combined_rep.IsTagged() || combined_rep.IsNone()) { 8814 if (combined_rep.IsTagged() || combined_rep.IsNone()) {
8825 HCompareGeneric* result = New<HCompareGeneric>(left, right, op); 8815 HCompareGeneric* result = New<HCompareGeneric>(left, right, op);
8826 result->set_observed_input_representation(1, left_rep); 8816 result->set_observed_input_representation(1, left_rep);
8827 result->set_observed_input_representation(2, right_rep); 8817 result->set_observed_input_representation(2, right_rep);
8828 return ast_context()->ReturnInstruction(result, expr->id()); 8818 return ast_context()->ReturnInstruction(result, expr->id());
8829 } else { 8819 } else {
8830 HCompareNumericAndBranch* result = 8820 HCompareNumericAndBranch* result =
8831 New<HCompareNumericAndBranch>(left, right, op); 8821 New<HCompareNumericAndBranch>(left, right, op);
8832 result->set_observed_input_representation(left_rep, right_rep); 8822 result->set_observed_input_representation(left_rep, right_rep);
8833 if (FLAG_emit_opt_code_positions) {
8834 result->SetOperandPositions(zone(),
8835 expr->left()->position(),
8836 expr->right()->position());
8837 }
8838 return ast_context()->ReturnControl(result, expr->id()); 8823 return ast_context()->ReturnControl(result, expr->id());
8839 } 8824 }
8840 } 8825 }
8841 } 8826 }
8842 8827
8843 8828
8844 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, 8829 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
8845 Expression* sub_expr, 8830 Expression* sub_expr,
8846 NilValue nil) { 8831 NilValue nil) {
8847 ASSERT(!HasStackOverflow()); 8832 ASSERT(!HasStackOverflow());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
10144 trace_.Add(" "); 10129 trace_.Add(" ");
10145 phi->PrintTo(&trace_); 10130 phi->PrintTo(&trace_);
10146 trace_.Add("\n"); 10131 trace_.Add("\n");
10147 } 10132 }
10148 } 10133 }
10149 10134
10150 { 10135 {
10151 Tag HIR_tag(this, "HIR"); 10136 Tag HIR_tag(this, "HIR");
10152 for (HInstructionIterator it(current); !it.Done(); it.Advance()) { 10137 for (HInstructionIterator it(current); !it.Done(); it.Advance()) {
10153 HInstruction* instruction = it.Current(); 10138 HInstruction* instruction = it.Current();
10154 int bci = FLAG_emit_opt_code_positions && instruction->has_position() ? 10139 int bci = 0;
10155 instruction->position() : 0;
10156 int uses = instruction->UseCount(); 10140 int uses = instruction->UseCount();
10157 PrintIndent(); 10141 PrintIndent();
10158 trace_.Add("%d %d ", bci, uses); 10142 trace_.Add("%d %d ", bci, uses);
10159 instruction->PrintNameTo(&trace_); 10143 instruction->PrintNameTo(&trace_);
10160 trace_.Add(" "); 10144 trace_.Add(" ");
10161 instruction->PrintTo(&trace_); 10145 instruction->PrintTo(&trace_);
10162 trace_.Add(" <|@\n"); 10146 trace_.Add(" <|@\n");
10163 } 10147 }
10164 } 10148 }
10165 10149
10166 10150
10167 if (chunk != NULL) { 10151 if (chunk != NULL) {
10168 Tag LIR_tag(this, "LIR"); 10152 Tag LIR_tag(this, "LIR");
10169 int first_index = current->first_instruction_index(); 10153 int first_index = current->first_instruction_index();
10170 int last_index = current->last_instruction_index(); 10154 int last_index = current->last_instruction_index();
10171 if (first_index != -1 && last_index != -1) { 10155 if (first_index != -1 && last_index != -1) {
10172 const ZoneList<LInstruction*>* instructions = chunk->instructions(); 10156 const ZoneList<LInstruction*>* instructions = chunk->instructions();
10173 for (int i = first_index; i <= last_index; ++i) { 10157 for (int i = first_index; i <= last_index; ++i) {
10174 LInstruction* linstr = instructions->at(i); 10158 LInstruction* linstr = instructions->at(i);
10175 if (linstr != NULL) { 10159 if (linstr != NULL) {
10176 PrintIndent(); 10160 PrintIndent();
10177 trace_.Add("%d ", 10161 trace_.Add("%d ",
10178 LifetimePosition::FromInstructionIndex(i).Value()); 10162 LifetimePosition::FromInstructionIndex(i).Value());
10179 linstr->PrintTo(&trace_); 10163 linstr->PrintTo(&trace_);
10180 trace_.Add(" [hir:");
10181 linstr->hydrogen_value()->PrintNameTo(&trace_);
10182 trace_.Add("]");
10183 trace_.Add(" <|@\n"); 10164 trace_.Add(" <|@\n");
10184 } 10165 }
10185 } 10166 }
10186 } 10167 }
10187 } 10168 }
10188 } 10169 }
10189 } 10170 }
10190 10171
10191 10172
10192 void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) { 10173 void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
10351 if (ShouldProduceTraceOutput()) { 10332 if (ShouldProduceTraceOutput()) {
10352 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10333 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10353 } 10334 }
10354 10335
10355 #ifdef DEBUG 10336 #ifdef DEBUG
10356 graph_->Verify(false); // No full verify. 10337 graph_->Verify(false); // No full verify.
10357 #endif 10338 #endif
10358 } 10339 }
10359 10340
10360 } } // namespace v8::internal 10341 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698