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

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

Issue 22915007: Clear next map word when folding allocations into js arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
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 3191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 if (FLAG_trace_allocation_folding) { 3202 if (FLAG_trace_allocation_folding) {
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 // First update the size of the dominator allocate instruction. 3209 // First update the size of the dominator allocate instruction.
3210 int32_t dominator_size_constant = 3210 int32_t dominator_size_constant =
3211 HConstant::cast(dominator_size)->GetInteger32Constant(); 3211 HConstant::cast(dominator_size)->GetInteger32Constant();
3212 int32_t object_offset = dominator_size_constant;
3212 int32_t current_size_constant = 3213 int32_t current_size_constant =
3213 HConstant::cast(current_size)->GetInteger32Constant(); 3214 HConstant::cast(current_size)->GetInteger32Constant();
3214 int32_t new_dominator_size = dominator_size_constant + current_size_constant; 3215 int32_t new_dominator_size = dominator_size_constant + current_size_constant;
3215 3216
3216 if (MustAllocateDoubleAligned()) { 3217 if (MustAllocateDoubleAligned()) {
3217 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) { 3218 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) {
3218 dominator_allocate_instr->MakeDoubleAligned(); 3219 dominator_allocate_instr->MakeDoubleAligned();
3219 } 3220 }
3220 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { 3221 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) {
3221 dominator_size_constant += kDoubleSize / 2; 3222 dominator_size_constant += kDoubleSize / 2;
3222 new_dominator_size += kDoubleSize / 2; 3223 new_dominator_size += kDoubleSize / 2;
3223 } 3224 }
3224 } 3225 }
3225 3226
3226 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { 3227 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) {
3227 if (FLAG_trace_allocation_folding) { 3228 if (FLAG_trace_allocation_folding) {
3228 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", 3229 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n",
3229 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(), 3230 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(),
3230 new_dominator_size); 3231 new_dominator_size);
3231 } 3232 }
3232 return; 3233 return;
3233 } 3234 }
3234 HBasicBlock* block = dominator->block(); 3235 HBasicBlock* block = dominator->block();
3235 Zone* zone = block->zone(); 3236 Zone* zone = block->zone();
3236 HInstruction* new_dominator_size_constant = 3237 HInstruction* new_dominator_size_constant =
3237 HConstant::New(zone, context(), new_dominator_size); 3238 HConstant::New(zone, context(), new_dominator_size);
3238 new_dominator_size_constant->InsertBefore(dominator_allocate_instr); 3239 new_dominator_size_constant->InsertBefore(dominator_allocate_instr);
3239 dominator_allocate_instr->UpdateSize(new_dominator_size_constant); 3240 dominator_allocate_instr->UpdateSize(new_dominator_size_constant);
3240 3241
3242 // TODO(hpayer): This is a short-term hack to make allocation mementos
3243 // work again in new space.
3244 if (dominator_allocate_instr->type().Equals(HType::JSArray()) &&
mvstanton 2013/08/26 10:01:27 Actually here could you make use of Map::CanTrackA
Hannes Payer (out of office) 2013/08/26 11:51:07 Thanks for the comment, makes sense. I made a stat
3245 !dominator_allocate_instr->clear_next_map_word_) {
3246 HObjectAccess access =
3247 HObjectAccess::ForJSObjectOffset(object_offset);
3248 HStoreNamedField* clear_next_map =
3249 HStoreNamedField::New(zone, context(), dominator_allocate_instr, access,
3250 block->graph()->GetConstantNull());
3251 clear_next_map->ClearAllSideEffects();
3252 clear_next_map->InsertAfter(dominator_allocate_instr);
3253 dominator_allocate_instr->clear_next_map_word_ = true;
3254 }
3255
3241 #ifdef VERIFY_HEAP 3256 #ifdef VERIFY_HEAP
3242 if (FLAG_verify_heap) { 3257 if (FLAG_verify_heap) {
3243 dominator_allocate_instr->MakePrefillWithFiller(); 3258 dominator_allocate_instr->MakePrefillWithFiller();
3244 } 3259 }
3245 #endif 3260 #endif
3246 3261
3247 // After that replace the dominated allocate instruction. 3262 // After that replace the dominated allocate instruction.
3248 HInstruction* dominated_allocate_instr = 3263 HInstruction* dominated_allocate_instr =
3249 HInnerAllocatedObject::New(zone, 3264 HInnerAllocatedObject::New(zone,
3250 context(), 3265 context(),
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 break; 4009 break;
3995 case kExternalMemory: 4010 case kExternalMemory:
3996 stream->Add("[external-memory]"); 4011 stream->Add("[external-memory]");
3997 break; 4012 break;
3998 } 4013 }
3999 4014
4000 stream->Add("@%d", offset()); 4015 stream->Add("@%d", offset());
4001 } 4016 }
4002 4017
4003 } } // namespace v8::internal 4018 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698