| 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 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 : new(zone) Range(); | 2851 : new(zone) Range(); |
| 2852 result->Shl(c->Integer32Value()); | 2852 result->Shl(c->Integer32Value()); |
| 2853 return result; | 2853 return result; |
| 2854 } | 2854 } |
| 2855 } | 2855 } |
| 2856 return HValue::InferRange(zone); | 2856 return HValue::InferRange(zone); |
| 2857 } | 2857 } |
| 2858 | 2858 |
| 2859 | 2859 |
| 2860 Range* HLoadNamedField::InferRange(Zone* zone) { | 2860 Range* HLoadNamedField::InferRange(Zone* zone) { |
| 2861 if (access().representation().IsByte()) { | 2861 if (access().representation().IsInteger8()) { |
| 2862 return new(zone) Range(0, 255); | 2862 return new(zone) Range(kMinInt8, kMaxInt8); |
| 2863 } |
| 2864 if (access().representation().IsUInteger8()) { |
| 2865 return new(zone) Range(kMinUInt8, kMaxUInt8); |
| 2866 } |
| 2867 if (access().representation().IsInteger16()) { |
| 2868 return new(zone) Range(kMinInt16, kMaxInt16); |
| 2869 } |
| 2870 if (access().representation().IsUInteger16()) { |
| 2871 return new(zone) Range(kMinUInt16, kMaxUInt16); |
| 2863 } | 2872 } |
| 2864 if (access().IsStringLength()) { | 2873 if (access().IsStringLength()) { |
| 2865 return new(zone) Range(0, String::kMaxLength); | 2874 return new(zone) Range(0, String::kMaxLength); |
| 2866 } | 2875 } |
| 2867 return HValue::InferRange(zone); | 2876 return HValue::InferRange(zone); |
| 2868 } | 2877 } |
| 2869 | 2878 |
| 2870 | 2879 |
| 2871 Range* HLoadKeyed::InferRange(Zone* zone) { | 2880 Range* HLoadKeyed::InferRange(Zone* zone) { |
| 2872 switch (elements_kind()) { | 2881 switch (elements_kind()) { |
| 2882 case EXTERNAL_BYTE_ELEMENTS: |
| 2883 return new(zone) Range(kMinInt8, kMaxInt8); |
| 2884 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 2873 case EXTERNAL_PIXEL_ELEMENTS: | 2885 case EXTERNAL_PIXEL_ELEMENTS: |
| 2874 return new(zone) Range(0, 255); | 2886 return new(zone) Range(kMinUInt8, kMaxUInt8); |
| 2875 case EXTERNAL_BYTE_ELEMENTS: | |
| 2876 return new(zone) Range(-128, 127); | |
| 2877 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | |
| 2878 return new(zone) Range(0, 255); | |
| 2879 case EXTERNAL_SHORT_ELEMENTS: | 2887 case EXTERNAL_SHORT_ELEMENTS: |
| 2880 return new(zone) Range(-32768, 32767); | 2888 return new(zone) Range(kMinInt16, kMaxInt16); |
| 2881 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2889 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 2882 return new(zone) Range(0, 65535); | 2890 return new(zone) Range(kMinUInt16, kMaxUInt16); |
| 2883 default: | 2891 default: |
| 2884 return HValue::InferRange(zone); | 2892 return HValue::InferRange(zone); |
| 2885 } | 2893 } |
| 2886 } | 2894 } |
| 2887 | 2895 |
| 2888 | 2896 |
| 2889 void HCompareGeneric::PrintDataTo(StringStream* stream) { | 2897 void HCompareGeneric::PrintDataTo(StringStream* stream) { |
| 2890 stream->Add(Token::Name(token())); | 2898 stream->Add(Token::Name(token())); |
| 2891 stream->Add(" "); | 2899 stream->Add(" "); |
| 2892 HBinaryOperation::PrintDataTo(stream); | 2900 HBinaryOperation::PrintDataTo(stream); |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 if ((right_val == 0) && (left_val < 0)) { | 3994 if ((right_val == 0) && (left_val < 0)) { |
| 3987 return H_CONSTANT_DOUBLE(static_cast<uint32_t>(left_val)); | 3995 return H_CONSTANT_DOUBLE(static_cast<uint32_t>(left_val)); |
| 3988 } | 3996 } |
| 3989 return H_CONSTANT_INT(static_cast<uint32_t>(left_val) >> right_val); | 3997 return H_CONSTANT_INT(static_cast<uint32_t>(left_val) >> right_val); |
| 3990 } | 3998 } |
| 3991 } | 3999 } |
| 3992 return new(zone) HShr(context, left, right); | 4000 return new(zone) HShr(context, left, right); |
| 3993 } | 4001 } |
| 3994 | 4002 |
| 3995 | 4003 |
| 4004 HInstruction* HSeqStringGetChar::New(Zone* zone, |
| 4005 HValue* context, |
| 4006 String::Encoding encoding, |
| 4007 HValue* string, |
| 4008 HValue* index) { |
| 4009 if (FLAG_fold_constants && string->IsConstant() && index->IsConstant()) { |
| 4010 HConstant* c_string = HConstant::cast(string); |
| 4011 HConstant* c_index = HConstant::cast(index); |
| 4012 if (c_string->HasStringValue() && c_index->HasInteger32Value()) { |
| 4013 Handle<String> s = c_string->StringValue(); |
| 4014 int32_t i = c_index->Integer32Value(); |
| 4015 ASSERT_LE(0, i); |
| 4016 ASSERT_LT(i, s->length()); |
| 4017 return H_CONSTANT_INT(s->Get(i)); |
| 4018 } |
| 4019 } |
| 4020 return new(zone) HSeqStringGetChar(encoding, string, index); |
| 4021 } |
| 4022 |
| 4023 |
| 3996 #undef H_CONSTANT_INT | 4024 #undef H_CONSTANT_INT |
| 3997 #undef H_CONSTANT_DOUBLE | 4025 #undef H_CONSTANT_DOUBLE |
| 3998 | 4026 |
| 3999 | 4027 |
| 4000 void HBitwise::PrintDataTo(StringStream* stream) { | 4028 void HBitwise::PrintDataTo(StringStream* stream) { |
| 4001 stream->Add(Token::Name(op_)); | 4029 stream->Add(Token::Name(op_)); |
| 4002 stream->Add(" "); | 4030 stream->Add(" "); |
| 4003 HBitwiseBinaryOperation::PrintDataTo(stream); | 4031 HBitwiseBinaryOperation::PrintDataTo(stream); |
| 4004 } | 4032 } |
| 4005 | 4033 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4300 break; | 4328 break; |
| 4301 case kExternalMemory: | 4329 case kExternalMemory: |
| 4302 stream->Add("[external-memory]"); | 4330 stream->Add("[external-memory]"); |
| 4303 break; | 4331 break; |
| 4304 } | 4332 } |
| 4305 | 4333 |
| 4306 stream->Add("@%d", offset()); | 4334 stream->Add("@%d", offset()); |
| 4307 } | 4335 } |
| 4308 | 4336 |
| 4309 } } // namespace v8::internal | 4337 } } // namespace v8::internal |
| OLD | NEW |