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

Side by Side Diff: src/hydrogen.cc

Issue 211333002: Replace HeapNumber as doublebox with an explicit MutableHeapNumber. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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
OLDNEW
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 5358 matching lines...) Expand 10 before | Expand all | Expand 10 after
5369 field_access.WithRepresentation(Representation::Tagged()); 5369 field_access.WithRepresentation(Representation::Tagged());
5370 if (transition_to_field) { 5370 if (transition_to_field) {
5371 // The store requires a mutable HeapNumber to be allocated. 5371 // The store requires a mutable HeapNumber to be allocated.
5372 NoObservableSideEffectsScope no_side_effects(this); 5372 NoObservableSideEffectsScope no_side_effects(this);
5373 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); 5373 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
5374 5374
5375 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? 5375 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ?
5376 isolate()->heap()->GetPretenureMode() : NOT_TENURED; 5376 isolate()->heap()->GetPretenureMode() : NOT_TENURED;
5377 5377
5378 HInstruction* heap_number = Add<HAllocate>(heap_number_size, 5378 HInstruction* heap_number = Add<HAllocate>(heap_number_size,
5379 HType::HeapNumber(), 5379 HType::Tagged(),
5380 pretenure_flag, 5380 pretenure_flag,
5381 HEAP_NUMBER_TYPE); 5381 MUTABLE_HEAP_NUMBER_TYPE);
5382 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); 5382 AddStoreMapConstant(
5383 heap_number, isolate()->factory()->mutable_heap_number_map());
5383 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), 5384 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
5384 value); 5385 value);
5385 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5386 instr = New<HStoreNamedField>(checked_object->ActualValue(),
5386 heap_number_access, 5387 heap_number_access,
5387 heap_number); 5388 heap_number);
5388 } else { 5389 } else {
5389 // Already holds a HeapNumber; load the box and write its value field. 5390 // Already holds a HeapNumber; load the box and write its value field.
5390 HInstruction* heap_number = Add<HLoadNamedField>( 5391 HInstruction* heap_number = Add<HLoadNamedField>(
5391 checked_object, static_cast<HValue*>(NULL), heap_number_access); 5392 checked_object, static_cast<HValue*>(NULL), heap_number_access);
5392 heap_number->set_type(HType::HeapNumber()); 5393 heap_number->set_type(HType::HeapNumber());
(...skipping 4697 matching lines...) Expand 10 before | Expand all | Expand 10 after
10090 HInstruction* value_instruction; 10091 HInstruction* value_instruction;
10091 10092
10092 if (representation.IsDouble()) { 10093 if (representation.IsDouble()) {
10093 // Allocate a HeapNumber box and store the value into it. 10094 // Allocate a HeapNumber box and store the value into it.
10094 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); 10095 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize);
10095 // This heap number alloc does not have a corresponding 10096 // This heap number alloc does not have a corresponding
10096 // AllocationSite. That is okay because 10097 // AllocationSite. That is okay because
10097 // 1) it's a child object of another object with a valid allocation site 10098 // 1) it's a child object of another object with a valid allocation site
10098 // 2) we can just use the mode of the parent object for pretenuring 10099 // 2) we can just use the mode of the parent object for pretenuring
10099 HInstruction* double_box = 10100 HInstruction* double_box =
10100 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), 10101 Add<HAllocate>(heap_number_constant, HType::Tagged(),
10101 pretenure_flag, HEAP_NUMBER_TYPE); 10102 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE);
10102 AddStoreMapConstant(double_box, 10103 AddStoreMapConstant(double_box,
10103 isolate()->factory()->heap_number_map()); 10104 isolate()->factory()->mutable_heap_number_map());
10104 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), 10105 // Unwrap the mutable heap number from the boilerplate.
10105 Add<HConstant>(value)); 10106 HValue* double_value =
10107 Add<HConstant>(Handle<HeapNumber>::cast(value)->value());
10108 Add<HStoreNamedField>(
10109 double_box, HObjectAccess::ForHeapNumberValue(), double_value);
10106 value_instruction = double_box; 10110 value_instruction = double_box;
10107 } else if (representation.IsSmi()) { 10111 } else if (representation.IsSmi()) {
10108 value_instruction = value->IsUninitialized() 10112 value_instruction = value->IsUninitialized()
10109 ? graph()->GetConstant0() 10113 ? graph()->GetConstant0()
10110 : Add<HConstant>(value); 10114 : Add<HConstant>(value);
10111 // Ensure that value is stored as smi. 10115 // Ensure that value is stored as smi.
10112 access = access.WithRepresentation(representation); 10116 access = access.WithRepresentation(representation);
10113 } else { 10117 } else {
10114 value_instruction = Add<HConstant>(value); 10118 value_instruction = Add<HConstant>(value);
10115 } 10119 }
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
11500 if (ShouldProduceTraceOutput()) { 11504 if (ShouldProduceTraceOutput()) {
11501 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11505 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11502 } 11506 }
11503 11507
11504 #ifdef DEBUG 11508 #ifdef DEBUG
11505 graph_->Verify(false); // No full verify. 11509 graph_->Verify(false); // No full verify.
11506 #endif 11510 #endif
11507 } 11511 }
11508 11512
11509 } } // namespace v8::internal 11513 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen-instructions.h » ('j') | src/json-parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698