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

Side by Side Diff: src/hydrogen.cc

Issue 23480094: Set the proper instance-type on HAllocate in BuildFastLiteral (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added assert 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
« no previous file with comments | « no previous file | 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 8178 matching lines...) Expand 10 before | Expand all | Expand 10 after
8189 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( 8189 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
8190 Handle<JSObject> boilerplate_object, 8190 Handle<JSObject> boilerplate_object,
8191 Handle<Object> allocation_site_object, 8191 Handle<Object> allocation_site_object,
8192 AllocationSiteMode mode) { 8192 AllocationSiteMode mode) {
8193 NoObservableSideEffectsScope no_effects(this); 8193 NoObservableSideEffectsScope no_effects(this);
8194 8194
8195 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 8195 Handle<FixedArrayBase> elements(boilerplate_object->elements());
8196 int object_size = boilerplate_object->map()->instance_size(); 8196 int object_size = boilerplate_object->map()->instance_size();
8197 int object_offset = object_size; 8197 int object_offset = object_size;
8198 8198
8199 InstanceType instance_type = boilerplate_object->map()->instance_type();
8199 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && 8200 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE &&
8200 AllocationSite::CanTrack(boilerplate_object->map()->instance_type()); 8201 AllocationSite::CanTrack(instance_type);
8201 8202
8202 // If using allocation sites, then the payload on the site should already 8203 // If using allocation sites, then the payload on the site should already
8203 // be filled in as a valid (boilerplate) array. 8204 // be filled in as a valid (boilerplate) array.
8204 ASSERT(!create_allocation_site_info || 8205 ASSERT(!create_allocation_site_info ||
8205 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); 8206 AllocationSite::cast(*allocation_site_object)->IsLiteralSite());
8206 8207
8207 if (create_allocation_site_info) { 8208 if (create_allocation_site_info) {
8208 object_size += AllocationMemento::kSize; 8209 object_size += AllocationMemento::kSize;
8209 } 8210 }
8210 8211
8212 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
8213 HType type = instance_type == JS_ARRAY_TYPE
8214 ? HType::JSArray() : HType::JSObject();
8211 HValue* object_size_constant = Add<HConstant>(object_size); 8215 HValue* object_size_constant = Add<HConstant>(object_size);
8212 HInstruction* object = Add<HAllocate>(object_size_constant, HType::JSObject(), 8216 HInstruction* object = Add<HAllocate>(object_size_constant, type,
8213 isolate()->heap()->GetPretenureMode(), JS_OBJECT_TYPE); 8217 isolate()->heap()->GetPretenureMode(), instance_type);
8214 8218
8215 8219
8216 BuildEmitObjectHeader(boilerplate_object, object); 8220 BuildEmitObjectHeader(boilerplate_object, object);
8217 8221
8218 if (create_allocation_site_info) { 8222 if (create_allocation_site_info) {
8219 HInstruction* allocation_site = Add<HConstant>(allocation_site_object); 8223 HInstruction* allocation_site = Add<HConstant>(allocation_site_object);
8220 BuildCreateAllocationMemento(object, object_offset, allocation_site); 8224 BuildCreateAllocationMemento(object, object_offset, allocation_site);
8221 } 8225 }
8222 8226
8223 int elements_size = (elements->length() > 0 && 8227 int elements_size = (elements->length() > 0 &&
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
9700 if (ShouldProduceTraceOutput()) { 9704 if (ShouldProduceTraceOutput()) {
9701 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9705 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9702 } 9706 }
9703 9707
9704 #ifdef DEBUG 9708 #ifdef DEBUG
9705 graph_->Verify(false); // No full verify. 9709 graph_->Verify(false); // No full verify.
9706 #endif 9710 #endif
9707 } 9711 }
9708 9712
9709 } } // namespace v8::internal 9713 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698