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 5353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5364 // The store requires a mutable HeapNumber to be allocated. | 5364 // The store requires a mutable HeapNumber to be allocated. |
5365 NoObservableSideEffectsScope no_side_effects(this); | 5365 NoObservableSideEffectsScope no_side_effects(this); |
5366 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 5366 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
5367 | 5367 |
5368 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? | 5368 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? |
5369 isolate()->heap()->GetPretenureMode() : NOT_TENURED; | 5369 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
5370 | 5370 |
5371 HInstruction* heap_number = Add<HAllocate>(heap_number_size, | 5371 HInstruction* heap_number = Add<HAllocate>(heap_number_size, |
5372 HType::HeapNumber(), | 5372 HType::HeapNumber(), |
5373 pretenure_flag, | 5373 pretenure_flag, |
5374 HEAP_NUMBER_TYPE); | 5374 HEAP_NUMBER_TYPE); |
Igor Sheludko
2014/03/27 11:30:16
MUTABLE_HEAP_NUMBER_TYPE?
| |
5375 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); | 5375 AddStoreMapConstant( |
5376 heap_number, isolate()->factory()->mutable_heap_number_map()); | |
5376 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), | 5377 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), |
5377 value); | 5378 value); |
5378 instr = New<HStoreNamedField>(checked_object->ActualValue(), | 5379 instr = New<HStoreNamedField>(checked_object->ActualValue(), |
5379 heap_number_access, | 5380 heap_number_access, |
5380 heap_number); | 5381 heap_number); |
5381 } else { | 5382 } else { |
5382 // Already holds a HeapNumber; load the box and write its value field. | 5383 // Already holds a HeapNumber; load the box and write its value field. |
5383 HInstruction* heap_number = Add<HLoadNamedField>( | 5384 HInstruction* heap_number = Add<HLoadNamedField>( |
5384 checked_object, static_cast<HValue*>(NULL), heap_number_access); | 5385 checked_object, static_cast<HValue*>(NULL), heap_number_access); |
5385 heap_number->set_type(HType::HeapNumber()); | 5386 heap_number->set_type(HType::HeapNumber()); |
(...skipping 4515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9901 HInstruction* value_instruction; | 9902 HInstruction* value_instruction; |
9902 | 9903 |
9903 if (representation.IsDouble()) { | 9904 if (representation.IsDouble()) { |
9904 // Allocate a HeapNumber box and store the value into it. | 9905 // Allocate a HeapNumber box and store the value into it. |
9905 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); | 9906 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); |
9906 // This heap number alloc does not have a corresponding | 9907 // This heap number alloc does not have a corresponding |
9907 // AllocationSite. That is okay because | 9908 // AllocationSite. That is okay because |
9908 // 1) it's a child object of another object with a valid allocation site | 9909 // 1) it's a child object of another object with a valid allocation site |
9909 // 2) we can just use the mode of the parent object for pretenuring | 9910 // 2) we can just use the mode of the parent object for pretenuring |
9910 HInstruction* double_box = | 9911 HInstruction* double_box = |
9911 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), | 9912 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), |
Igor Sheludko
2014/03/27 11:30:16
Don't we need a HType::MutableHeapNumber() thing?
| |
9912 pretenure_flag, HEAP_NUMBER_TYPE); | 9913 pretenure_flag, HEAP_NUMBER_TYPE); |
Igor Sheludko
2014/03/27 11:30:16
MUTABLE_HEAP_NUMBER_TYPE?
| |
9913 AddStoreMapConstant(double_box, | 9914 AddStoreMapConstant(double_box, |
9914 isolate()->factory()->heap_number_map()); | 9915 isolate()->factory()->mutable_heap_number_map()); |
9915 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), | 9916 // Unwrap the mutable heap number from the boilerplate. |
9916 Add<HConstant>(value)); | 9917 HValue* double_value = |
9918 Add<HConstant>(Handle<HeapNumber>::cast(value)->value()); | |
Igor Sheludko
2014/03/27 11:30:16
value->Number()
| |
9919 Add<HStoreNamedField>( | |
9920 double_box, HObjectAccess::ForHeapNumberValue(), double_value); | |
9917 value_instruction = double_box; | 9921 value_instruction = double_box; |
9918 } else if (representation.IsSmi()) { | 9922 } else if (representation.IsSmi()) { |
9919 value_instruction = value->IsUninitialized() | 9923 value_instruction = value->IsUninitialized() |
9920 ? graph()->GetConstant0() | 9924 ? graph()->GetConstant0() |
9921 : Add<HConstant>(value); | 9925 : Add<HConstant>(value); |
9922 // Ensure that value is stored as smi. | 9926 // Ensure that value is stored as smi. |
9923 access = access.WithRepresentation(representation); | 9927 access = access.WithRepresentation(representation); |
9924 } else { | 9928 } else { |
9925 value_instruction = Add<HConstant>(value); | 9929 value_instruction = Add<HConstant>(value); |
9926 } | 9930 } |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11311 if (ShouldProduceTraceOutput()) { | 11315 if (ShouldProduceTraceOutput()) { |
11312 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11316 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11313 } | 11317 } |
11314 | 11318 |
11315 #ifdef DEBUG | 11319 #ifdef DEBUG |
11316 graph_->Verify(false); // No full verify. | 11320 graph_->Verify(false); // No full verify. |
11317 #endif | 11321 #endif |
11318 } | 11322 } |
11319 | 11323 |
11320 } } // namespace v8::internal | 11324 } } // namespace v8::internal |
OLD | NEW |