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

Side by Side Diff: src/hydrogen.cc

Issue 7000021: Support symbol comparison in crankshaft. (Closed)
Patch Set: Review fixes Created 9 years, 7 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
« 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 4816 matching lines...) Expand 10 before | Expand all | Expand 10 after
4827 4827
4828 ast_context()->ReturnValue(expr->is_postfix() ? before : after); 4828 ast_context()->ReturnValue(expr->is_postfix() ? before : after);
4829 } 4829 }
4830 4830
4831 } else { 4831 } else {
4832 return Bailout("invalid lhs in count operation"); 4832 return Bailout("invalid lhs in count operation");
4833 } 4833 }
4834 } 4834 }
4835 4835
4836 4836
4837 HCompareSymbolEq* HGraphBuilder::BuildSymbolCompare(HValue* left,
4838 HValue* right,
4839 Token::Value op) {
4840 ASSERT(op == Token::EQ || op == Token::EQ_STRICT);
4841 AddInstruction(new(zone()) HCheckNonSmi(left));
4842 AddInstruction(HCheckInstanceType::NewIsSymbol(left));
4843 AddInstruction(new(zone()) HCheckNonSmi(right));
4844 AddInstruction(HCheckInstanceType::NewIsSymbol(right));
4845 return new(zone()) HCompareSymbolEq(left, right, op);
4846 }
4847
4848
4837 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string, 4849 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string,
4838 HValue* index) { 4850 HValue* index) {
4839 AddInstruction(new(zone()) HCheckNonSmi(string)); 4851 AddInstruction(new(zone()) HCheckNonSmi(string));
4840 AddInstruction(HCheckInstanceType::NewIsString(string)); 4852 AddInstruction(HCheckInstanceType::NewIsString(string));
4841 HStringLength* length = new(zone()) HStringLength(string); 4853 HStringLength* length = new(zone()) HStringLength(string);
4842 AddInstruction(length); 4854 AddInstruction(length);
4843 AddInstruction(new(zone()) HBoundsCheck(index, length)); 4855 AddInstruction(new(zone()) HBoundsCheck(index, length));
4844 return new(zone()) HStringCharCodeAt(string, index); 4856 return new(zone()) HStringCharCodeAt(string, index);
4845 } 4857 }
4846 4858
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
5146 AddInstruction(HCheckInstanceType::NewIsJSObjectOrJSFunction(left)); 5158 AddInstruction(HCheckInstanceType::NewIsJSObjectOrJSFunction(left));
5147 AddInstruction(new(zone()) HCheckNonSmi(right)); 5159 AddInstruction(new(zone()) HCheckNonSmi(right));
5148 AddInstruction(HCheckInstanceType::NewIsJSObjectOrJSFunction(right)); 5160 AddInstruction(HCheckInstanceType::NewIsJSObjectOrJSFunction(right));
5149 instr = new(zone()) HCompareJSObjectEq(left, right); 5161 instr = new(zone()) HCompareJSObjectEq(left, right);
5150 break; 5162 break;
5151 } 5163 }
5152 default: 5164 default:
5153 return Bailout("Unsupported non-primitive compare"); 5165 return Bailout("Unsupported non-primitive compare");
5154 break; 5166 break;
5155 } 5167 }
5168 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) &&
5169 (op == Token::EQ || op == Token::EQ_STRICT)) {
5170 instr = BuildSymbolCompare(left, right, op);
5156 } else { 5171 } else {
5157 HCompare* compare = new(zone()) HCompare(left, right, op); 5172 HCompare* compare = new(zone()) HCompare(left, right, op);
5158 Representation r = ToRepresentation(type_info); 5173 Representation r = ToRepresentation(type_info);
5159 compare->SetInputRepresentation(r); 5174 compare->SetInputRepresentation(r);
5160 instr = compare; 5175 instr = compare;
5161 } 5176 }
5162 instr->set_position(expr->position()); 5177 instr->set_position(expr->position());
5163 ast_context()->ReturnInstruction(instr, expr->id()); 5178 ast_context()->ReturnInstruction(instr, expr->id());
5164 } 5179 }
5165 5180
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
6101 } 6116 }
6102 } 6117 }
6103 6118
6104 #ifdef DEBUG 6119 #ifdef DEBUG
6105 if (graph_ != NULL) graph_->Verify(); 6120 if (graph_ != NULL) graph_->Verify();
6106 if (allocator_ != NULL) allocator_->Verify(); 6121 if (allocator_ != NULL) allocator_->Verify();
6107 #endif 6122 #endif
6108 } 6123 }
6109 6124
6110 } } // namespace v8::internal 6125 } } // 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