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

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

Issue 395713002: Allow embedding of ConsString objects into code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Yang Guo. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | src/ia32/assembler-ia32-inl.h » ('j') | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/double.h" 7 #include "src/double.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/hydrogen-infer-representation.h" 9 #include "src/hydrogen-infer-representation.h"
10 #include "src/property-details-inl.h" 10 #include "src/property-details-inl.h"
(...skipping 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 StringAddFlags flags, 4060 StringAddFlags flags,
4061 Handle<AllocationSite> allocation_site) { 4061 Handle<AllocationSite> allocation_site) {
4062 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 4062 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
4063 HConstant* c_right = HConstant::cast(right); 4063 HConstant* c_right = HConstant::cast(right);
4064 HConstant* c_left = HConstant::cast(left); 4064 HConstant* c_left = HConstant::cast(left);
4065 if (c_left->HasStringValue() && c_right->HasStringValue()) { 4065 if (c_left->HasStringValue() && c_right->HasStringValue()) {
4066 Handle<String> left_string = c_left->StringValue(); 4066 Handle<String> left_string = c_left->StringValue();
4067 Handle<String> right_string = c_right->StringValue(); 4067 Handle<String> right_string = c_right->StringValue();
4068 // Prevent possible exception by invalid string length. 4068 // Prevent possible exception by invalid string length.
4069 if (left_string->length() + right_string->length() < String::kMaxLength) { 4069 if (left_string->length() + right_string->length() < String::kMaxLength) {
4070 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( 4070 MaybeHandle<String> concat = zone->isolate()->factory()->NewConsString(
4071 c_left->StringValue(), c_right->StringValue()); 4071 c_left->StringValue(), c_right->StringValue());
4072 ASSERT(!concat.is_null()); 4072 return HConstant::New(zone, context, concat.ToHandleChecked());
4073 return HConstant::New(zone, context, concat);
4074 } 4073 }
4075 } 4074 }
4076 } 4075 }
4077 return new(zone) HStringAdd( 4076 return new(zone) HStringAdd(
4078 context, left, right, pretenure_flag, flags, allocation_site); 4077 context, left, right, pretenure_flag, flags, allocation_site);
4079 } 4078 }
4080 4079
4081 4080
4082 OStream& HStringAdd::PrintDataTo(OStream& os) const { // NOLINT 4081 OStream& HStringAdd::PrintDataTo(OStream& os) const { // NOLINT
4083 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { 4082 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
4772 break; 4771 break;
4773 case HObjectAccess::kExternalMemory: 4772 case HObjectAccess::kExternalMemory:
4774 os << "[external-memory]"; 4773 os << "[external-memory]";
4775 break; 4774 break;
4776 } 4775 }
4777 4776
4778 return os << "@" << access.offset(); 4777 return os << "@" << access.offset();
4779 } 4778 }
4780 4779
4781 } } // namespace v8::internal 4780 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/ia32/assembler-ia32-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698