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