Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 1339053002: [crankshaft] Re-add fast-case for string add left/right. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Real fix for HStringAdd Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen-instructions.h" 5 #include "src/hydrogen-instructions.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/double.h" 8 #include "src/double.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 3979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3990 3990
3991 3991
3992 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) 3992 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +)
3993 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) 3993 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *)
3994 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) 3994 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -)
3995 3995
3996 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR 3996 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR
3997 3997
3998 3998
3999 HInstruction* HStringAdd::New(Isolate* isolate, Zone* zone, HValue* context, 3999 HInstruction* HStringAdd::New(Isolate* isolate, Zone* zone, HValue* context,
4000 HValue* left, HValue* right, Strength strength, 4000 HValue* left, HValue* right,
4001 PretenureFlag pretenure_flag, 4001 PretenureFlag pretenure_flag,
4002 StringAddFlags flags, 4002 StringAddFlags flags,
4003 Handle<AllocationSite> allocation_site) { 4003 Handle<AllocationSite> allocation_site) {
4004 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 4004 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
4005 HConstant* c_right = HConstant::cast(right); 4005 HConstant* c_right = HConstant::cast(right);
4006 HConstant* c_left = HConstant::cast(left); 4006 HConstant* c_left = HConstant::cast(left);
4007 if (c_left->HasStringValue() && c_right->HasStringValue()) { 4007 if (c_left->HasStringValue() && c_right->HasStringValue()) {
4008 Handle<String> left_string = c_left->StringValue(); 4008 Handle<String> left_string = c_left->StringValue();
4009 Handle<String> right_string = c_right->StringValue(); 4009 Handle<String> right_string = c_right->StringValue();
4010 // Prevent possible exception by invalid string length. 4010 // Prevent possible exception by invalid string length.
4011 if (left_string->length() + right_string->length() < String::kMaxLength) { 4011 if (left_string->length() + right_string->length() < String::kMaxLength) {
4012 MaybeHandle<String> concat = isolate->factory()->NewConsString( 4012 MaybeHandle<String> concat = isolate->factory()->NewConsString(
4013 c_left->StringValue(), c_right->StringValue()); 4013 c_left->StringValue(), c_right->StringValue());
4014 return HConstant::New(isolate, zone, context, concat.ToHandleChecked()); 4014 return HConstant::New(isolate, zone, context, concat.ToHandleChecked());
4015 } 4015 }
4016 } 4016 }
4017 } 4017 }
4018 return new (zone) HStringAdd(context, left, right, strength, pretenure_flag, 4018 return new (zone)
4019 flags, allocation_site); 4019 HStringAdd(context, left, right, pretenure_flag, flags, allocation_site);
4020 } 4020 }
4021 4021
4022 4022
4023 std::ostream& HStringAdd::PrintDataTo(std::ostream& os) const { // NOLINT 4023 std::ostream& HStringAdd::PrintDataTo(std::ostream& os) const { // NOLINT
4024 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { 4024 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
4025 os << "_CheckBoth"; 4025 os << "_CheckBoth";
4026 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) { 4026 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) {
4027 os << "_CheckLeft"; 4027 os << "_CheckLeft";
4028 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_RIGHT) { 4028 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_RIGHT) {
4029 os << "_CheckRight"; 4029 os << "_CheckRight";
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
4707 case HObjectAccess::kExternalMemory: 4707 case HObjectAccess::kExternalMemory:
4708 os << "[external-memory]"; 4708 os << "[external-memory]";
4709 break; 4709 break;
4710 } 4710 }
4711 4711
4712 return os << "@" << access.offset(); 4712 return os << "@" << access.offset();
4713 } 4713 }
4714 4714
4715 } // namespace internal 4715 } // namespace internal
4716 } // namespace v8 4716 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698