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 3310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3321 | 3321 |
3322 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR | 3322 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR |
3323 | 3323 |
3324 | 3324 |
3325 HInstruction* HStringAdd::New( | 3325 HInstruction* HStringAdd::New( |
3326 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3326 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3327 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3327 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3328 HConstant* c_right = HConstant::cast(right); | 3328 HConstant* c_right = HConstant::cast(right); |
3329 HConstant* c_left = HConstant::cast(left); | 3329 HConstant* c_left = HConstant::cast(left); |
3330 if (c_left->HasStringValue() && c_right->HasStringValue()) { | 3330 if (c_left->HasStringValue() && c_right->HasStringValue()) { |
3331 Factory* factory = Isolate::Current()->factory(); | 3331 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( |
3332 return new(zone) HConstant(factory->NewConsString(c_left->StringValue(), | 3332 c_left->StringValue(), c_right->StringValue()); |
3333 c_right->StringValue()), | 3333 return new(zone) HConstant(concat, Representation::Tagged()); |
3334 Representation::Tagged()); | |
3335 } | 3334 } |
3336 } | 3335 } |
3337 return new(zone) HStringAdd(context, left, right); | 3336 return new(zone) HStringAdd(context, left, right); |
3338 } | 3337 } |
3339 | 3338 |
3340 | 3339 |
3341 HInstruction* HStringCharFromCode::New( | 3340 HInstruction* HStringCharFromCode::New( |
3342 Zone* zone, HValue* context, HValue* char_code) { | 3341 Zone* zone, HValue* context, HValue* char_code) { |
3343 if (FLAG_fold_constants && char_code->IsConstant()) { | 3342 if (FLAG_fold_constants && char_code->IsConstant()) { |
3344 HConstant* c_code = HConstant::cast(char_code); | 3343 HConstant* c_code = HConstant::cast(char_code); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3871 case kBackingStore: | 3870 case kBackingStore: |
3872 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3871 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3873 stream->Add("[backing-store]"); | 3872 stream->Add("[backing-store]"); |
3874 break; | 3873 break; |
3875 } | 3874 } |
3876 | 3875 |
3877 stream->Add("@%d", offset()); | 3876 stream->Add("@%d", offset()); |
3878 } | 3877 } |
3879 | 3878 |
3880 } } // namespace v8::internal | 3879 } } // namespace v8::internal |
OLD | NEW |