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

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

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing a port compile failure Created 7 years, 9 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/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 __ push(Immediate(isolate()->factory()->null_value())); 1520 __ push(Immediate(isolate()->factory()->null_value()));
1521 } else { 1521 } else {
1522 VisitForStackValue(expression); 1522 VisitForStackValue(expression);
1523 } 1523 }
1524 } 1524 }
1525 1525
1526 1526
1527 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1527 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1528 Comment cmnt(masm_, "[ ObjectLiteral"); 1528 Comment cmnt(masm_, "[ ObjectLiteral");
1529 Handle<FixedArray> constant_properties = expr->constant_properties(); 1529 Handle<FixedArray> constant_properties = expr->constant_properties();
1530
1530 int flags = expr->fast_elements() 1531 int flags = expr->fast_elements()
1531 ? ObjectLiteral::kFastElements 1532 ? ObjectLiteral::kFastElements
1532 : ObjectLiteral::kNoFlags; 1533 : ObjectLiteral::kNoFlags;
1533 flags |= expr->has_function() 1534 flags |= expr->has_function()
1534 ? ObjectLiteral::kHasFunction 1535 ? ObjectLiteral::kHasFunction
1535 : ObjectLiteral::kNoFlags; 1536 : ObjectLiteral::kNoFlags;
1537
1538 if (FLAG_track_allocation_sites && !IsOneTimeCode()) {
1539 // Don't track global arrays that are never re-created
1540 flags |= ObjectLiteral::kCreateAllocationSiteInfos;
1541 }
1542
1536 int properties_count = constant_properties->length() / 2; 1543 int properties_count = constant_properties->length() / 2;
1537 if (expr->depth() > 1) { 1544 if (expr->depth() > 1) {
1538 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1545 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1539 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); 1546 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset));
1540 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1547 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1541 __ push(Immediate(constant_properties)); 1548 __ push(Immediate(constant_properties));
1542 __ push(Immediate(Smi::FromInt(flags))); 1549 __ push(Immediate(Smi::FromInt(flags)));
1543 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1550 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1544 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || 1551 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements ||
1545 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 1552 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 int length = subexprs->length(); 1670 int length = subexprs->length();
1664 Handle<FixedArray> constant_elements = expr->constant_elements(); 1671 Handle<FixedArray> constant_elements = expr->constant_elements();
1665 ASSERT_EQ(2, constant_elements->length()); 1672 ASSERT_EQ(2, constant_elements->length());
1666 ElementsKind constant_elements_kind = 1673 ElementsKind constant_elements_kind =
1667 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); 1674 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1668 bool has_constant_fast_elements = 1675 bool has_constant_fast_elements =
1669 IsFastObjectElementsKind(constant_elements_kind); 1676 IsFastObjectElementsKind(constant_elements_kind);
1670 Handle<FixedArrayBase> constant_elements_values( 1677 Handle<FixedArrayBase> constant_elements_values(
1671 FixedArrayBase::cast(constant_elements->get(1))); 1678 FixedArrayBase::cast(constant_elements->get(1)));
1672 1679
1680 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1681 int flags = ArrayLiteral::kNoFlags;
1682 if (FLAG_track_allocation_sites && !IsOneTimeCode()) {
1683 // Don't track global arrays that are never re-created
1684 flags |= ArrayLiteral::kCreateAllocationSiteInfos;
1685 allocation_site_mode = TRACK_ALLOCATION_SITE;
1686 }
1687
1688 ASSERT(((flags & ArrayLiteral::kCreateAllocationSiteInfos) &&
1689 (allocation_site_mode == TRACK_ALLOCATION_SITE)) ||
1690 (((flags & ArrayLiteral::kCreateAllocationSiteInfos) == 0) &&
1691 (allocation_site_mode == DONT_TRACK_ALLOCATION_SITE)));
1692
1673 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1693 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1674 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1694 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1675 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1695 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1676 __ push(Immediate(constant_elements)); 1696 __ push(Immediate(constant_elements));
1677 Heap* heap = isolate()->heap(); 1697 Heap* heap = isolate()->heap();
1678 if (has_constant_fast_elements && 1698 if (has_constant_fast_elements &&
1679 constant_elements_values->map() == heap->fixed_cow_array_map()) { 1699 constant_elements_values->map() == heap->fixed_cow_array_map()) {
1680 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1700 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1681 // change, so it's possible to specialize the stub in advance. 1701 // change, so it's possible to specialize the stub in advance.
1682 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); 1702 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1683 FastCloneShallowArrayStub stub( 1703 FastCloneShallowArrayStub stub(
1684 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, 1704 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS,
1685 DONT_TRACK_ALLOCATION_SITE, 1705 DONT_TRACK_ALLOCATION_SITE,
1686 length); 1706 length);
1687 __ CallStub(&stub); 1707 __ CallStub(&stub);
1688 } else if (expr->depth() > 1) { 1708 } else if (expr->depth() > 1) {
1689 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1709 __ push(Immediate(Smi::FromInt(flags)));
1710 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1690 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { 1711 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1691 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1712 __ push(Immediate(Smi::FromInt(flags)));
1713 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 4);
1692 } else { 1714 } else {
1693 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || 1715 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1694 FLAG_smi_only_arrays); 1716 FLAG_smi_only_arrays);
1695 FastCloneShallowArrayStub::Mode mode = 1717 FastCloneShallowArrayStub::Mode mode =
1696 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; 1718 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS;
1697 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites
1698 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE;
1699 1719
1700 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot 1720 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1701 // change, so it's possible to specialize the stub in advance. 1721 // change, so it's possible to specialize the stub in advance.
1702 if (has_constant_fast_elements) { 1722 if (has_constant_fast_elements) {
1703 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; 1723 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS;
1704 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1724 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1705 } 1725 }
1706 1726
1707 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); 1727 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length);
1708 __ CallStub(&stub); 1728 __ CallStub(&stub);
(...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after
4573 *stack_depth = 0; 4593 *stack_depth = 0;
4574 *context_length = 0; 4594 *context_length = 0;
4575 return previous_; 4595 return previous_;
4576 } 4596 }
4577 4597
4578 #undef __ 4598 #undef __
4579 4599
4580 } } // namespace v8::internal 4600 } } // namespace v8::internal
4581 4601
4582 #endif // V8_TARGET_ARCH_IA32 4602 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698