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

Side by Side Diff: src/hydrogen.cc

Issue 7206040: Remove redundant hydrogen- and lithium instruction for symbol comparison. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 months 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 | « src/hydrogen.h ('k') | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5230 ASSERT(has_side_effects); // Stores always have side effects. 5230 ASSERT(has_side_effects); // Stores always have side effects.
5231 AddSimulate(expr->AssignmentId()); 5231 AddSimulate(expr->AssignmentId());
5232 } 5232 }
5233 } 5233 }
5234 5234
5235 Drop(returns_original_input ? 2 : 1); 5235 Drop(returns_original_input ? 2 : 1);
5236 ast_context()->ReturnValue(expr->is_postfix() ? input : after); 5236 ast_context()->ReturnValue(expr->is_postfix() ? input : after);
5237 } 5237 }
5238 5238
5239 5239
5240 HCompareSymbolEq* HGraphBuilder::BuildSymbolCompare(HValue* left, 5240 HCompareObjectEq* HGraphBuilder::BuildSymbolCompare(HValue* left,
5241 HValue* right, 5241 HValue* right) {
5242 Token::Value op) {
5243 ASSERT(op == Token::EQ || op == Token::EQ_STRICT);
5244 AddInstruction(new(zone()) HCheckNonSmi(left)); 5242 AddInstruction(new(zone()) HCheckNonSmi(left));
5245 AddInstruction(HCheckInstanceType::NewIsSymbol(left)); 5243 AddInstruction(HCheckInstanceType::NewIsSymbol(left));
5246 AddInstruction(new(zone()) HCheckNonSmi(right)); 5244 AddInstruction(new(zone()) HCheckNonSmi(right));
5247 AddInstruction(HCheckInstanceType::NewIsSymbol(right)); 5245 AddInstruction(HCheckInstanceType::NewIsSymbol(right));
5248 return new(zone()) HCompareSymbolEq(left, right, op); 5246 return new(zone()) HCompareObjectEq(left, right);
5249 } 5247 }
5250 5248
5251 5249
5252 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string, 5250 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string,
5253 HValue* index) { 5251 HValue* index) {
5254 AddInstruction(new(zone()) HCheckNonSmi(string)); 5252 AddInstruction(new(zone()) HCheckNonSmi(string));
5255 AddInstruction(HCheckInstanceType::NewIsString(string)); 5253 AddInstruction(HCheckInstanceType::NewIsString(string));
5256 HStringLength* length = new(zone()) HStringLength(string); 5254 HStringLength* length = new(zone()) HStringLength(string);
5257 AddInstruction(length); 5255 AddInstruction(length);
5258 HInstruction* checked_index = 5256 HInstruction* checked_index =
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
5587 } else if (op == Token::IN) { 5585 } else if (op == Token::IN) {
5588 instr = new(zone()) HIn(left, right); 5586 instr = new(zone()) HIn(left, right);
5589 } else if (type_info.IsNonPrimitive()) { 5587 } else if (type_info.IsNonPrimitive()) {
5590 switch (op) { 5588 switch (op) {
5591 case Token::EQ: 5589 case Token::EQ:
5592 case Token::EQ_STRICT: { 5590 case Token::EQ_STRICT: {
5593 AddInstruction(new(zone()) HCheckNonSmi(left)); 5591 AddInstruction(new(zone()) HCheckNonSmi(left));
5594 AddInstruction(HCheckInstanceType::NewIsSpecObject(left)); 5592 AddInstruction(HCheckInstanceType::NewIsSpecObject(left));
5595 AddInstruction(new(zone()) HCheckNonSmi(right)); 5593 AddInstruction(new(zone()) HCheckNonSmi(right));
5596 AddInstruction(HCheckInstanceType::NewIsSpecObject(right)); 5594 AddInstruction(HCheckInstanceType::NewIsSpecObject(right));
5597 instr = new(zone()) HCompareJSObjectEq(left, right); 5595 instr = new(zone()) HCompareObjectEq(left, right);
5598 break; 5596 break;
5599 } 5597 }
5600 default: 5598 default:
5601 return Bailout("Unsupported non-primitive compare"); 5599 return Bailout("Unsupported non-primitive compare");
5602 break; 5600 break;
5603 } 5601 }
5604 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) && 5602 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) &&
5605 (op == Token::EQ || op == Token::EQ_STRICT)) { 5603 (op == Token::EQ || op == Token::EQ_STRICT)) {
5606 instr = BuildSymbolCompare(left, right, op); 5604 instr = BuildSymbolCompare(left, right);
William Hesse 2011/06/21 10:41:19 Why is this factored out into a separate function,
5607 } else { 5605 } else {
5608 HCompare* compare = new(zone()) HCompare(left, right, op); 5606 HCompare* compare = new(zone()) HCompare(left, right, op);
5609 Representation r = ToRepresentation(type_info); 5607 Representation r = ToRepresentation(type_info);
5610 compare->SetInputRepresentation(r); 5608 compare->SetInputRepresentation(r);
5611 instr = compare; 5609 instr = compare;
5612 } 5610 }
5613 instr->set_position(expr->position()); 5611 instr->set_position(expr->position());
5614 ast_context()->ReturnInstruction(instr, expr->id()); 5612 ast_context()->ReturnInstruction(instr, expr->id());
5615 } 5613 }
5616 5614
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
5842 } 5840 }
5843 5841
5844 5842
5845 // Fast support for object equality testing. 5843 // Fast support for object equality testing.
5846 void HGraphBuilder::GenerateObjectEquals(CallRuntime* call) { 5844 void HGraphBuilder::GenerateObjectEquals(CallRuntime* call) {
5847 ASSERT(call->arguments()->length() == 2); 5845 ASSERT(call->arguments()->length() == 2);
5848 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 5846 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
5849 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); 5847 CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
5850 HValue* right = Pop(); 5848 HValue* right = Pop();
5851 HValue* left = Pop(); 5849 HValue* left = Pop();
5852 HCompareJSObjectEq* result = new(zone()) HCompareJSObjectEq(left, right); 5850 HCompareObjectEq* result = new(zone()) HCompareObjectEq(left, right);
5853 ast_context()->ReturnInstruction(result, call->id()); 5851 ast_context()->ReturnInstruction(result, call->id());
5854 } 5852 }
5855 5853
5856 5854
5857 void HGraphBuilder::GenerateLog(CallRuntime* call) { 5855 void HGraphBuilder::GenerateLog(CallRuntime* call) {
5858 // %_Log is ignored in optimized code. 5856 // %_Log is ignored in optimized code.
5859 ast_context()->ReturnValue(graph()->GetConstantUndefined()); 5857 ast_context()->ReturnValue(graph()->GetConstantUndefined());
5860 } 5858 }
5861 5859
5862 5860
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
6574 } 6572 }
6575 } 6573 }
6576 6574
6577 #ifdef DEBUG 6575 #ifdef DEBUG
6578 if (graph_ != NULL) graph_->Verify(); 6576 if (graph_ != NULL) graph_->Verify();
6579 if (allocator_ != NULL) allocator_->Verify(); 6577 if (allocator_ != NULL) allocator_->Verify();
6580 #endif 6578 #endif
6581 } 6579 }
6582 6580
6583 } } // namespace v8::internal 6581 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698