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

Side by Side Diff: src/hydrogen.cc

Issue 711313002: Reland "In-object double fields unboxing (for 64-bit only)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The fix Created 6 years, 1 month 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/heap/store-buffer.cc ('k') | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 5515 matching lines...) Expand 10 before | Expand all | Expand 10 after
5526 Handle<FixedArray> properties(boilerplate->properties()); 5526 Handle<FixedArray> properties(boilerplate->properties());
5527 if (properties->length() > 0) { 5527 if (properties->length() > 0) {
5528 return false; 5528 return false;
5529 } else { 5529 } else {
5530 Handle<DescriptorArray> descriptors( 5530 Handle<DescriptorArray> descriptors(
5531 boilerplate->map()->instance_descriptors()); 5531 boilerplate->map()->instance_descriptors());
5532 int limit = boilerplate->map()->NumberOfOwnDescriptors(); 5532 int limit = boilerplate->map()->NumberOfOwnDescriptors();
5533 for (int i = 0; i < limit; i++) { 5533 for (int i = 0; i < limit; i++) {
5534 PropertyDetails details = descriptors->GetDetails(i); 5534 PropertyDetails details = descriptors->GetDetails(i);
5535 if (details.type() != FIELD) continue; 5535 if (details.type() != FIELD) continue;
5536 int index = descriptors->GetFieldIndex(i);
5537 if ((*max_properties)-- == 0) return false; 5536 if ((*max_properties)-- == 0) return false;
5538 Handle<Object> value(boilerplate->InObjectPropertyAt(index), isolate); 5537 FieldIndex field_index = FieldIndex::ForDescriptor(boilerplate->map(), i);
5538 if (boilerplate->IsUnboxedDoubleField(field_index)) continue;
5539 Handle<Object> value(boilerplate->RawFastPropertyAt(field_index),
5540 isolate);
5539 if (value->IsJSObject()) { 5541 if (value->IsJSObject()) {
5540 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 5542 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
5541 if (!IsFastLiteral(value_object, 5543 if (!IsFastLiteral(value_object,
5542 max_depth - 1, 5544 max_depth - 1,
5543 max_properties)) { 5545 max_properties)) {
5544 return false; 5546 return false;
5545 } 5547 }
5546 } 5548 }
5547 } 5549 }
5548 } 5550 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 LookupIterator it(object, info->name(), 5833 LookupIterator it(object, info->name(),
5832 LookupIterator::OWN_SKIP_INTERCEPTOR); 5834 LookupIterator::OWN_SKIP_INTERCEPTOR);
5833 Handle<Object> value = JSObject::GetDataProperty(&it); 5835 Handle<Object> value = JSObject::GetDataProperty(&it);
5834 if (it.IsFound() && it.IsReadOnly() && !it.IsConfigurable()) { 5836 if (it.IsFound() && it.IsReadOnly() && !it.IsConfigurable()) {
5835 return New<HConstant>(value); 5837 return New<HConstant>(value);
5836 } 5838 }
5837 } 5839 }
5838 } 5840 }
5839 5841
5840 HObjectAccess access = info->access(); 5842 HObjectAccess access = info->access();
5841 if (access.representation().IsDouble()) { 5843 if (access.representation().IsDouble() &&
5844 (!FLAG_unbox_double_fields || !access.IsInobject())) {
5842 // Load the heap number. 5845 // Load the heap number.
5843 checked_object = Add<HLoadNamedField>( 5846 checked_object = Add<HLoadNamedField>(
5844 checked_object, static_cast<HValue*>(NULL), 5847 checked_object, static_cast<HValue*>(NULL),
5845 access.WithRepresentation(Representation::Tagged())); 5848 access.WithRepresentation(Representation::Tagged()));
5846 // Load the double value from it. 5849 // Load the double value from it.
5847 access = HObjectAccess::ForHeapNumberValue(); 5850 access = HObjectAccess::ForHeapNumberValue();
5848 } 5851 }
5849 5852
5850 SmallMapList* map_list = info->field_maps(); 5853 SmallMapList* map_list = info->field_maps();
5851 if (map_list->length() == 0) { 5854 if (map_list->length() == 0) {
(...skipping 11 matching lines...) Expand all
5863 5866
5864 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( 5867 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
5865 PropertyAccessInfo* info, 5868 PropertyAccessInfo* info,
5866 HValue* checked_object, 5869 HValue* checked_object,
5867 HValue* value) { 5870 HValue* value) {
5868 bool transition_to_field = info->IsTransition(); 5871 bool transition_to_field = info->IsTransition();
5869 // TODO(verwaest): Move this logic into PropertyAccessInfo. 5872 // TODO(verwaest): Move this logic into PropertyAccessInfo.
5870 HObjectAccess field_access = info->access(); 5873 HObjectAccess field_access = info->access();
5871 5874
5872 HStoreNamedField *instr; 5875 HStoreNamedField *instr;
5873 if (field_access.representation().IsDouble()) { 5876 if (field_access.representation().IsDouble() &&
5877 (!FLAG_unbox_double_fields || !field_access.IsInobject())) {
5874 HObjectAccess heap_number_access = 5878 HObjectAccess heap_number_access =
5875 field_access.WithRepresentation(Representation::Tagged()); 5879 field_access.WithRepresentation(Representation::Tagged());
5876 if (transition_to_field) { 5880 if (transition_to_field) {
5877 // The store requires a mutable HeapNumber to be allocated. 5881 // The store requires a mutable HeapNumber to be allocated.
5878 NoObservableSideEffectsScope no_side_effects(this); 5882 NoObservableSideEffectsScope no_side_effects(this);
5879 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); 5883 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
5880 5884
5881 // TODO(hpayer): Allocation site pretenuring support. 5885 // TODO(hpayer): Allocation site pretenuring support.
5882 HInstruction* heap_number = Add<HAllocate>(heap_number_size, 5886 HInstruction* heap_number = Add<HAllocate>(heap_number_size,
5883 HType::HeapObject(), 5887 HType::HeapObject(),
(...skipping 5295 matching lines...) Expand 10 before | Expand all | Expand 10 after
11179 PretenureFlag pretenure_flag) { 11183 PretenureFlag pretenure_flag) {
11180 Handle<Map> boilerplate_map(boilerplate_object->map()); 11184 Handle<Map> boilerplate_map(boilerplate_object->map());
11181 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors()); 11185 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors());
11182 int limit = boilerplate_map->NumberOfOwnDescriptors(); 11186 int limit = boilerplate_map->NumberOfOwnDescriptors();
11183 11187
11184 int copied_fields = 0; 11188 int copied_fields = 0;
11185 for (int i = 0; i < limit; i++) { 11189 for (int i = 0; i < limit; i++) {
11186 PropertyDetails details = descriptors->GetDetails(i); 11190 PropertyDetails details = descriptors->GetDetails(i);
11187 if (details.type() != FIELD) continue; 11191 if (details.type() != FIELD) continue;
11188 copied_fields++; 11192 copied_fields++;
11189 int index = descriptors->GetFieldIndex(i); 11193 FieldIndex field_index = FieldIndex::ForDescriptor(*boilerplate_map, i);
11190 int property_offset = boilerplate_object->GetInObjectPropertyOffset(index); 11194
11195
11196 int property_offset = field_index.offset();
11191 Handle<Name> name(descriptors->GetKey(i)); 11197 Handle<Name> name(descriptors->GetKey(i));
11192 Handle<Object> value =
11193 Handle<Object>(boilerplate_object->InObjectPropertyAt(index),
11194 isolate());
11195 11198
11196 // The access for the store depends on the type of the boilerplate. 11199 // The access for the store depends on the type of the boilerplate.
11197 HObjectAccess access = boilerplate_object->IsJSArray() ? 11200 HObjectAccess access = boilerplate_object->IsJSArray() ?
11198 HObjectAccess::ForJSArrayOffset(property_offset) : 11201 HObjectAccess::ForJSArrayOffset(property_offset) :
11199 HObjectAccess::ForMapAndOffset(boilerplate_map, property_offset); 11202 HObjectAccess::ForMapAndOffset(boilerplate_map, property_offset);
11200 11203
11204 if (boilerplate_object->IsUnboxedDoubleField(field_index)) {
11205 CHECK(!boilerplate_object->IsJSArray());
11206 double value = boilerplate_object->RawFastDoublePropertyAt(field_index);
11207 access = access.WithRepresentation(Representation::Double());
11208 Add<HStoreNamedField>(object, access, Add<HConstant>(value));
11209 continue;
11210 }
11211 Handle<Object> value(boilerplate_object->RawFastPropertyAt(field_index),
11212 isolate());
11213
11201 if (value->IsJSObject()) { 11214 if (value->IsJSObject()) {
11202 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 11215 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
11203 Handle<AllocationSite> current_site = site_context->EnterNewScope(); 11216 Handle<AllocationSite> current_site = site_context->EnterNewScope();
11204 HInstruction* result = 11217 HInstruction* result =
11205 BuildFastLiteral(value_object, site_context); 11218 BuildFastLiteral(value_object, site_context);
11206 site_context->ExitScope(current_site, value_object); 11219 site_context->ExitScope(current_site, value_object);
11207 Add<HStoreNamedField>(object, access, result); 11220 Add<HStoreNamedField>(object, access, result);
11208 } else { 11221 } else {
11209 Representation representation = details.representation(); 11222 Representation representation = details.representation();
11210 HInstruction* value_instruction; 11223 HInstruction* value_instruction;
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
12672 if (ShouldProduceTraceOutput()) { 12685 if (ShouldProduceTraceOutput()) {
12673 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12686 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12674 } 12687 }
12675 12688
12676 #ifdef DEBUG 12689 #ifdef DEBUG
12677 graph_->Verify(false); // No full verify. 12690 graph_->Verify(false); // No full verify.
12678 #endif 12691 #endif
12679 } 12692 }
12680 12693
12681 } } // namespace v8::internal 12694 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/store-buffer.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698