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

Side by Side Diff: src/hydrogen.cc

Issue 6964011: Refactor HCheckInstanceType to allow mask/tag tests. (Closed)
Patch Set: Rebased 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/arm/lithium-codegen-arm.cc ('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 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 expr->RecordTypeFeedback(oracle()); 3789 expr->RecordTypeFeedback(oracle());
3790 3790
3791 if (TryArgumentsAccess(expr)) return; 3791 if (TryArgumentsAccess(expr)) return;
3792 3792
3793 CHECK_ALIVE(VisitForValue(expr->obj())); 3793 CHECK_ALIVE(VisitForValue(expr->obj()));
3794 3794
3795 HInstruction* instr = NULL; 3795 HInstruction* instr = NULL;
3796 if (expr->IsArrayLength()) { 3796 if (expr->IsArrayLength()) {
3797 HValue* array = Pop(); 3797 HValue* array = Pop();
3798 AddInstruction(new(zone()) HCheckNonSmi(array)); 3798 AddInstruction(new(zone()) HCheckNonSmi(array));
3799 AddInstruction(new(zone()) HCheckInstanceType(array, 3799 AddInstruction(HCheckInstanceType::NewIsJSArray(array));
3800 JS_ARRAY_TYPE,
3801 JS_ARRAY_TYPE));
3802 instr = new(zone()) HJSArrayLength(array); 3800 instr = new(zone()) HJSArrayLength(array);
3803 3801
3804 } else if (expr->IsStringLength()) { 3802 } else if (expr->IsStringLength()) {
3805 HValue* string = Pop(); 3803 HValue* string = Pop();
3806 AddInstruction(new(zone()) HCheckNonSmi(string)); 3804 AddInstruction(new(zone()) HCheckNonSmi(string));
3807 AddInstruction(new(zone()) HCheckInstanceType(string, 3805 AddInstruction(HCheckInstanceType::NewIsString(string));
3808 FIRST_STRING_TYPE,
3809 LAST_STRING_TYPE));
3810 instr = new(zone()) HStringLength(string); 3806 instr = new(zone()) HStringLength(string);
3811 } else if (expr->IsStringAccess()) { 3807 } else if (expr->IsStringAccess()) {
3812 CHECK_ALIVE(VisitForValue(expr->key())); 3808 CHECK_ALIVE(VisitForValue(expr->key()));
3813 HValue* index = Pop(); 3809 HValue* index = Pop();
3814 HValue* string = Pop(); 3810 HValue* string = Pop();
3815 HStringCharCodeAt* char_code = BuildStringCharCodeAt(string, index); 3811 HStringCharCodeAt* char_code = BuildStringCharCodeAt(string, index);
3816 AddInstruction(char_code); 3812 AddInstruction(char_code);
3817 instr = new(zone()) HStringCharFromCode(char_code); 3813 instr = new(zone()) HStringCharFromCode(char_code);
3818 3814
3819 } else if (expr->IsFunctionPrototype()) { 3815 } else if (expr->IsFunctionPrototype()) {
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
4846 4842
4847 } else { 4843 } else {
4848 return Bailout("invalid lhs in count operation"); 4844 return Bailout("invalid lhs in count operation");
4849 } 4845 }
4850 } 4846 }
4851 4847
4852 4848
4853 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string, 4849 HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string,
4854 HValue* index) { 4850 HValue* index) {
4855 AddInstruction(new(zone()) HCheckNonSmi(string)); 4851 AddInstruction(new(zone()) HCheckNonSmi(string));
4856 AddInstruction(new(zone()) HCheckInstanceType( 4852 AddInstruction(HCheckInstanceType::NewIsString(string));
4857 string, FIRST_STRING_TYPE, LAST_STRING_TYPE));
4858 HStringLength* length = new(zone()) HStringLength(string); 4853 HStringLength* length = new(zone()) HStringLength(string);
4859 AddInstruction(length); 4854 AddInstruction(length);
4860 AddInstruction(new(zone()) HBoundsCheck(index, length)); 4855 AddInstruction(new(zone()) HBoundsCheck(index, length));
4861 return new(zone()) HStringCharCodeAt(string, index); 4856 return new(zone()) HStringCharCodeAt(string, index);
4862 } 4857 }
4863 4858
4864 4859
4865 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, 4860 HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr,
4866 HValue* left, 4861 HValue* left,
4867 HValue* right) { 4862 HValue* right) {
(...skipping 19 matching lines...) Expand all
4887 return instr; 4882 return instr;
4888 } 4883 }
4889 4884
4890 4885
4891 HInstruction* HGraphBuilder::BuildBinaryOperation( 4886 HInstruction* HGraphBuilder::BuildBinaryOperation(
4892 Token::Value op, HValue* left, HValue* right, TypeInfo info) { 4887 Token::Value op, HValue* left, HValue* right, TypeInfo info) {
4893 switch (op) { 4888 switch (op) {
4894 case Token::ADD: 4889 case Token::ADD:
4895 if (info.IsString()) { 4890 if (info.IsString()) {
4896 AddInstruction(new(zone()) HCheckNonSmi(left)); 4891 AddInstruction(new(zone()) HCheckNonSmi(left));
4897 AddInstruction(new(zone()) HCheckInstanceType(left, FIRST_STRING_TYPE, 4892 AddInstruction(HCheckInstanceType::NewIsString(left));
4898 LAST_STRING_TYPE));
4899 AddInstruction(new(zone()) HCheckNonSmi(right)); 4893 AddInstruction(new(zone()) HCheckNonSmi(right));
4900 AddInstruction(new(zone()) HCheckInstanceType(right, FIRST_STRING_TYPE, 4894 AddInstruction(HCheckInstanceType::NewIsString(right));
4901 LAST_STRING_TYPE));
4902 return new(zone()) HStringAdd(left, right); 4895 return new(zone()) HStringAdd(left, right);
4903 } else { 4896 } else {
4904 return new(zone()) HAdd(left, right); 4897 return new(zone()) HAdd(left, right);
4905 } 4898 }
4906 case Token::SUB: return new(zone()) HSub(left, right); 4899 case Token::SUB: return new(zone()) HSub(left, right);
4907 case Token::MUL: return new(zone()) HMul(left, right); 4900 case Token::MUL: return new(zone()) HMul(left, right);
4908 case Token::MOD: return new(zone()) HMod(left, right); 4901 case Token::MOD: return new(zone()) HMod(left, right);
4909 case Token::DIV: return new(zone()) HDiv(left, right); 4902 case Token::DIV: return new(zone()) HDiv(left, right);
4910 case Token::BIT_XOR: return new(zone()) HBitXor(left, right); 4903 case Token::BIT_XOR: return new(zone()) HBitXor(left, right);
4911 case Token::BIT_AND: return new(zone()) HBitAnd(left, right); 4904 case Token::BIT_AND: return new(zone()) HBitAnd(left, right);
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6125 } 6118 }
6126 } 6119 }
6127 6120
6128 #ifdef DEBUG 6121 #ifdef DEBUG
6129 if (graph_ != NULL) graph_->Verify(); 6122 if (graph_ != NULL) graph_->Verify();
6130 if (allocator_ != NULL) allocator_->Verify(); 6123 if (allocator_ != NULL) allocator_->Verify();
6131 #endif 6124 #endif
6132 } 6125 }
6133 6126
6134 } } // namespace v8::internal 6127 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698