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 3973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3984 if ((right_val == 0) && (left_val < 0)) { | 3984 if ((right_val == 0) && (left_val < 0)) { |
3985 return H_CONSTANT_DOUBLE(static_cast<uint32_t>(left_val)); | 3985 return H_CONSTANT_DOUBLE(static_cast<uint32_t>(left_val)); |
3986 } | 3986 } |
3987 return H_CONSTANT_INT(static_cast<uint32_t>(left_val) >> right_val); | 3987 return H_CONSTANT_INT(static_cast<uint32_t>(left_val) >> right_val); |
3988 } | 3988 } |
3989 } | 3989 } |
3990 return new(zone) HShr(context, left, right); | 3990 return new(zone) HShr(context, left, right); |
3991 } | 3991 } |
3992 | 3992 |
3993 | 3993 |
| 3994 HInstruction* HSeqStringGetChar::New(Zone* zone, |
| 3995 HValue* context, |
| 3996 String::Encoding encoding, |
| 3997 HValue* string, |
| 3998 HValue* index) { |
| 3999 if (FLAG_fold_constants && string->IsConstant() && index->IsConstant()) { |
| 4000 HConstant* c_string = HConstant::cast(string); |
| 4001 HConstant* c_index = HConstant::cast(index); |
| 4002 if (c_string->HasStringValue() && c_index->HasInteger32Value()) { |
| 4003 Handle<String> s = c_string->StringValue(); |
| 4004 int32_t i = c_index->Integer32Value(); |
| 4005 ASSERT_LE(0, i); |
| 4006 ASSERT_LT(i, s->length()); |
| 4007 return H_CONSTANT_INT(s->Get(i)); |
| 4008 } |
| 4009 } |
| 4010 return new(zone) HSeqStringGetChar(encoding, string, index); |
| 4011 } |
| 4012 |
| 4013 |
3994 #undef H_CONSTANT_INT | 4014 #undef H_CONSTANT_INT |
3995 #undef H_CONSTANT_DOUBLE | 4015 #undef H_CONSTANT_DOUBLE |
3996 | 4016 |
3997 | 4017 |
3998 void HBitwise::PrintDataTo(StringStream* stream) { | 4018 void HBitwise::PrintDataTo(StringStream* stream) { |
3999 stream->Add(Token::Name(op_)); | 4019 stream->Add(Token::Name(op_)); |
4000 stream->Add(" "); | 4020 stream->Add(" "); |
4001 HBitwiseBinaryOperation::PrintDataTo(stream); | 4021 HBitwiseBinaryOperation::PrintDataTo(stream); |
4002 } | 4022 } |
4003 | 4023 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 break; | 4318 break; |
4299 case kExternalMemory: | 4319 case kExternalMemory: |
4300 stream->Add("[external-memory]"); | 4320 stream->Add("[external-memory]"); |
4301 break; | 4321 break; |
4302 } | 4322 } |
4303 | 4323 |
4304 stream->Add("@%d", offset()); | 4324 stream->Add("@%d", offset()); |
4305 } | 4325 } |
4306 | 4326 |
4307 } } // namespace v8::internal | 4327 } } // namespace v8::internal |
OLD | NEW |