OLD | NEW |
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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 ? ObjectLiteral::kFastElements | 1541 ? ObjectLiteral::kFastElements |
1542 : ObjectLiteral::kNoFlags; | 1542 : ObjectLiteral::kNoFlags; |
1543 flags |= expr->has_function() | 1543 flags |= expr->has_function() |
1544 ? ObjectLiteral::kHasFunction | 1544 ? ObjectLiteral::kHasFunction |
1545 : ObjectLiteral::kNoFlags; | 1545 : ObjectLiteral::kNoFlags; |
1546 __ push(Immediate(Smi::FromInt(flags))); | 1546 __ push(Immediate(Smi::FromInt(flags))); |
1547 int properties_count = constant_properties->length() / 2; | 1547 int properties_count = constant_properties->length() / 2; |
1548 if (expr->depth() > 1) { | 1548 if (expr->depth() > 1) { |
1549 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1549 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1550 } else if (flags != ObjectLiteral::kFastElements || | 1550 } else if (flags != ObjectLiteral::kFastElements || |
1551 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1551 properties_count > |
| 1552 FastCloneShallowObjectStub::MaximumClonedProperties()) { |
1552 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1553 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1553 } else { | 1554 } else { |
1554 FastCloneShallowObjectStub stub(properties_count); | 1555 FastCloneShallowObjectStub stub(properties_count); |
1555 __ CallStub(&stub); | 1556 __ CallStub(&stub); |
1556 } | 1557 } |
1557 | 1558 |
1558 // If result_saved is true the result is on top of the stack. If | 1559 // If result_saved is true the result is on top of the stack. If |
1559 // result_saved is false the result is in eax. | 1560 // result_saved is false the result is in eax. |
1560 bool result_saved = false; | 1561 bool result_saved = false; |
1561 | 1562 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 constant_elements_values->map() == heap->fixed_cow_array_map()) { | 1669 constant_elements_values->map() == heap->fixed_cow_array_map()) { |
1669 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1670 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1670 // change, so it's possible to specialize the stub in advance. | 1671 // change, so it's possible to specialize the stub in advance. |
1671 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | 1672 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); |
1672 FastCloneShallowArrayStub stub( | 1673 FastCloneShallowArrayStub stub( |
1673 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1674 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1674 length); | 1675 length); |
1675 __ CallStub(&stub); | 1676 __ CallStub(&stub); |
1676 } else if (expr->depth() > 1) { | 1677 } else if (expr->depth() > 1) { |
1677 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1678 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1678 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1679 } else if (length > FastCloneShallowArrayStub::MaximumClonedLength()) { |
1679 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1680 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1680 } else { | 1681 } else { |
1681 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1682 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1682 FLAG_smi_only_arrays); | 1683 FLAG_smi_only_arrays); |
1683 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1684 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1684 // change, so it's possible to specialize the stub in advance. | 1685 // change, so it's possible to specialize the stub in advance. |
1685 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements | 1686 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements |
1686 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1687 ? FastCloneShallowArrayStub::CLONE_ELEMENTS |
1687 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1688 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1688 FastCloneShallowArrayStub stub(mode, length); | 1689 FastCloneShallowArrayStub stub(mode, length); |
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4563 *stack_depth = 0; | 4564 *stack_depth = 0; |
4564 *context_length = 0; | 4565 *context_length = 0; |
4565 return previous_; | 4566 return previous_; |
4566 } | 4567 } |
4567 | 4568 |
4568 #undef __ | 4569 #undef __ |
4569 | 4570 |
4570 } } // namespace v8::internal | 4571 } } // namespace v8::internal |
4571 | 4572 |
4572 #endif // V8_TARGET_ARCH_IA32 | 4573 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |