OLD | NEW |
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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); | 1322 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); |
1323 HValue* total_size = AddInstruction( | 1323 HValue* total_size = AddInstruction( |
1324 HAdd::New(zone, context, mul, header_size)); | 1324 HAdd::New(zone, context, mul, header_size)); |
1325 total_size->ClearFlag(HValue::kCanOverflow); | 1325 total_size->ClearFlag(HValue::kCanOverflow); |
1326 | 1326 |
1327 HAllocate::Flags flags = HAllocate::DefaultFlags(kind); | 1327 HAllocate::Flags flags = HAllocate::DefaultFlags(kind); |
1328 if (isolate()->heap()->ShouldGloballyPretenure()) { | 1328 if (isolate()->heap()->ShouldGloballyPretenure()) { |
1329 // TODO(hpayer): When pretenuring can be internalized, flags can become | 1329 // TODO(hpayer): When pretenuring can be internalized, flags can become |
1330 // private to HAllocate. | 1330 // private to HAllocate. |
1331 if (IsFastDoubleElementsKind(kind)) { | 1331 if (IsFastDoubleElementsKind(kind)) { |
1332 flags = static_cast<HAllocate::Flags>( | 1332 flags = HAllocate::SetAllocationFlag(flags, |
1333 flags | HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); | 1333 HAllocate::ALLOCATE_IN_OLD_DATA_SPACE); |
1334 } else { | 1334 } else { |
1335 flags = static_cast<HAllocate::Flags>( | 1335 flags = HAllocate::SetAllocationFlag(flags, |
1336 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 1336 HAllocate::ALLOCATE_IN_OLD_POINTER_SPACE); |
1337 } | 1337 } |
1338 } | 1338 } |
1339 | 1339 |
1340 return Add<HAllocate>(context, total_size, HType::JSArray(), flags); | 1340 return Add<HAllocate>(context, total_size, HType::JSArray(), flags); |
1341 } | 1341 } |
1342 | 1342 |
1343 | 1343 |
1344 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, | 1344 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, |
1345 ElementsKind kind, | 1345 ElementsKind kind, |
1346 HValue* capacity) { | 1346 HValue* capacity) { |
(...skipping 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4597 HStoreNamedField *instr; | 4597 HStoreNamedField *instr; |
4598 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { | 4598 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { |
4599 HObjectAccess heap_number_access = | 4599 HObjectAccess heap_number_access = |
4600 field_access.WithRepresentation(Representation::Tagged()); | 4600 field_access.WithRepresentation(Representation::Tagged()); |
4601 if (transition_to_field) { | 4601 if (transition_to_field) { |
4602 // The store requires a mutable HeapNumber to be allocated. | 4602 // The store requires a mutable HeapNumber to be allocated. |
4603 NoObservableSideEffectsScope no_side_effects(this); | 4603 NoObservableSideEffectsScope no_side_effects(this); |
4604 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 4604 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
4605 HInstruction* heap_number = Add<HAllocate>( | 4605 HInstruction* heap_number = Add<HAllocate>( |
4606 environment()->LookupContext(), heap_number_size, | 4606 environment()->LookupContext(), heap_number_size, |
4607 HType::HeapNumber(), HAllocate::CAN_ALLOCATE_IN_NEW_SPACE); | 4607 HType::HeapNumber(), HAllocate::DefaultFlags()); |
4608 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); | 4608 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); |
4609 AddStore(heap_number, HObjectAccess::ForHeapNumberValue(), value); | 4609 AddStore(heap_number, HObjectAccess::ForHeapNumberValue(), value); |
4610 instr = new(zone()) HStoreNamedField( | 4610 instr = new(zone()) HStoreNamedField( |
4611 object, heap_number_access, heap_number); | 4611 object, heap_number_access, heap_number); |
4612 } else { | 4612 } else { |
4613 // Already holds a HeapNumber; load the box and write its value field. | 4613 // Already holds a HeapNumber; load the box and write its value field. |
4614 HInstruction* heap_number = AddLoad(object, heap_number_access); | 4614 HInstruction* heap_number = AddLoad(object, heap_number_access); |
4615 heap_number->set_type(HType::HeapNumber()); | 4615 heap_number->set_type(HType::HeapNumber()); |
4616 instr = new(zone()) HStoreNamedField(heap_number, | 4616 instr = new(zone()) HStoreNamedField(heap_number, |
4617 HObjectAccess::ForHeapNumberValue(), value); | 4617 HObjectAccess::ForHeapNumberValue(), value); |
(...skipping 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7236 ASSERT(constructor->has_initial_map()); | 7236 ASSERT(constructor->has_initial_map()); |
7237 Handle<Map> initial_map(constructor->initial_map()); | 7237 Handle<Map> initial_map(constructor->initial_map()); |
7238 int instance_size = initial_map->instance_size(); | 7238 int instance_size = initial_map->instance_size(); |
7239 ASSERT(initial_map->InitialPropertiesLength() == 0); | 7239 ASSERT(initial_map->InitialPropertiesLength() == 0); |
7240 | 7240 |
7241 // Allocate an instance of the implicit receiver object. | 7241 // Allocate an instance of the implicit receiver object. |
7242 HValue* size_in_bytes = Add<HConstant>(instance_size); | 7242 HValue* size_in_bytes = Add<HConstant>(instance_size); |
7243 HAllocate::Flags flags = HAllocate::DefaultFlags(); | 7243 HAllocate::Flags flags = HAllocate::DefaultFlags(); |
7244 if (FLAG_pretenuring_call_new && | 7244 if (FLAG_pretenuring_call_new && |
7245 isolate()->heap()->ShouldGloballyPretenure()) { | 7245 isolate()->heap()->ShouldGloballyPretenure()) { |
7246 flags = static_cast<HAllocate::Flags>( | 7246 flags = HAllocate::SetAllocationFlag(flags, |
7247 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 7247 HAllocate::ALLOCATE_IN_OLD_POINTER_SPACE); |
7248 } | 7248 } |
7249 HAllocate* receiver = | 7249 HAllocate* receiver = |
7250 Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); | 7250 Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); |
7251 receiver->set_known_initial_map(initial_map); | 7251 receiver->set_known_initial_map(initial_map); |
7252 | 7252 |
7253 // Load the initial map from the constructor. | 7253 // Load the initial map from the constructor. |
7254 HValue* constructor_value = Add<HConstant>(constructor); | 7254 HValue* constructor_value = Add<HConstant>(constructor); |
7255 HValue* initial_map_value = | 7255 HValue* initial_map_value = |
7256 AddLoad(constructor_value, HObjectAccess::ForJSObjectOffset( | 7256 AddLoad(constructor_value, HObjectAccess::ForJSObjectOffset( |
7257 JSFunction::kPrototypeOrInitialMapOffset)); | 7257 JSFunction::kPrototypeOrInitialMapOffset)); |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8322 AllocationSiteMode mode) { | 8322 AllocationSiteMode mode) { |
8323 NoObservableSideEffectsScope no_effects(this); | 8323 NoObservableSideEffectsScope no_effects(this); |
8324 | 8324 |
8325 HInstruction* target = NULL; | 8325 HInstruction* target = NULL; |
8326 HInstruction* data_target = NULL; | 8326 HInstruction* data_target = NULL; |
8327 | 8327 |
8328 ElementsKind kind = boilerplate_object->map()->elements_kind(); | 8328 ElementsKind kind = boilerplate_object->map()->elements_kind(); |
8329 | 8329 |
8330 if (isolate()->heap()->ShouldGloballyPretenure()) { | 8330 if (isolate()->heap()->ShouldGloballyPretenure()) { |
8331 if (data_size != 0) { | 8331 if (data_size != 0) { |
8332 HAllocate::Flags data_flags = | 8332 HAllocate::Flags data_flags = HAllocate::DefaultFlags(kind); |
8333 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags(kind) | | 8333 data_flags = HAllocate::SetAllocationFlag(data_flags, |
8334 HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); | 8334 HAllocate::ALLOCATE_IN_OLD_DATA_SPACE); |
8335 HValue* size_in_bytes = Add<HConstant>(data_size); | 8335 HValue* size_in_bytes = Add<HConstant>(data_size); |
8336 data_target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), | 8336 data_target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), |
8337 data_flags); | 8337 data_flags); |
8338 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); | 8338 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); |
8339 AddStoreMapConstant(data_target, free_space_map); | 8339 AddStoreMapConstant(data_target, free_space_map); |
8340 HObjectAccess access = | 8340 HObjectAccess access = |
8341 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | 8341 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); |
8342 AddStore(data_target, access, size_in_bytes); | 8342 AddStore(data_target, access, size_in_bytes); |
8343 } | 8343 } |
8344 if (pointer_size != 0) { | 8344 if (pointer_size != 0) { |
8345 HAllocate::Flags pointer_flags = | 8345 HAllocate::Flags pointer_flags = HAllocate::DefaultFlags(); |
8346 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags() | | 8346 pointer_flags = HAllocate::SetAllocationFlag(pointer_flags, |
8347 HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 8347 HAllocate::ALLOCATE_IN_OLD_POINTER_SPACE); |
8348 HValue* size_in_bytes = Add<HConstant>(pointer_size); | 8348 HValue* size_in_bytes = Add<HConstant>(pointer_size); |
8349 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), | 8349 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), |
8350 pointer_flags); | 8350 pointer_flags); |
8351 } | 8351 } |
8352 } else { | 8352 } else { |
8353 HAllocate::Flags flags = HAllocate::DefaultFlags(kind); | 8353 HAllocate::Flags flags = HAllocate::DefaultFlags(kind); |
8354 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); | 8354 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); |
8355 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); | 8355 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); |
8356 } | 8356 } |
8357 | 8357 |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9941 if (ShouldProduceTraceOutput()) { | 9941 if (ShouldProduceTraceOutput()) { |
9942 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9942 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9943 } | 9943 } |
9944 | 9944 |
9945 #ifdef DEBUG | 9945 #ifdef DEBUG |
9946 graph_->Verify(false); // No full verify. | 9946 graph_->Verify(false); // No full verify. |
9947 #endif | 9947 #endif |
9948 } | 9948 } |
9949 | 9949 |
9950 } } // namespace v8::internal | 9950 } } // namespace v8::internal |
OLD | NEW |