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 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3801 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) | 3801 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) |
3802 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) | 3802 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) |
3803 | 3803 |
3804 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR | 3804 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR |
3805 | 3805 |
3806 | 3806 |
3807 HInstruction* HStringAdd::New(Zone* zone, | 3807 HInstruction* HStringAdd::New(Zone* zone, |
3808 HValue* context, | 3808 HValue* context, |
3809 HValue* left, | 3809 HValue* left, |
3810 HValue* right, | 3810 HValue* right, |
3811 StringAddFlags flags) { | 3811 PretenureFlag pretenure_flag, |
| 3812 StringAddFlags flags, |
| 3813 Handle<AllocationSite> allocation_site) { |
3812 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3814 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3813 HConstant* c_right = HConstant::cast(right); | 3815 HConstant* c_right = HConstant::cast(right); |
3814 HConstant* c_left = HConstant::cast(left); | 3816 HConstant* c_left = HConstant::cast(left); |
3815 if (c_left->HasStringValue() && c_right->HasStringValue()) { | 3817 if (c_left->HasStringValue() && c_right->HasStringValue()) { |
3816 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( | 3818 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( |
3817 c_left->StringValue(), c_right->StringValue()); | 3819 c_left->StringValue(), c_right->StringValue()); |
3818 return HConstant::New(zone, context, concat); | 3820 return HConstant::New(zone, context, concat); |
3819 } | 3821 } |
3820 } | 3822 } |
3821 return new(zone) HStringAdd(context, left, right, flags); | 3823 return new(zone) HStringAdd( |
| 3824 context, left, right, pretenure_flag, flags, allocation_site); |
3822 } | 3825 } |
3823 | 3826 |
3824 | 3827 |
| 3828 void HStringAdd::PrintDataTo(StringStream* stream) { |
| 3829 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { |
| 3830 stream->Add("_CheckBoth"); |
| 3831 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) { |
| 3832 stream->Add("_CheckLeft"); |
| 3833 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_RIGHT) { |
| 3834 stream->Add("_CheckRight"); |
| 3835 } |
| 3836 stream->Add(" ("); |
| 3837 if (pretenure_flag() == NOT_TENURED) stream->Add("N"); |
| 3838 else if (pretenure_flag() == TENURED) stream->Add("D"); |
| 3839 stream->Add(")"); |
| 3840 } |
| 3841 |
| 3842 |
3825 HInstruction* HStringCharFromCode::New( | 3843 HInstruction* HStringCharFromCode::New( |
3826 Zone* zone, HValue* context, HValue* char_code) { | 3844 Zone* zone, HValue* context, HValue* char_code) { |
3827 if (FLAG_fold_constants && char_code->IsConstant()) { | 3845 if (FLAG_fold_constants && char_code->IsConstant()) { |
3828 HConstant* c_code = HConstant::cast(char_code); | 3846 HConstant* c_code = HConstant::cast(char_code); |
3829 Isolate* isolate = zone->isolate(); | 3847 Isolate* isolate = zone->isolate(); |
3830 if (c_code->HasNumberValue()) { | 3848 if (c_code->HasNumberValue()) { |
3831 if (std::isfinite(c_code->DoubleValue())) { | 3849 if (std::isfinite(c_code->DoubleValue())) { |
3832 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff; | 3850 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff; |
3833 return HConstant::New(zone, context, | 3851 return HConstant::New(zone, context, |
3834 LookupSingleCharacterStringFromCode(isolate, code)); | 3852 LookupSingleCharacterStringFromCode(isolate, code)); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4422 break; | 4440 break; |
4423 case kExternalMemory: | 4441 case kExternalMemory: |
4424 stream->Add("[external-memory]"); | 4442 stream->Add("[external-memory]"); |
4425 break; | 4443 break; |
4426 } | 4444 } |
4427 | 4445 |
4428 stream->Add("@%d", offset()); | 4446 stream->Add("@%d", offset()); |
4429 } | 4447 } |
4430 | 4448 |
4431 } } // namespace v8::internal | 4449 } } // namespace v8::internal |
OLD | NEW |