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

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

Issue 106313003: Reland "Allocation site support for monomorphic StringAdds in BinaryOps". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/hydrogen-instructions.h ('k') | src/ia32/code-stubs-ia32.cc » ('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 // 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 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3808 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *) 3808 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HMul, *)
3809 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) 3809 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -)
3810 3810
3811 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR 3811 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR
3812 3812
3813 3813
3814 HInstruction* HStringAdd::New(Zone* zone, 3814 HInstruction* HStringAdd::New(Zone* zone,
3815 HValue* context, 3815 HValue* context,
3816 HValue* left, 3816 HValue* left,
3817 HValue* right, 3817 HValue* right,
3818 StringAddFlags flags) { 3818 PretenureFlag pretenure_flag,
3819 StringAddFlags flags,
3820 Handle<AllocationSite> allocation_site) {
3819 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3821 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3820 HConstant* c_right = HConstant::cast(right); 3822 HConstant* c_right = HConstant::cast(right);
3821 HConstant* c_left = HConstant::cast(left); 3823 HConstant* c_left = HConstant::cast(left);
3822 if (c_left->HasStringValue() && c_right->HasStringValue()) { 3824 if (c_left->HasStringValue() && c_right->HasStringValue()) {
3823 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( 3825 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString(
3824 c_left->StringValue(), c_right->StringValue()); 3826 c_left->StringValue(), c_right->StringValue());
3825 return HConstant::New(zone, context, concat); 3827 return HConstant::New(zone, context, concat);
3826 } 3828 }
3827 } 3829 }
3828 return new(zone) HStringAdd(context, left, right, flags); 3830 return new(zone) HStringAdd(
3831 context, left, right, pretenure_flag, flags, allocation_site);
3829 } 3832 }
3830 3833
3831 3834
3835 void HStringAdd::PrintDataTo(StringStream* stream) {
3836 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
3837 stream->Add("_CheckBoth");
3838 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) {
3839 stream->Add("_CheckLeft");
3840 } else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_RIGHT) {
3841 stream->Add("_CheckRight");
3842 }
3843 stream->Add(" (");
3844 if (pretenure_flag() == NOT_TENURED) stream->Add("N");
3845 else if (pretenure_flag() == TENURED) stream->Add("D");
3846 stream->Add(")");
3847 }
3848
3849
3832 HInstruction* HStringCharFromCode::New( 3850 HInstruction* HStringCharFromCode::New(
3833 Zone* zone, HValue* context, HValue* char_code) { 3851 Zone* zone, HValue* context, HValue* char_code) {
3834 if (FLAG_fold_constants && char_code->IsConstant()) { 3852 if (FLAG_fold_constants && char_code->IsConstant()) {
3835 HConstant* c_code = HConstant::cast(char_code); 3853 HConstant* c_code = HConstant::cast(char_code);
3836 Isolate* isolate = zone->isolate(); 3854 Isolate* isolate = zone->isolate();
3837 if (c_code->HasNumberValue()) { 3855 if (c_code->HasNumberValue()) {
3838 if (std::isfinite(c_code->DoubleValue())) { 3856 if (std::isfinite(c_code->DoubleValue())) {
3839 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff; 3857 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff;
3840 return HConstant::New(zone, context, 3858 return HConstant::New(zone, context,
3841 LookupSingleCharacterStringFromCode(isolate, code)); 3859 LookupSingleCharacterStringFromCode(isolate, code));
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
4429 break; 4447 break;
4430 case kExternalMemory: 4448 case kExternalMemory:
4431 stream->Add("[external-memory]"); 4449 stream->Add("[external-memory]");
4432 break; 4450 break;
4433 } 4451 }
4434 4452
4435 stream->Add("@%d", offset()); 4453 stream->Add("@%d", offset());
4436 } 4454 }
4437 4455
4438 } } // namespace v8::internal 4456 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698