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

Side by Side Diff: src/hydrogen.cc

Issue 334323003: Reland r22082 "Replace HeapNumber as doublebox with an explicit MutableHeapNumber." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Migrations test fixed Created 6 years, 5 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 | « src/heap-snapshot-generator.cc ('k') | src/ia32/macro-assembler-ia32.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 <algorithm> 7 #include <algorithm>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 5763 matching lines...) Expand 10 before | Expand all | Expand 10 after
5774 field_access.WithRepresentation(Representation::Tagged()); 5774 field_access.WithRepresentation(Representation::Tagged());
5775 if (transition_to_field) { 5775 if (transition_to_field) {
5776 // The store requires a mutable HeapNumber to be allocated. 5776 // The store requires a mutable HeapNumber to be allocated.
5777 NoObservableSideEffectsScope no_side_effects(this); 5777 NoObservableSideEffectsScope no_side_effects(this);
5778 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); 5778 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
5779 5779
5780 // TODO(hpayer): Allocation site pretenuring support. 5780 // TODO(hpayer): Allocation site pretenuring support.
5781 HInstruction* heap_number = Add<HAllocate>(heap_number_size, 5781 HInstruction* heap_number = Add<HAllocate>(heap_number_size,
5782 HType::HeapObject(), 5782 HType::HeapObject(),
5783 NOT_TENURED, 5783 NOT_TENURED,
5784 HEAP_NUMBER_TYPE); 5784 MUTABLE_HEAP_NUMBER_TYPE);
5785 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); 5785 AddStoreMapConstant(
5786 heap_number, isolate()->factory()->mutable_heap_number_map());
5786 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), 5787 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
5787 value); 5788 value);
5788 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5789 instr = New<HStoreNamedField>(checked_object->ActualValue(),
5789 heap_number_access, 5790 heap_number_access,
5790 heap_number); 5791 heap_number);
5791 } else { 5792 } else {
5792 // Already holds a HeapNumber; load the box and write its value field. 5793 // Already holds a HeapNumber; load the box and write its value field.
5793 HInstruction* heap_number = Add<HLoadNamedField>( 5794 HInstruction* heap_number = Add<HLoadNamedField>(
5794 checked_object, static_cast<HValue*>(NULL), heap_number_access); 5795 checked_object, static_cast<HValue*>(NULL), heap_number_access);
5795 instr = New<HStoreNamedField>(heap_number, 5796 instr = New<HStoreNamedField>(heap_number,
(...skipping 5150 matching lines...) Expand 10 before | Expand all | Expand 10 after
10946 10947
10947 if (representation.IsDouble()) { 10948 if (representation.IsDouble()) {
10948 // Allocate a HeapNumber box and store the value into it. 10949 // Allocate a HeapNumber box and store the value into it.
10949 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); 10950 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize);
10950 // This heap number alloc does not have a corresponding 10951 // This heap number alloc does not have a corresponding
10951 // AllocationSite. That is okay because 10952 // AllocationSite. That is okay because
10952 // 1) it's a child object of another object with a valid allocation site 10953 // 1) it's a child object of another object with a valid allocation site
10953 // 2) we can just use the mode of the parent object for pretenuring 10954 // 2) we can just use the mode of the parent object for pretenuring
10954 HInstruction* double_box = 10955 HInstruction* double_box =
10955 Add<HAllocate>(heap_number_constant, HType::HeapObject(), 10956 Add<HAllocate>(heap_number_constant, HType::HeapObject(),
10956 pretenure_flag, HEAP_NUMBER_TYPE); 10957 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE);
10957 AddStoreMapConstant(double_box, 10958 AddStoreMapConstant(double_box,
10958 isolate()->factory()->heap_number_map()); 10959 isolate()->factory()->mutable_heap_number_map());
10959 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), 10960 // Unwrap the mutable heap number from the boilerplate.
10960 Add<HConstant>(value)); 10961 HValue* double_value =
10962 Add<HConstant>(Handle<HeapNumber>::cast(value)->value());
10963 Add<HStoreNamedField>(
10964 double_box, HObjectAccess::ForHeapNumberValue(), double_value);
10961 value_instruction = double_box; 10965 value_instruction = double_box;
10962 } else if (representation.IsSmi()) { 10966 } else if (representation.IsSmi()) {
10963 value_instruction = value->IsUninitialized() 10967 value_instruction = value->IsUninitialized()
10964 ? graph()->GetConstant0() 10968 ? graph()->GetConstant0()
10965 : Add<HConstant>(value); 10969 : Add<HConstant>(value);
10966 // Ensure that value is stored as smi. 10970 // Ensure that value is stored as smi.
10967 access = access.WithRepresentation(representation); 10971 access = access.WithRepresentation(representation);
10968 } else { 10972 } else {
10969 value_instruction = Add<HConstant>(value); 10973 value_instruction = Add<HConstant>(value);
10970 } 10974 }
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
12375 if (ShouldProduceTraceOutput()) { 12379 if (ShouldProduceTraceOutput()) {
12376 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12380 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12377 } 12381 }
12378 12382
12379 #ifdef DEBUG 12383 #ifdef DEBUG
12380 graph_->Verify(false); // No full verify. 12384 graph_->Verify(false); // No full verify.
12381 #endif 12385 #endif
12382 } 12386 }
12383 12387
12384 } } // namespace v8::internal 12388 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698