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 5245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5256 // Already holds a HeapNumber; load the box and write its value field. | 5256 // Already holds a HeapNumber; load the box and write its value field. |
5257 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, | 5257 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, |
5258 heap_number_access); | 5258 heap_number_access); |
5259 heap_number->set_type(HType::HeapNumber()); | 5259 heap_number->set_type(HType::HeapNumber()); |
5260 instr = New<HStoreNamedField>(heap_number, | 5260 instr = New<HStoreNamedField>(heap_number, |
5261 HObjectAccess::ForHeapNumberValue(), | 5261 HObjectAccess::ForHeapNumberValue(), |
5262 value); | 5262 value); |
5263 } | 5263 } |
5264 } else { | 5264 } else { |
5265 // This is a normal store. | 5265 // This is a normal store. |
5266 instr = New<HStoreNamedField>(checked_object->ActualValue(), | 5266 instr = New<HStoreNamedField>( |
5267 field_access, | 5267 checked_object->ActualValue(), field_access, value, |
5268 value); | 5268 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY); |
5269 } | 5269 } |
5270 | 5270 |
5271 if (transition_to_field) { | 5271 if (transition_to_field) { |
5272 Handle<Map> transition(lookup->GetTransitionMapFromMap(*map)); | 5272 Handle<Map> transition(lookup->GetTransitionMapFromMap(*map)); |
5273 HConstant* transition_constant = Add<HConstant>(transition); | 5273 HConstant* transition_constant = Add<HConstant>(transition); |
5274 instr->SetTransition(transition_constant, top_info()); | 5274 instr->SetTransition(transition_constant, top_info()); |
5275 // TODO(fschneider): Record the new map type of the object in the IR to | 5275 // TODO(fschneider): Record the new map type of the object in the IR to |
5276 // enable elimination of redundant checks after the transition store. | 5276 // enable elimination of redundant checks after the transition store. |
5277 instr->SetGVNFlag(kChangesMaps); | 5277 instr->SetGVNFlag(kChangesMaps); |
5278 } | 5278 } |
(...skipping 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9469 | 9469 |
9470 if (value->IsJSObject()) { | 9470 if (value->IsJSObject()) { |
9471 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 9471 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
9472 Handle<AllocationSite> current_site = site_context->EnterNewScope(); | 9472 Handle<AllocationSite> current_site = site_context->EnterNewScope(); |
9473 HInstruction* result = | 9473 HInstruction* result = |
9474 BuildFastLiteral(value_object, site_context); | 9474 BuildFastLiteral(value_object, site_context); |
9475 site_context->ExitScope(current_site, value_object); | 9475 site_context->ExitScope(current_site, value_object); |
9476 Add<HStoreNamedField>(object, access, result); | 9476 Add<HStoreNamedField>(object, access, result); |
9477 } else { | 9477 } else { |
9478 Representation representation = details.representation(); | 9478 Representation representation = details.representation(); |
9479 HInstruction* value_instruction = Add<HConstant>(value); | 9479 HInstruction* value_instruction; |
9480 | 9480 |
9481 if (representation.IsDouble()) { | 9481 if (representation.IsDouble()) { |
9482 // Allocate a HeapNumber box and store the value into it. | 9482 // Allocate a HeapNumber box and store the value into it. |
9483 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); | 9483 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); |
9484 // This heap number alloc does not have a corresponding | 9484 // This heap number alloc does not have a corresponding |
9485 // AllocationSite. That is okay because | 9485 // AllocationSite. That is okay because |
9486 // 1) it's a child object of another object with a valid allocation site | 9486 // 1) it's a child object of another object with a valid allocation site |
9487 // 2) we can just use the mode of the parent object for pretenuring | 9487 // 2) we can just use the mode of the parent object for pretenuring |
9488 HInstruction* double_box = | 9488 HInstruction* double_box = |
9489 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), | 9489 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), |
9490 pretenure_flag, HEAP_NUMBER_TYPE); | 9490 pretenure_flag, HEAP_NUMBER_TYPE); |
9491 AddStoreMapConstant(double_box, | 9491 AddStoreMapConstant(double_box, |
9492 isolate()->factory()->heap_number_map()); | 9492 isolate()->factory()->heap_number_map()); |
9493 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), | 9493 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), |
9494 value_instruction); | 9494 Add<HConstant>(value)); |
9495 value_instruction = double_box; | 9495 value_instruction = double_box; |
| 9496 } else if (representation.IsSmi() && value->IsUninitialized()) { |
| 9497 value_instruction = graph()->GetConstant0(); |
| 9498 } else { |
| 9499 value_instruction = Add<HConstant>(value); |
9496 } | 9500 } |
9497 | 9501 |
9498 Add<HStoreNamedField>(object, access, value_instruction); | 9502 Add<HStoreNamedField>(object, access, value_instruction); |
9499 } | 9503 } |
9500 } | 9504 } |
9501 | 9505 |
9502 int inobject_properties = boilerplate_object->map()->inobject_properties(); | 9506 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
9503 HInstruction* value_instruction = | 9507 HInstruction* value_instruction = |
9504 Add<HConstant>(isolate()->factory()->one_pointer_filler_map()); | 9508 Add<HConstant>(isolate()->factory()->one_pointer_filler_map()); |
9505 for (int i = copied_fields; i < inobject_properties; i++) { | 9509 for (int i = copied_fields; i < inobject_properties; i++) { |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10813 if (ShouldProduceTraceOutput()) { | 10817 if (ShouldProduceTraceOutput()) { |
10814 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10818 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10815 } | 10819 } |
10816 | 10820 |
10817 #ifdef DEBUG | 10821 #ifdef DEBUG |
10818 graph_->Verify(false); // No full verify. | 10822 graph_->Verify(false); // No full verify. |
10819 #endif | 10823 #endif |
10820 } | 10824 } |
10821 | 10825 |
10822 } } // namespace v8::internal | 10826 } } // namespace v8::internal |
OLD | NEW |