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::EmitSetHomeObject(Expression* expr, int offset) { |
| 1345 if (expr != NULL && expr->IsFunctionLiteral() && |
| 1346 expr->AsFunctionLiteral()->needs_super_binding()) { |
| 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 (value->IsFunctionLiteral() && |
| 1722 value->AsFunctionLiteral()->needs_super_binding()) { |
| 1723 __ movp(StoreDescriptor::ReceiverRegister(), rax); |
| 1724 __ Move(StoreDescriptor::NameRegister(), |
| 1725 isolate()->factory()->home_object_symbol()); |
| 1726 __ movp(StoreDescriptor::ValueRegister(), Operand(rsp, 0)); |
| 1727 CallStoreIC(); |
| 1728 } |
1707 } else { | 1729 } else { |
1708 VisitForEffect(value); | 1730 VisitForEffect(value); |
1709 } | 1731 } |
1710 break; | 1732 break; |
1711 } | 1733 } |
1712 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1734 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1713 VisitForStackValue(key); | 1735 VisitForStackValue(key); |
1714 VisitForStackValue(value); | 1736 VisitForStackValue(value); |
1715 if (property->emit_store()) { | 1737 if (property->emit_store()) { |
| 1738 EmitSetHomeObject(value, 2); |
1716 __ Push(Smi::FromInt(SLOPPY)); // Strict mode | 1739 __ Push(Smi::FromInt(SLOPPY)); // Strict mode |
1717 __ CallRuntime(Runtime::kSetProperty, 4); | 1740 __ CallRuntime(Runtime::kSetProperty, 4); |
1718 } else { | 1741 } else { |
1719 __ Drop(3); | 1742 __ Drop(3); |
1720 } | 1743 } |
1721 break; | 1744 break; |
1722 case ObjectLiteral::Property::PROTOTYPE: | 1745 case ObjectLiteral::Property::PROTOTYPE: |
1723 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1746 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1724 VisitForStackValue(value); | 1747 VisitForStackValue(value); |
1725 if (property->emit_store()) { | 1748 if (property->emit_store()) { |
(...skipping 12 matching lines...) Expand all Loading... |
1738 } | 1761 } |
1739 | 1762 |
1740 // Emit code to define accessors, using only a single call to the runtime for | 1763 // Emit code to define accessors, using only a single call to the runtime for |
1741 // each pair of corresponding getters and setters. | 1764 // each pair of corresponding getters and setters. |
1742 for (AccessorTable::Iterator it = accessor_table.begin(); | 1765 for (AccessorTable::Iterator it = accessor_table.begin(); |
1743 it != accessor_table.end(); | 1766 it != accessor_table.end(); |
1744 ++it) { | 1767 ++it) { |
1745 __ Push(Operand(rsp, 0)); // Duplicate receiver. | 1768 __ Push(Operand(rsp, 0)); // Duplicate receiver. |
1746 VisitForStackValue(it->first); | 1769 VisitForStackValue(it->first); |
1747 EmitAccessor(it->second->getter); | 1770 EmitAccessor(it->second->getter); |
| 1771 EmitSetHomeObject(it->second->getter, 2); |
1748 EmitAccessor(it->second->setter); | 1772 EmitAccessor(it->second->setter); |
| 1773 EmitSetHomeObject(it->second->setter, 3); |
1749 __ Push(Smi::FromInt(NONE)); | 1774 __ Push(Smi::FromInt(NONE)); |
1750 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1775 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
1751 } | 1776 } |
1752 | 1777 |
1753 if (expr->has_function()) { | 1778 if (expr->has_function()) { |
1754 DCHECK(result_saved); | 1779 DCHECK(result_saved); |
1755 __ Push(Operand(rsp, 0)); | 1780 __ Push(Operand(rsp, 0)); |
1756 __ CallRuntime(Runtime::kToFastProperties, 1); | 1781 __ CallRuntime(Runtime::kToFastProperties, 1); |
1757 } | 1782 } |
1758 | 1783 |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 Expression* value = property->value(); | 2465 Expression* value = property->value(); |
2441 DCHECK(key != NULL); | 2466 DCHECK(key != NULL); |
2442 | 2467 |
2443 if (property->is_static()) { | 2468 if (property->is_static()) { |
2444 __ Push(Operand(rsp, kPointerSize)); // constructor | 2469 __ Push(Operand(rsp, kPointerSize)); // constructor |
2445 } else { | 2470 } else { |
2446 __ Push(Operand(rsp, 0)); // prototype | 2471 __ Push(Operand(rsp, 0)); // prototype |
2447 } | 2472 } |
2448 VisitForStackValue(key); | 2473 VisitForStackValue(key); |
2449 VisitForStackValue(value); | 2474 VisitForStackValue(value); |
| 2475 EmitSetHomeObject(value, 2); |
2450 | 2476 |
2451 switch (property->kind()) { | 2477 switch (property->kind()) { |
2452 case ObjectLiteral::Property::CONSTANT: | 2478 case ObjectLiteral::Property::CONSTANT: |
2453 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2479 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2454 case ObjectLiteral::Property::COMPUTED: | 2480 case ObjectLiteral::Property::COMPUTED: |
2455 case ObjectLiteral::Property::PROTOTYPE: | 2481 case ObjectLiteral::Property::PROTOTYPE: |
2456 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2482 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2457 break; | 2483 break; |
2458 | 2484 |
2459 case ObjectLiteral::Property::GETTER: | 2485 case ObjectLiteral::Property::GETTER: |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5234 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5260 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5235 Assembler::target_address_at(call_target_address, | 5261 Assembler::target_address_at(call_target_address, |
5236 unoptimized_code)); | 5262 unoptimized_code)); |
5237 return OSR_AFTER_STACK_CHECK; | 5263 return OSR_AFTER_STACK_CHECK; |
5238 } | 5264 } |
5239 | 5265 |
5240 | 5266 |
5241 } } // namespace v8::internal | 5267 } } // namespace v8::internal |
5242 | 5268 |
5243 #endif // V8_TARGET_ARCH_X64 | 5269 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |