OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 | 1334 |
1335 | 1335 |
1336 __ Cmp(rax, isolate()->factory()->undefined_value()); | 1336 __ Cmp(rax, isolate()->factory()->undefined_value()); |
1337 Label done; | 1337 Label done; |
1338 __ j(not_equal, &done); | 1338 __ j(not_equal, &done); |
1339 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1339 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1340 __ bind(&done); | 1340 __ bind(&done); |
1341 } | 1341 } |
1342 | 1342 |
1343 | 1343 |
| 1344 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
| 1345 int offset) { |
| 1346 if (NeedsHomeObject(initializer)) { |
| 1347 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
| 1348 __ Move(StoreDescriptor::NameRegister(), |
| 1349 isolate()->factory()->home_object_symbol()); |
| 1350 __ movp(StoreDescriptor::ValueRegister(), |
| 1351 Operand(rsp, offset * kPointerSize)); |
| 1352 CallStoreIC(); |
| 1353 } |
| 1354 } |
| 1355 |
| 1356 |
1344 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1357 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1345 TypeofState typeof_state, | 1358 TypeofState typeof_state, |
1346 Label* slow) { | 1359 Label* slow) { |
1347 Register context = rsi; | 1360 Register context = rsi; |
1348 Register temp = rdx; | 1361 Register temp = rdx; |
1349 | 1362 |
1350 Scope* s = scope(); | 1363 Scope* s = scope(); |
1351 while (s != NULL) { | 1364 while (s != NULL) { |
1352 if (s->num_heap_slots() > 0) { | 1365 if (s->num_heap_slots() > 0) { |
1353 if (s->calls_sloppy_eval()) { | 1366 if (s->calls_sloppy_eval()) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 // It is safe to use [[Put]] here because the boilerplate already | 1710 // It is safe to use [[Put]] here because the boilerplate already |
1698 // contains computed properties with an uninitialized value. | 1711 // contains computed properties with an uninitialized value. |
1699 if (key->value()->IsInternalizedString()) { | 1712 if (key->value()->IsInternalizedString()) { |
1700 if (property->emit_store()) { | 1713 if (property->emit_store()) { |
1701 VisitForAccumulatorValue(value); | 1714 VisitForAccumulatorValue(value); |
1702 DCHECK(StoreDescriptor::ValueRegister().is(rax)); | 1715 DCHECK(StoreDescriptor::ValueRegister().is(rax)); |
1703 __ Move(StoreDescriptor::NameRegister(), key->value()); | 1716 __ Move(StoreDescriptor::NameRegister(), key->value()); |
1704 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 1717 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
1705 CallStoreIC(key->LiteralFeedbackId()); | 1718 CallStoreIC(key->LiteralFeedbackId()); |
1706 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1719 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1720 |
| 1721 if (NeedsHomeObject(value)) { |
| 1722 __ movp(StoreDescriptor::ReceiverRegister(), rax); |
| 1723 __ Move(StoreDescriptor::NameRegister(), |
| 1724 isolate()->factory()->home_object_symbol()); |
| 1725 __ movp(StoreDescriptor::ValueRegister(), Operand(rsp, 0)); |
| 1726 CallStoreIC(); |
| 1727 } |
1707 } else { | 1728 } else { |
1708 VisitForEffect(value); | 1729 VisitForEffect(value); |
1709 } | 1730 } |
1710 break; | 1731 break; |
1711 } | 1732 } |
1712 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1733 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1713 VisitForStackValue(key); | 1734 VisitForStackValue(key); |
1714 VisitForStackValue(value); | 1735 VisitForStackValue(value); |
1715 if (property->emit_store()) { | 1736 if (property->emit_store()) { |
| 1737 EmitSetHomeObjectIfNeeded(value, 2); |
1716 __ Push(Smi::FromInt(SLOPPY)); // Strict mode | 1738 __ Push(Smi::FromInt(SLOPPY)); // Strict mode |
1717 __ CallRuntime(Runtime::kSetProperty, 4); | 1739 __ CallRuntime(Runtime::kSetProperty, 4); |
1718 } else { | 1740 } else { |
1719 __ Drop(3); | 1741 __ Drop(3); |
1720 } | 1742 } |
1721 break; | 1743 break; |
1722 case ObjectLiteral::Property::PROTOTYPE: | 1744 case ObjectLiteral::Property::PROTOTYPE: |
1723 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1745 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1724 VisitForStackValue(value); | 1746 VisitForStackValue(value); |
1725 if (property->emit_store()) { | 1747 if (property->emit_store()) { |
(...skipping 12 matching lines...) Expand all Loading... |
1738 } | 1760 } |
1739 | 1761 |
1740 // Emit code to define accessors, using only a single call to the runtime for | 1762 // Emit code to define accessors, using only a single call to the runtime for |
1741 // each pair of corresponding getters and setters. | 1763 // each pair of corresponding getters and setters. |
1742 for (AccessorTable::Iterator it = accessor_table.begin(); | 1764 for (AccessorTable::Iterator it = accessor_table.begin(); |
1743 it != accessor_table.end(); | 1765 it != accessor_table.end(); |
1744 ++it) { | 1766 ++it) { |
1745 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1767 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1746 VisitForStackValue(it->first); | 1768 VisitForStackValue(it->first); |
1747 EmitAccessor(it->second->getter); | 1769 EmitAccessor(it->second->getter); |
| 1770 EmitSetHomeObjectIfNeeded(it->second->getter, 2); |
1748 EmitAccessor(it->second->setter); | 1771 EmitAccessor(it->second->setter); |
| 1772 EmitSetHomeObjectIfNeeded(it->second->setter, 3); |
1749 __ Push(Smi::FromInt(NONE)); | 1773 __ Push(Smi::FromInt(NONE)); |
1750 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1774 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
1751 } | 1775 } |
1752 | 1776 |
1753 if (expr->has_function()) { | 1777 if (expr->has_function()) { |
1754 DCHECK(result_saved); | 1778 DCHECK(result_saved); |
1755 __ Push(Operand(rsp, 0)); | 1779 __ Push(Operand(rsp, 0)); |
1756 __ CallRuntime(Runtime::kToFastProperties, 1); | 1780 __ CallRuntime(Runtime::kToFastProperties, 1); |
1757 } | 1781 } |
1758 | 1782 |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 Expression* value = property->value(); | 2464 Expression* value = property->value(); |
2441 DCHECK(key != NULL); | 2465 DCHECK(key != NULL); |
2442 | 2466 |
2443 if (property->is_static()) { | 2467 if (property->is_static()) { |
2444 __ Push(Operand(rsp, kPointerSize)); // constructor | 2468 __ Push(Operand(rsp, kPointerSize)); // constructor |
2445 } else { | 2469 } else { |
2446 __ Push(Operand(rsp, 0)); // prototype | 2470 __ Push(Operand(rsp, 0)); // prototype |
2447 } | 2471 } |
2448 VisitForStackValue(key); | 2472 VisitForStackValue(key); |
2449 VisitForStackValue(value); | 2473 VisitForStackValue(value); |
| 2474 EmitSetHomeObjectIfNeeded(value, 2); |
2450 | 2475 |
2451 switch (property->kind()) { | 2476 switch (property->kind()) { |
2452 case ObjectLiteral::Property::CONSTANT: | 2477 case ObjectLiteral::Property::CONSTANT: |
2453 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2478 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2454 case ObjectLiteral::Property::COMPUTED: | 2479 case ObjectLiteral::Property::COMPUTED: |
2455 case ObjectLiteral::Property::PROTOTYPE: | 2480 case ObjectLiteral::Property::PROTOTYPE: |
2456 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2481 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2457 break; | 2482 break; |
2458 | 2483 |
2459 case ObjectLiteral::Property::GETTER: | 2484 case ObjectLiteral::Property::GETTER: |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5234 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5259 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5235 Assembler::target_address_at(call_target_address, | 5260 Assembler::target_address_at(call_target_address, |
5236 unoptimized_code)); | 5261 unoptimized_code)); |
5237 return OSR_AFTER_STACK_CHECK; | 5262 return OSR_AFTER_STACK_CHECK; |
5238 } | 5263 } |
5239 | 5264 |
5240 | 5265 |
5241 } } // namespace v8::internal | 5266 } } // namespace v8::internal |
5242 | 5267 |
5243 #endif // V8_TARGET_ARCH_X64 | 5268 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |