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 391693002: In-object double fields unboxing (for 64-bit only). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Toon's comments 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
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 5292 matching lines...) Expand 10 before | Expand all | Expand 10 after
11176 PretenureFlag pretenure_flag) { 11180 PretenureFlag pretenure_flag) {
11177 Handle<Map> boilerplate_map(boilerplate_object->map()); 11181 Handle<Map> boilerplate_map(boilerplate_object->map());
11178 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors()); 11182 Handle<DescriptorArray> descriptors(boilerplate_map->instance_descriptors());
11179 int limit = boilerplate_map->NumberOfOwnDescriptors(); 11183 int limit = boilerplate_map->NumberOfOwnDescriptors();
11180 11184
11181 int copied_fields = 0; 11185 int copied_fields = 0;
11182 for (int i = 0; i < limit; i++) { 11186 for (int i = 0; i < limit; i++) {
11183 PropertyDetails details = descriptors->GetDetails(i); 11187 PropertyDetails details = descriptors->GetDetails(i);
11184 if (details.type() != FIELD) continue; 11188 if (details.type() != FIELD) continue;
11185 copied_fields++; 11189 copied_fields++;
11186 int index = descriptors->GetFieldIndex(i); 11190 FieldIndex field_index = FieldIndex::ForDescriptor(*boilerplate_map, i);
11187 int property_offset = boilerplate_object->GetInObjectPropertyOffset(index); 11191
11192
11193 int property_offset = field_index.offset();
11188 Handle<Name> name(descriptors->GetKey(i)); 11194 Handle<Name> name(descriptors->GetKey(i));
11189 Handle<Object> value =
11190 Handle<Object>(boilerplate_object->InObjectPropertyAt(index),
11191 isolate());
11192 11195
11193 // The access for the store depends on the type of the boilerplate. 11196 // The access for the store depends on the type of the boilerplate.
11194 HObjectAccess access = boilerplate_object->IsJSArray() ? 11197 HObjectAccess access = boilerplate_object->IsJSArray() ?
11195 HObjectAccess::ForJSArrayOffset(property_offset) : 11198 HObjectAccess::ForJSArrayOffset(property_offset) :
11196 HObjectAccess::ForMapAndOffset(boilerplate_map, property_offset); 11199 HObjectAccess::ForMapAndOffset(boilerplate_map, property_offset);
11197 11200
11201 if (boilerplate_object->IsUnboxedDoubleField(field_index)) {
11202 CHECK(!boilerplate_object->IsJSArray());
11203 double value = boilerplate_object->RawFastDoublePropertyAt(field_index);
11204 access = access.WithRepresentation(Representation::Double());
11205 Add<HStoreNamedField>(object, access, Add<HConstant>(value));
11206 continue;
11207 }
11208 Handle<Object> value(boilerplate_object->RawFastPropertyAt(field_index),
11209 isolate());
11210
11198 if (value->IsJSObject()) { 11211 if (value->IsJSObject()) {
11199 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 11212 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
11200 Handle<AllocationSite> current_site = site_context->EnterNewScope(); 11213 Handle<AllocationSite> current_site = site_context->EnterNewScope();
11201 HInstruction* result = 11214 HInstruction* result =
11202 BuildFastLiteral(value_object, site_context); 11215 BuildFastLiteral(value_object, site_context);
11203 site_context->ExitScope(current_site, value_object); 11216 site_context->ExitScope(current_site, value_object);
11204 Add<HStoreNamedField>(object, access, result); 11217 Add<HStoreNamedField>(object, access, result);
11205 } else { 11218 } else {
11206 Representation representation = details.representation(); 11219 Representation representation = details.representation();
11207 HInstruction* value_instruction; 11220 HInstruction* value_instruction;
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
12668 if (ShouldProduceTraceOutput()) { 12681 if (ShouldProduceTraceOutput()) {
12669 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12682 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12670 } 12683 }
12671 12684
12672 #ifdef DEBUG 12685 #ifdef DEBUG
12673 graph_->Verify(false); // No full verify. 12686 graph_->Verify(false); // No full verify.
12674 #endif 12687 #endif
12675 } 12688 }
12676 12689
12677 } } // namespace v8::internal 12690 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698