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 5257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5268 value); | 5268 value); |
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 } else { |
| 5279 instr->set_can_omit_smi_tag_store(true); |
5278 } | 5280 } |
5279 return instr; | 5281 return instr; |
5280 } | 5282 } |
5281 | 5283 |
5282 | 5284 |
5283 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric( | 5285 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric( |
5284 HValue* object, | 5286 HValue* object, |
5285 Handle<String> name, | 5287 Handle<String> name, |
5286 HValue* value) { | 5288 HValue* value) { |
5287 return New<HStoreNamedGeneric>( | 5289 return New<HStoreNamedGeneric>( |
(...skipping 4180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9468 | 9470 |
9469 if (value->IsJSObject()) { | 9471 if (value->IsJSObject()) { |
9470 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 9472 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
9471 Handle<AllocationSite> current_site = site_context->EnterNewScope(); | 9473 Handle<AllocationSite> current_site = site_context->EnterNewScope(); |
9472 HInstruction* result = | 9474 HInstruction* result = |
9473 BuildFastLiteral(value_object, site_context); | 9475 BuildFastLiteral(value_object, site_context); |
9474 site_context->ExitScope(current_site, value_object); | 9476 site_context->ExitScope(current_site, value_object); |
9475 Add<HStoreNamedField>(object, access, result); | 9477 Add<HStoreNamedField>(object, access, result); |
9476 } else { | 9478 } else { |
9477 Representation representation = details.representation(); | 9479 Representation representation = details.representation(); |
9478 HInstruction* value_instruction = Add<HConstant>(value); | 9480 HInstruction* value_instruction; |
9479 | 9481 |
9480 if (representation.IsDouble()) { | 9482 if (representation.IsDouble()) { |
9481 // Allocate a HeapNumber box and store the value into it. | 9483 // Allocate a HeapNumber box and store the value into it. |
9482 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); | 9484 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); |
9483 // This heap number alloc does not have a corresponding | 9485 // This heap number alloc does not have a corresponding |
9484 // AllocationSite. That is okay because | 9486 // AllocationSite. That is okay because |
9485 // 1) it's a child object of another object with a valid allocation site | 9487 // 1) it's a child object of another object with a valid allocation site |
9486 // 2) we can just use the mode of the parent object for pretenuring | 9488 // 2) we can just use the mode of the parent object for pretenuring |
9487 HInstruction* double_box = | 9489 HInstruction* double_box = |
9488 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), | 9490 Add<HAllocate>(heap_number_constant, HType::HeapNumber(), |
9489 pretenure_flag, HEAP_NUMBER_TYPE); | 9491 pretenure_flag, HEAP_NUMBER_TYPE); |
9490 AddStoreMapConstant(double_box, | 9492 AddStoreMapConstant(double_box, |
9491 isolate()->factory()->heap_number_map()); | 9493 isolate()->factory()->heap_number_map()); |
9492 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), | 9494 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), |
9493 value_instruction); | 9495 Add<HConstant>(value)); |
9494 value_instruction = double_box; | 9496 value_instruction = double_box; |
| 9497 } else if (representation.IsSmi() && value->IsUninitialized()) { |
| 9498 value_instruction = graph()->GetConstant0(); |
| 9499 } else { |
| 9500 value_instruction = Add<HConstant>(value); |
9495 } | 9501 } |
9496 | 9502 |
9497 Add<HStoreNamedField>(object, access, value_instruction); | 9503 Add<HStoreNamedField>(object, access, value_instruction); |
9498 } | 9504 } |
9499 } | 9505 } |
9500 | 9506 |
9501 int inobject_properties = boilerplate_object->map()->inobject_properties(); | 9507 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
9502 HInstruction* value_instruction = | 9508 HInstruction* value_instruction = |
9503 Add<HConstant>(isolate()->factory()->one_pointer_filler_map()); | 9509 Add<HConstant>(isolate()->factory()->one_pointer_filler_map()); |
9504 for (int i = copied_fields; i < inobject_properties; i++) { | 9510 for (int i = copied_fields; i < inobject_properties; i++) { |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10811 if (ShouldProduceTraceOutput()) { | 10817 if (ShouldProduceTraceOutput()) { |
10812 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10818 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10813 } | 10819 } |
10814 | 10820 |
10815 #ifdef DEBUG | 10821 #ifdef DEBUG |
10816 graph_->Verify(false); // No full verify. | 10822 graph_->Verify(false); // No full verify. |
10817 #endif | 10823 #endif |
10818 } | 10824 } |
10819 | 10825 |
10820 } } // namespace v8::internal | 10826 } } // namespace v8::internal |
OLD | NEW |