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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Now with ports to arm and x64 Created 7 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1554 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1555 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); 1555 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset));
1556 __ Push(Smi::FromInt(expr->literal_index())); 1556 __ Push(Smi::FromInt(expr->literal_index()));
1557 __ Push(constant_properties); 1557 __ Push(constant_properties);
1558 int flags = expr->fast_elements() 1558 int flags = expr->fast_elements()
1559 ? ObjectLiteral::kFastElements 1559 ? ObjectLiteral::kFastElements
1560 : ObjectLiteral::kNoFlags; 1560 : ObjectLiteral::kNoFlags;
1561 flags |= expr->has_function() 1561 flags |= expr->has_function()
1562 ? ObjectLiteral::kHasFunction 1562 ? ObjectLiteral::kHasFunction
1563 : ObjectLiteral::kNoFlags; 1563 : ObjectLiteral::kNoFlags;
1564
1565 if (FLAG_track_allocation_sites &&
1566 (loop_depth() != 0 || !scope()->is_global_scope())) {
1567 // Don't track global arrays that are never re-created
1568 flags |= ObjectLiteral::kAllocationSiteInfoAllowed;
1569 }
1570
1564 __ Push(Smi::FromInt(flags)); 1571 __ Push(Smi::FromInt(flags));
1565 int properties_count = constant_properties->length() / 2; 1572 int properties_count = constant_properties->length() / 2;
1566 if (expr->depth() > 1) { 1573 if (expr->depth() > 1) {
1567 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1574 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1568 } else if (flags != ObjectLiteral::kFastElements || 1575 } else if (flags != ObjectLiteral::kFastElements ||
1569 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 1576 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1570 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 1577 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1571 } else { 1578 } else {
1572 FastCloneShallowObjectStub stub(properties_count); 1579 FastCloneShallowObjectStub stub(properties_count);
1573 __ CallStub(&stub); 1580 __ CallStub(&stub);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 int length = subexprs->length(); 1677 int length = subexprs->length();
1671 Handle<FixedArray> constant_elements = expr->constant_elements(); 1678 Handle<FixedArray> constant_elements = expr->constant_elements();
1672 ASSERT_EQ(2, constant_elements->length()); 1679 ASSERT_EQ(2, constant_elements->length());
1673 ElementsKind constant_elements_kind = 1680 ElementsKind constant_elements_kind =
1674 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1681 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1675 bool has_constant_fast_elements = 1682 bool has_constant_fast_elements =
1676 IsFastObjectElementsKind(constant_elements_kind); 1683 IsFastObjectElementsKind(constant_elements_kind);
1677 Handle<FixedArrayBase> constant_elements_values( 1684 Handle<FixedArrayBase> constant_elements_values(
1678 FixedArrayBase::cast(constant_elements->get(1))); 1685 FixedArrayBase::cast(constant_elements->get(1)));
1679 1686
1687 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1688 int flags = ArrayLiteral::kNoFlags;
1689 if (FLAG_track_allocation_sites &&
1690 (loop_depth() != 0 || !scope()->is_global_scope())) {
1691 // Don't track global arrays that are never re-created
1692 flags |= ArrayLiteral::kAllocationSiteInfoAllowed;
1693 allocation_site_mode = TRACK_ALLOCATION_SITE;
1694 }
1695
1680 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1696 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1681 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1697 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
1682 __ Push(Smi::FromInt(expr->literal_index())); 1698 __ Push(Smi::FromInt(expr->literal_index()));
1683 __ Push(constant_elements); 1699 __ Push(constant_elements);
1700
1701 ASSERT(((flags & ArrayLiteral::kAllocationSiteInfoAllowed) &&
1702 (allocation_site_mode == TRACK_ALLOCATION_SITE)) ||
1703 (((flags & ArrayLiteral::kAllocationSiteInfoAllowed) == 0) &&
1704 (allocation_site_mode == DONT_TRACK_ALLOCATION_SITE)));
1705 __ Push(Smi::FromInt(flags));
1684 Heap* heap = isolate()->heap(); 1706 Heap* heap = isolate()->heap();
1685 if (has_constant_fast_elements && 1707 if (has_constant_fast_elements &&
1686 constant_elements_values->map() == heap->fixed_cow_array_map()) { 1708 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1687 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1709 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1688 // change, so it's possible to specialize the stub in advance. 1710 // change, so it's possible to specialize the stub in advance.
1689 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); 1711 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1690 FastCloneShallowArrayStub stub( 1712 FastCloneShallowArrayStub stub(
1691 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1713 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1692 DONT_TRACK_ALLOCATION_SITE, 1714 DONT_TRACK_ALLOCATION_SITE,
1693 length); 1715 length);
1694 __ CallStub(&stub); 1716 __ CallStub(&stub);
1695 } else if (expr->depth() > 1) { 1717 } else if (expr->depth() > 1) {
1696 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1718 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1697 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1719 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1698 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1720 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 4);
1699 } else { 1721 } else {
1700 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1722 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1701 FLAG_smi_only_arrays); 1723 FLAG_smi_only_arrays);
1702 FastCloneShallowArrayStub::Mode mode = 1724 FastCloneShallowArrayStub::Mode mode =
1703 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1725 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1704 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1705 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1706 1726
1707 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1727 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1708 // change, so it's possible to specialize the stub in advance. 1728 // change, so it's possible to specialize the stub in advance.
1709 if (has_constant_fast_elements) { 1729 if (has_constant_fast_elements) {
1710 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1730 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1711 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1731 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1712 } 1732 }
1713 1733
1714 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 1734 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
1715 __ CallStub(&stub); 1735 __ CallStub(&stub);
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after
4526 *context_length = 0; 4546 *context_length = 0;
4527 return previous_; 4547 return previous_;
4528 } 4548 }
4529 4549
4530 4550
4531 #undef __ 4551 #undef __
4532 4552
4533 } } // namespace v8::internal 4553 } } // namespace v8::internal
4534 4554
4535 #endif // V8_TARGET_ARCH_X64 4555 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698