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

Side by Side Diff: src/hydrogen.cc

Issue 15094018: Create AllocationSite objects, pointed to by AllocationSiteInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response Created 7 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/hydrogen.h ('k') | src/hydrogen-instructions.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 // 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 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 if (!pre_fill_with_holes && length != capacity) { 1590 if (!pre_fill_with_holes && length != capacity) {
1591 // Fill unused capacity with the hole. 1591 // Fill unused capacity with the hole.
1592 BuildFillElementsWithHole(context, to_elements, to_elements_kind, 1592 BuildFillElementsWithHole(context, to_elements, to_elements_kind,
1593 key, capacity); 1593 key, capacity);
1594 } 1594 }
1595 } 1595 }
1596 1596
1597 1597
1598 HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context, 1598 HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
1599 HValue* boilerplate, 1599 HValue* boilerplate,
1600 HValue* allocation_site,
1600 AllocationSiteMode mode, 1601 AllocationSiteMode mode,
1601 ElementsKind kind, 1602 ElementsKind kind,
1602 int length) { 1603 int length) {
1603 NoObservableSideEffectsScope no_effects(this); 1604 NoObservableSideEffectsScope no_effects(this);
1604 1605
1605 // All sizes here are multiples of kPointerSize. 1606 // All sizes here are multiples of kPointerSize.
1606 int size = JSArray::kSize; 1607 int size = JSArray::kSize;
1607 if (mode == TRACK_ALLOCATION_SITE) { 1608 if (mode == TRACK_ALLOCATION_SITE) {
1608 size += AllocationSiteInfo::kSize; 1609 size += AllocationSiteInfo::kSize;
1609 } 1610 }
(...skipping 16 matching lines...) Expand all
1626 // Copy the JS array part. 1627 // Copy the JS array part.
1627 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 1628 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
1628 if ((i != JSArray::kElementsOffset) || (length == 0)) { 1629 if ((i != JSArray::kElementsOffset) || (length == 0)) {
1629 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i); 1630 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i);
1630 AddStore(object, access, AddLoad(boilerplate, access)); 1631 AddStore(object, access, AddLoad(boilerplate, access));
1631 } 1632 }
1632 } 1633 }
1633 1634
1634 // Create an allocation site info if requested. 1635 // Create an allocation site info if requested.
1635 if (mode == TRACK_ALLOCATION_SITE) { 1636 if (mode == TRACK_ALLOCATION_SITE) {
1636 BuildCreateAllocationSiteInfo(object, JSArray::kSize, boilerplate); 1637 BuildCreateAllocationSiteInfo(object, JSArray::kSize, allocation_site);
1637 } 1638 }
1638 1639
1639 if (length > 0) { 1640 if (length > 0) {
1640 // Get hold of the elements array of the boilerplate and setup the 1641 // Get hold of the elements array of the boilerplate and setup the
1641 // elements pointer in the resulting object. 1642 // elements pointer in the resulting object.
1642 HValue* boilerplate_elements = AddLoadElements(boilerplate); 1643 HValue* boilerplate_elements = AddLoadElements(boilerplate);
1643 HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset); 1644 HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset);
1644 AddStore(object, HObjectAccess::ForElementsPointer(), object_elements); 1645 AddStore(object, HObjectAccess::ForElementsPointer(), object_elements);
1645 1646
1646 // Copy the elements array header. 1647 // Copy the elements array header.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 if_nil.Deopt(); 1734 if_nil.Deopt();
1734 } 1735 }
1735 } 1736 }
1736 1737
1737 if_nil.CaptureContinuation(continuation); 1738 if_nil.CaptureContinuation(continuation);
1738 } 1739 }
1739 1740
1740 1741
1741 HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object, 1742 HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object,
1742 int previous_object_size, 1743 int previous_object_size,
1743 HValue* payload) { 1744 HValue* alloc_site) {
1744 HInnerAllocatedObject* alloc_site = Add<HInnerAllocatedObject>( 1745 ASSERT(alloc_site != NULL);
1746 HInnerAllocatedObject* alloc_site_info = Add<HInnerAllocatedObject>(
1745 previous_object, previous_object_size); 1747 previous_object, previous_object_size);
1746 Handle<Map> alloc_site_map(isolate()->heap()->allocation_site_info_map()); 1748 Handle<Map> alloc_site_info_map(
1747 AddStoreMapConstant(alloc_site, alloc_site_map); 1749 isolate()->heap()->allocation_site_info_map());
1748 HObjectAccess access = HObjectAccess::ForAllocationSitePayload(); 1750 AddStoreMapConstant(alloc_site_info, alloc_site_info_map);
1749 AddStore(alloc_site, access, payload); 1751 HObjectAccess access = HObjectAccess::ForAllocationSiteInfoSite();
1750 return alloc_site; 1752 AddStore(alloc_site_info, access, alloc_site);
1753 return alloc_site_info;
1751 } 1754 }
1752 1755
1753 1756
1754 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) { 1757 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) {
1755 // Get the global context, then the native context 1758 // Get the global context, then the native context
1756 HInstruction* global_object = Add<HGlobalObject>(context); 1759 HInstruction* global_object = Add<HGlobalObject>(context);
1757 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 1760 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
1758 GlobalObject::kNativeContextOffset); 1761 GlobalObject::kNativeContextOffset);
1759 return AddLoad(global_object, access); 1762 return AddLoad(global_object, access);
1760 } 1763 }
(...skipping 12 matching lines...) Expand all
1773 ElementsKind kind, 1776 ElementsKind kind,
1774 HValue* allocation_site_payload, 1777 HValue* allocation_site_payload,
1775 HValue* constructor_function, 1778 HValue* constructor_function,
1776 AllocationSiteOverrideMode override_mode) : 1779 AllocationSiteOverrideMode override_mode) :
1777 builder_(builder), 1780 builder_(builder),
1778 kind_(kind), 1781 kind_(kind),
1779 allocation_site_payload_(allocation_site_payload), 1782 allocation_site_payload_(allocation_site_payload),
1780 constructor_function_(constructor_function) { 1783 constructor_function_(constructor_function) {
1781 mode_ = override_mode == DISABLE_ALLOCATION_SITES 1784 mode_ = override_mode == DISABLE_ALLOCATION_SITES
1782 ? DONT_TRACK_ALLOCATION_SITE 1785 ? DONT_TRACK_ALLOCATION_SITE
1783 : AllocationSiteInfo::GetMode(kind); 1786 : AllocationSite::GetMode(kind);
1784 } 1787 }
1785 1788
1786 1789
1787 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, 1790 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
1788 ElementsKind kind, 1791 ElementsKind kind,
1789 HValue* constructor_function) : 1792 HValue* constructor_function) :
1790 builder_(builder), 1793 builder_(builder),
1791 kind_(kind), 1794 kind_(kind),
1792 mode_(DONT_TRACK_ALLOCATION_SITE), 1795 mode_(DONT_TRACK_ALLOCATION_SITE),
1793 allocation_site_payload_(NULL), 1796 allocation_site_payload_(NULL),
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4517 &data_size, 4520 &data_size,
4518 &pointer_size)) { 4521 &pointer_size)) {
4519 Handle<JSObject> original_boilerplate_object = 4522 Handle<JSObject> original_boilerplate_object =
4520 Handle<JSObject>::cast(original_boilerplate); 4523 Handle<JSObject>::cast(original_boilerplate);
4521 Handle<JSObject> boilerplate_object = 4524 Handle<JSObject> boilerplate_object =
4522 DeepCopy(original_boilerplate_object); 4525 DeepCopy(original_boilerplate_object);
4523 4526
4524 literal = BuildFastLiteral(context, 4527 literal = BuildFastLiteral(context,
4525 boilerplate_object, 4528 boilerplate_object,
4526 original_boilerplate_object, 4529 original_boilerplate_object,
4530 Handle<Object>::null(),
4527 data_size, 4531 data_size,
4528 pointer_size, 4532 pointer_size,
4529 DONT_TRACK_ALLOCATION_SITE); 4533 DONT_TRACK_ALLOCATION_SITE);
4530 } else { 4534 } else {
4531 NoObservableSideEffectsScope no_effects(this); 4535 NoObservableSideEffectsScope no_effects(this);
4532 Handle<FixedArray> closure_literals(closure->literals(), isolate()); 4536 Handle<FixedArray> closure_literals(closure->literals(), isolate());
4533 Handle<FixedArray> constant_properties = expr->constant_properties(); 4537 Handle<FixedArray> constant_properties = expr->constant_properties();
4534 int literal_index = expr->literal_index(); 4538 int literal_index = expr->literal_index();
4535 int flags = expr->fast_elements() 4539 int flags = expr->fast_elements()
4536 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; 4540 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 4628
4625 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { 4629 void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
4626 ASSERT(!HasStackOverflow()); 4630 ASSERT(!HasStackOverflow());
4627 ASSERT(current_block() != NULL); 4631 ASSERT(current_block() != NULL);
4628 ASSERT(current_block()->HasPredecessor()); 4632 ASSERT(current_block()->HasPredecessor());
4629 ZoneList<Expression*>* subexprs = expr->values(); 4633 ZoneList<Expression*>* subexprs = expr->values();
4630 int length = subexprs->length(); 4634 int length = subexprs->length();
4631 HValue* context = environment()->LookupContext(); 4635 HValue* context = environment()->LookupContext();
4632 HInstruction* literal; 4636 HInstruction* literal;
4633 4637
4638 Handle<AllocationSite> site;
4634 Handle<FixedArray> literals(environment()->closure()->literals(), isolate()); 4639 Handle<FixedArray> literals(environment()->closure()->literals(), isolate());
4635 Handle<Object> raw_boilerplate(literals->get(expr->literal_index()),
4636 isolate());
4637
4638 bool uninitialized = false; 4640 bool uninitialized = false;
4639 if (raw_boilerplate->IsUndefined()) { 4641 Handle<Object> literals_cell(literals->get(expr->literal_index()),
4642 isolate());
4643 Handle<Object> raw_boilerplate;
4644 if (literals_cell->IsUndefined()) {
4640 uninitialized = true; 4645 uninitialized = true;
4641 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate( 4646 raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
4642 isolate(), literals, expr->constant_elements()); 4647 isolate(), literals, expr->constant_elements());
4643 if (raw_boilerplate.is_null()) { 4648 if (raw_boilerplate.is_null()) {
4644 return Bailout("array boilerplate creation failed"); 4649 return Bailout("array boilerplate creation failed");
4645 } 4650 }
4646 literals->set(expr->literal_index(), *raw_boilerplate); 4651
4652 site = isolate()->factory()->NewAllocationSite();
4653 site->set_payload(*raw_boilerplate);
4654 literals->set(expr->literal_index(), *site);
4655
4647 if (JSObject::cast(*raw_boilerplate)->elements()->map() == 4656 if (JSObject::cast(*raw_boilerplate)->elements()->map() ==
4648 isolate()->heap()->fixed_cow_array_map()) { 4657 isolate()->heap()->fixed_cow_array_map()) {
4649 isolate()->counters()->cow_arrays_created_runtime()->Increment(); 4658 isolate()->counters()->cow_arrays_created_runtime()->Increment();
4650 } 4659 }
4660 } else {
4661 ASSERT(literals_cell->IsAllocationSite());
4662 site = Handle<AllocationSite>::cast(literals_cell);
4663 raw_boilerplate = Handle<Object>(site->payload(), isolate());
4651 } 4664 }
4652 4665
4666 ASSERT(!raw_boilerplate.is_null());
4667 ASSERT(site->IsLiteralSite());
4668
4653 Handle<JSObject> original_boilerplate_object = 4669 Handle<JSObject> original_boilerplate_object =
4654 Handle<JSObject>::cast(raw_boilerplate); 4670 Handle<JSObject>::cast(raw_boilerplate);
4655 ElementsKind boilerplate_elements_kind = 4671 ElementsKind boilerplate_elements_kind =
4656 Handle<JSObject>::cast(original_boilerplate_object)->GetElementsKind(); 4672 Handle<JSObject>::cast(original_boilerplate_object)->GetElementsKind();
4657 4673
4658 // TODO(mvstanton): This heuristic is only a temporary solution. In the 4674 // TODO(mvstanton): This heuristic is only a temporary solution. In the
4659 // end, we want to quit creating allocation site info after a certain number 4675 // end, we want to quit creating allocation site info after a certain number
4660 // of GCs for a call site. 4676 // of GCs for a call site.
4661 AllocationSiteMode mode = AllocationSiteInfo::GetMode( 4677 AllocationSiteMode mode = AllocationSite::GetMode(
4662 boilerplate_elements_kind); 4678 boilerplate_elements_kind);
4663 4679
4664 // Check whether to use fast or slow deep-copying for boilerplate. 4680 // Check whether to use fast or slow deep-copying for boilerplate.
4665 int data_size = 0; 4681 int data_size = 0;
4666 int pointer_size = 0; 4682 int pointer_size = 0;
4667 int max_properties = kMaxFastLiteralProperties; 4683 int max_properties = kMaxFastLiteralProperties;
4668 if (IsFastLiteral(original_boilerplate_object, 4684 if (IsFastLiteral(original_boilerplate_object,
4669 kMaxFastLiteralDepth, 4685 kMaxFastLiteralDepth,
4670 &max_properties, 4686 &max_properties,
4671 &data_size, 4687 &data_size,
4672 &pointer_size)) { 4688 &pointer_size)) {
4673 if (mode == TRACK_ALLOCATION_SITE) { 4689 if (mode == TRACK_ALLOCATION_SITE) {
4674 pointer_size += AllocationSiteInfo::kSize; 4690 pointer_size += AllocationSiteInfo::kSize;
4675 } 4691 }
4676 4692
4677 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); 4693 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object);
4678 literal = BuildFastLiteral(context, 4694 literal = BuildFastLiteral(context,
4679 boilerplate_object, 4695 boilerplate_object,
4680 original_boilerplate_object, 4696 original_boilerplate_object,
4697 site,
4681 data_size, 4698 data_size,
4682 pointer_size, 4699 pointer_size,
4683 mode); 4700 mode);
4684 } else { 4701 } else {
4685 NoObservableSideEffectsScope no_effects(this); 4702 NoObservableSideEffectsScope no_effects(this);
4686 // Boilerplate already exists and constant elements are never accessed, 4703 // Boilerplate already exists and constant elements are never accessed,
4687 // pass an empty fixed array to the runtime function instead. 4704 // pass an empty fixed array to the runtime function instead.
4688 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); 4705 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array();
4689 int literal_index = expr->literal_index(); 4706 int literal_index = expr->literal_index();
4690 4707
(...skipping 3806 matching lines...) Expand 10 before | Expand all | Expand 10 after
8497 } else { 8514 } else {
8498 return new(zone()) HThisFunction; 8515 return new(zone()) HThisFunction;
8499 } 8516 }
8500 } 8517 }
8501 8518
8502 8519
8503 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( 8520 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
8504 HValue* context, 8521 HValue* context,
8505 Handle<JSObject> boilerplate_object, 8522 Handle<JSObject> boilerplate_object,
8506 Handle<JSObject> original_boilerplate_object, 8523 Handle<JSObject> original_boilerplate_object,
8524 Handle<Object> allocation_site,
8507 int data_size, 8525 int data_size,
8508 int pointer_size, 8526 int pointer_size,
8509 AllocationSiteMode mode) { 8527 AllocationSiteMode mode) {
8510 NoObservableSideEffectsScope no_effects(this); 8528 NoObservableSideEffectsScope no_effects(this);
8511 8529
8512 HInstruction* target = NULL; 8530 HInstruction* target = NULL;
8513 HInstruction* data_target = NULL; 8531 HInstruction* data_target = NULL;
8514 8532
8515 HAllocate::Flags flags = HAllocate::DefaultFlags(); 8533 HAllocate::Flags flags = HAllocate::DefaultFlags();
8516 8534
(...skipping 17 matching lines...) Expand all
8534 HValue* size_in_bytes = Add<HConstant>(pointer_size); 8552 HValue* size_in_bytes = Add<HConstant>(pointer_size);
8535 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); 8553 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags);
8536 } 8554 }
8537 } else { 8555 } else {
8538 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); 8556 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size);
8539 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); 8557 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags);
8540 } 8558 }
8541 8559
8542 int offset = 0; 8560 int offset = 0;
8543 int data_offset = 0; 8561 int data_offset = 0;
8544 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, target, 8562 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object,
8545 &offset, data_target, &data_offset, mode); 8563 allocation_site, target, &offset, data_target,
8564 &data_offset, mode);
8546 return target; 8565 return target;
8547 } 8566 }
8548 8567
8549 8568
8550 void HOptimizedGraphBuilder::BuildEmitDeepCopy( 8569 void HOptimizedGraphBuilder::BuildEmitDeepCopy(
8551 Handle<JSObject> boilerplate_object, 8570 Handle<JSObject> boilerplate_object,
8552 Handle<JSObject> original_boilerplate_object, 8571 Handle<JSObject> original_boilerplate_object,
8572 Handle<Object> allocation_site_object,
8553 HInstruction* target, 8573 HInstruction* target,
8554 int* offset, 8574 int* offset,
8555 HInstruction* data_target, 8575 HInstruction* data_target,
8556 int* data_offset, 8576 int* data_offset,
8557 AllocationSiteMode mode) { 8577 AllocationSiteMode mode) {
8578 Zone* zone = this->zone();
8579
8580 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE &&
8581 boilerplate_object->map()->CanTrackAllocationSite();
8582
8583 // If using allocation sites, then the payload on the site should already
8584 // be filled in as a valid (boilerplate) array.
8585 ASSERT(!create_allocation_site_info ||
8586 AllocationSite::cast(*allocation_site_object)->IsLiteralSite());
8587
8588 HInstruction* allocation_site = NULL;
8589
8590 if (create_allocation_site_info) {
8591 allocation_site = AddInstruction(new(zone) HConstant(
8592 allocation_site_object, Representation::Tagged()));
8593 }
8594
8595 // Only elements backing stores for non-COW arrays need to be copied.
8558 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 8596 Handle<FixedArrayBase> elements(boilerplate_object->elements());
8559 Handle<FixedArrayBase> original_elements( 8597 Handle<FixedArrayBase> original_elements(
8560 original_boilerplate_object->elements()); 8598 original_boilerplate_object->elements());
8561 ElementsKind kind = boilerplate_object->map()->elements_kind(); 8599 ElementsKind kind = boilerplate_object->map()->elements_kind();
8562 8600
8563 int object_offset = *offset; 8601 int object_offset = *offset;
8564 int object_size = boilerplate_object->map()->instance_size(); 8602 int object_size = boilerplate_object->map()->instance_size();
8565 int elements_size = (elements->length() > 0 && 8603 int elements_size = (elements->length() > 0 &&
8566 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? 8604 elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
8567 elements->Size() : 0; 8605 elements->Size() : 0;
(...skipping 25 matching lines...) Expand all
8593 Add<HInnerAllocatedObject>(target, object_offset); 8631 Add<HInnerAllocatedObject>(target, object_offset);
8594 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, 8632 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object,
8595 object_properties, target, offset, data_target, data_offset); 8633 object_properties, target, offset, data_target, data_offset);
8596 } 8634 }
8597 8635
8598 // Create allocation site info. 8636 // Create allocation site info.
8599 if (mode == TRACK_ALLOCATION_SITE && 8637 if (mode == TRACK_ALLOCATION_SITE &&
8600 boilerplate_object->map()->CanTrackAllocationSite()) { 8638 boilerplate_object->map()->CanTrackAllocationSite()) {
8601 elements_offset += AllocationSiteInfo::kSize; 8639 elements_offset += AllocationSiteInfo::kSize;
8602 *offset += AllocationSiteInfo::kSize; 8640 *offset += AllocationSiteInfo::kSize;
8603 HInstruction* original_boilerplate = 8641 BuildCreateAllocationSiteInfo(target, JSArray::kSize, allocation_site);
8604 Add<HConstant>(original_boilerplate_object);
8605 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate);
8606 } 8642 }
8607 } 8643 }
8608 8644
8609 8645
8610 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( 8646 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader(
8611 Handle<JSObject> boilerplate_object, 8647 Handle<JSObject> boilerplate_object,
8612 HInstruction* target, 8648 HInstruction* target,
8613 HInstruction* data_target, 8649 HInstruction* data_target,
8614 int object_offset, 8650 int object_offset,
8615 int elements_offset, 8651 int elements_offset,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
8693 8729
8694 if (value->IsJSObject()) { 8730 if (value->IsJSObject()) {
8695 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 8731 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
8696 Handle<JSObject> original_value_object = Handle<JSObject>::cast( 8732 Handle<JSObject> original_value_object = Handle<JSObject>::cast(
8697 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), 8733 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index),
8698 isolate())); 8734 isolate()));
8699 HInstruction* value_instruction = Add<HInnerAllocatedObject>(target, 8735 HInstruction* value_instruction = Add<HInnerAllocatedObject>(target,
8700 *offset); 8736 *offset);
8701 8737
8702 AddStore(object_properties, access, value_instruction); 8738 AddStore(object_properties, access, value_instruction);
8703 8739 BuildEmitDeepCopy(value_object, original_value_object,
8704 BuildEmitDeepCopy(value_object, original_value_object, target, 8740 Handle<Object>::null(), target,
8705 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); 8741 offset, data_target, data_offset,
8742 DONT_TRACK_ALLOCATION_SITE);
8706 } else { 8743 } else {
8707 Representation representation = details.representation(); 8744 Representation representation = details.representation();
8708 HInstruction* value_instruction = Add<HConstant>(value); 8745 HInstruction* value_instruction = Add<HConstant>(value);
8709 8746
8710 if (representation.IsDouble()) { 8747 if (representation.IsDouble()) {
8711 // Allocate a HeapNumber box and store the value into it. 8748 // Allocate a HeapNumber box and store the value into it.
8712 HInstruction* double_box; 8749 HInstruction* double_box;
8713 if (data_target != NULL) { 8750 if (data_target != NULL) {
8714 double_box = Add<HInnerAllocatedObject>(data_target, *data_offset); 8751 double_box = Add<HInnerAllocatedObject>(data_target, *data_offset);
8715 *data_offset += HeapNumber::kSize; 8752 *data_offset += HeapNumber::kSize;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
8802 for (int i = 0; i < elements_length; i++) { 8839 for (int i = 0; i < elements_length; i++) {
8803 Handle<Object> value(fast_elements->get(i), isolate()); 8840 Handle<Object> value(fast_elements->get(i), isolate());
8804 HValue* key_constant = Add<HConstant>(i); 8841 HValue* key_constant = Add<HConstant>(i);
8805 if (value->IsJSObject()) { 8842 if (value->IsJSObject()) {
8806 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 8843 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
8807 Handle<JSObject> original_value_object = Handle<JSObject>::cast( 8844 Handle<JSObject> original_value_object = Handle<JSObject>::cast(
8808 Handle<Object>(original_fast_elements->get(i), isolate())); 8845 Handle<Object>(original_fast_elements->get(i), isolate()));
8809 HInstruction* value_instruction = Add<HInnerAllocatedObject>(target, 8846 HInstruction* value_instruction = Add<HInnerAllocatedObject>(target,
8810 *offset); 8847 *offset);
8811 Add<HStoreKeyed>(object_elements, key_constant, value_instruction, kind); 8848 Add<HStoreKeyed>(object_elements, key_constant, value_instruction, kind);
8812 BuildEmitDeepCopy(value_object, original_value_object, target, 8849 BuildEmitDeepCopy(value_object, original_value_object,
8813 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); 8850 Handle<Object>::null(), target,
8851 offset, data_target, data_offset,
8852 DONT_TRACK_ALLOCATION_SITE);
8814 } else { 8853 } else {
8815 HInstruction* value_instruction = 8854 HInstruction* value_instruction =
8816 Add<HLoadKeyed>(boilerplate_elements, key_constant, 8855 Add<HLoadKeyed>(boilerplate_elements, key_constant,
8817 static_cast<HValue*>(NULL), kind, 8856 static_cast<HValue*>(NULL), kind,
8818 ALLOW_RETURN_HOLE); 8857 ALLOW_RETURN_HOLE);
8819 Add<HStoreKeyed>(object_elements, key_constant, value_instruction, kind); 8858 Add<HStoreKeyed>(object_elements, key_constant, value_instruction, kind);
8820 } 8859 }
8821 } 8860 }
8822 } 8861 }
8823 8862
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
10104 if (ShouldProduceTraceOutput()) { 10143 if (ShouldProduceTraceOutput()) {
10105 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10144 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10106 } 10145 }
10107 10146
10108 #ifdef DEBUG 10147 #ifdef DEBUG
10109 graph_->Verify(false); // No full verify. 10148 graph_->Verify(false); // No full verify.
10110 #endif 10149 #endif
10111 } 10150 }
10112 10151
10113 } } // namespace v8::internal 10152 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698