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 3433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 } | 3444 } |
3445 | 3445 |
3446 | 3446 |
3447 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) | 3447 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) |
3448 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) | 3448 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) |
3449 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) | 3449 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) |
3450 | 3450 |
3451 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR | 3451 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR |
3452 | 3452 |
3453 | 3453 |
3454 HInstruction* HStringAdd::New( | 3454 HInstruction* HStringAdd::New(Zone* zone, |
3455 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3455 HValue* context, |
| 3456 HValue* left, |
| 3457 HValue* right, |
| 3458 StringAddFlags flags) { |
3456 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3459 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3457 HConstant* c_right = HConstant::cast(right); | 3460 HConstant* c_right = HConstant::cast(right); |
3458 HConstant* c_left = HConstant::cast(left); | 3461 HConstant* c_left = HConstant::cast(left); |
3459 if (c_left->HasStringValue() && c_right->HasStringValue()) { | 3462 if (c_left->HasStringValue() && c_right->HasStringValue()) { |
3460 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( | 3463 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( |
3461 c_left->StringValue(), c_right->StringValue()); | 3464 c_left->StringValue(), c_right->StringValue()); |
3462 return new(zone) HConstant(concat, Representation::Tagged()); | 3465 return new(zone) HConstant(concat, Representation::Tagged()); |
3463 } | 3466 } |
3464 } | 3467 } |
3465 return new(zone) HStringAdd(context, left, right); | 3468 return new(zone) HStringAdd(context, left, right, flags); |
3466 } | 3469 } |
3467 | 3470 |
3468 | 3471 |
3469 HInstruction* HStringCharFromCode::New( | 3472 HInstruction* HStringCharFromCode::New( |
3470 Zone* zone, HValue* context, HValue* char_code) { | 3473 Zone* zone, HValue* context, HValue* char_code) { |
3471 if (FLAG_fold_constants && char_code->IsConstant()) { | 3474 if (FLAG_fold_constants && char_code->IsConstant()) { |
3472 HConstant* c_code = HConstant::cast(char_code); | 3475 HConstant* c_code = HConstant::cast(char_code); |
3473 Isolate* isolate = Isolate::Current(); | 3476 Isolate* isolate = Isolate::Current(); |
3474 if (c_code->HasNumberValue()) { | 3477 if (c_code->HasNumberValue()) { |
3475 if (std::isfinite(c_code->DoubleValue())) { | 3478 if (std::isfinite(c_code->DoubleValue())) { |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 case kBackingStore: | 3997 case kBackingStore: |
3995 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3998 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3996 stream->Add("[backing-store]"); | 3999 stream->Add("[backing-store]"); |
3997 break; | 4000 break; |
3998 } | 4001 } |
3999 | 4002 |
4000 stream->Add("@%d", offset()); | 4003 stream->Add("@%d", offset()); |
4001 } | 4004 } |
4002 | 4005 |
4003 } } // namespace v8::internal | 4006 } } // namespace v8::internal |
OLD | NEW |