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

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

Issue 19956002: Support double allocations when folding allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | test/mjsunit/allocation-folding.js » ('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 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 PrintF("#%d (%s) cannot fold into #%d (%s)\n", 3203 PrintF("#%d (%s) cannot fold into #%d (%s)\n",
3204 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); 3204 id(), Mnemonic(), dominator->id(), dominator->Mnemonic());
3205 } 3205 }
3206 return; 3206 return;
3207 } 3207 }
3208 3208
3209 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); 3209 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator);
3210 HValue* dominator_size = dominator_allocate_instr->size(); 3210 HValue* dominator_size = dominator_allocate_instr->size();
3211 HValue* current_size = size(); 3211 HValue* current_size = size();
3212 // We can just fold allocations that are guaranteed in new space. 3212 // We can just fold allocations that are guaranteed in new space.
3213 // TODO(hpayer): Support double aligned allocations.
3214 // TODO(hpayer): Add support for non-constant allocation in dominator. 3213 // TODO(hpayer): Add support for non-constant allocation in dominator.
3215 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || 3214 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() ||
Michael Starzinger 2013/07/23 11:24:14 The predicates need to be removed from this early
Hannes Payer (out of office) 2013/07/23 19:26:37 Done.
3216 !current_size->IsInteger32Constant() || 3215 !current_size->IsInteger32Constant() ||
3217 !dominator_allocate_instr->GuaranteedInNewSpace() || 3216 !dominator_allocate_instr->GuaranteedInNewSpace() ||
3218 dominator_allocate_instr->MustAllocateDoubleAligned() || 3217 dominator_allocate_instr->MustAllocateDoubleAligned() ||
3219 !dominator_size->IsInteger32Constant()) { 3218 !dominator_size->IsInteger32Constant()) {
3220 if (FLAG_trace_allocation_folding) { 3219 if (FLAG_trace_allocation_folding) {
3221 PrintF("#%d (%s) cannot fold into #%d (%s)\n", 3220 PrintF("#%d (%s) cannot fold into #%d (%s)\n",
3222 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); 3221 id(), Mnemonic(), dominator->id(), dominator->Mnemonic());
3223 } 3222 }
3224 return; 3223 return;
3225 } 3224 }
3226 3225
3227 // First update the size of the dominator allocate instruction. 3226 // First update the size of the dominator allocate instruction.
3228 int32_t dominator_size_constant = 3227 int32_t dominator_size_constant =
3229 HConstant::cast(dominator_size)->GetInteger32Constant(); 3228 HConstant::cast(dominator_size)->GetInteger32Constant();
3230 int32_t current_size_constant = 3229 int32_t current_size_constant =
3231 HConstant::cast(current_size)->GetInteger32Constant(); 3230 HConstant::cast(current_size)->GetInteger32Constant();
3232 int32_t new_dominator_size = dominator_size_constant + current_size_constant; 3231 int32_t new_dominator_size = dominator_size_constant + current_size_constant;
3232
3233 if (MustAllocateDoubleAligned()) {
3234 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) {
3235 dominator_allocate_instr->SetFlags(HAllocate::ALLOCATE_DOUBLE_ALIGNED);
3236 }
3237 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) {
3238 dominator_size_constant += kDoubleSize / 2;
3239 new_dominator_size += kDoubleSize / 2;
3240 }
3241 }
3242
3233 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { 3243 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) {
3234 if (FLAG_trace_allocation_folding) { 3244 if (FLAG_trace_allocation_folding) {
3235 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", 3245 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n",
3236 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(), 3246 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(),
3237 new_dominator_size); 3247 new_dominator_size);
3238 } 3248 }
3239 return; 3249 return;
3240 } 3250 }
3241 HBasicBlock* block = dominator->block(); 3251 HBasicBlock* block = dominator->block();
3242 Zone* zone = block->zone(); 3252 Zone* zone = block->zone();
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 case kBackingStore: 3990 case kBackingStore:
3981 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3991 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3982 stream->Add("[backing-store]"); 3992 stream->Add("[backing-store]");
3983 break; 3993 break;
3984 } 3994 }
3985 3995
3986 stream->Add("@%d", offset()); 3996 stream->Add("@%d", offset());
3987 } 3997 }
3988 3998
3989 } } // namespace v8::internal 3999 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/allocation-folding.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698