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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | 1323 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); |
1324 } | 1324 } |
1325 | 1325 |
1326 Label done; | 1326 Label done; |
1327 __ Branch(&done, ne, v0, Operand(isolate()->factory()->undefined_value())); | 1327 __ Branch(&done, ne, v0, Operand(isolate()->factory()->undefined_value())); |
1328 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1328 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1329 __ bind(&done); | 1329 __ bind(&done); |
1330 } | 1330 } |
1331 | 1331 |
1332 | 1332 |
| 1333 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
| 1334 int offset) { |
| 1335 if (NeedsHomeObject(initializer)) { |
| 1336 __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
| 1337 __ li(StoreDescriptor::NameRegister(), |
| 1338 Operand(isolate()->factory()->home_object_symbol())); |
| 1339 __ lw(StoreDescriptor::ValueRegister(), |
| 1340 MemOperand(sp, offset * kPointerSize)); |
| 1341 CallStoreIC(); |
| 1342 } |
| 1343 } |
| 1344 |
| 1345 |
1333 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1346 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1334 TypeofState typeof_state, | 1347 TypeofState typeof_state, |
1335 Label* slow) { | 1348 Label* slow) { |
1336 Register current = cp; | 1349 Register current = cp; |
1337 Register next = a1; | 1350 Register next = a1; |
1338 Register temp = a2; | 1351 Register temp = a2; |
1339 | 1352 |
1340 Scope* s = scope(); | 1353 Scope* s = scope(); |
1341 while (s != NULL) { | 1354 while (s != NULL) { |
1342 if (s->num_heap_slots() > 0) { | 1355 if (s->num_heap_slots() > 0) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 // contains computed properties with an uninitialized value. | 1692 // contains computed properties with an uninitialized value. |
1680 if (key->value()->IsInternalizedString()) { | 1693 if (key->value()->IsInternalizedString()) { |
1681 if (property->emit_store()) { | 1694 if (property->emit_store()) { |
1682 VisitForAccumulatorValue(value); | 1695 VisitForAccumulatorValue(value); |
1683 __ mov(StoreDescriptor::ValueRegister(), result_register()); | 1696 __ mov(StoreDescriptor::ValueRegister(), result_register()); |
1684 DCHECK(StoreDescriptor::ValueRegister().is(a0)); | 1697 DCHECK(StoreDescriptor::ValueRegister().is(a0)); |
1685 __ li(StoreDescriptor::NameRegister(), Operand(key->value())); | 1698 __ li(StoreDescriptor::NameRegister(), Operand(key->value())); |
1686 __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); | 1699 __ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp)); |
1687 CallStoreIC(key->LiteralFeedbackId()); | 1700 CallStoreIC(key->LiteralFeedbackId()); |
1688 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1701 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1702 |
| 1703 if (NeedsHomeObject(value)) { |
| 1704 __ Move(StoreDescriptor::ReceiverRegister(), v0); |
| 1705 __ li(StoreDescriptor::NameRegister(), |
| 1706 Operand(isolate()->factory()->home_object_symbol())); |
| 1707 __ lw(StoreDescriptor::ValueRegister(), MemOperand(sp)); |
| 1708 CallStoreIC(); |
| 1709 } |
1689 } else { | 1710 } else { |
1690 VisitForEffect(value); | 1711 VisitForEffect(value); |
1691 } | 1712 } |
1692 break; | 1713 break; |
1693 } | 1714 } |
1694 // Duplicate receiver on stack. | 1715 // Duplicate receiver on stack. |
1695 __ lw(a0, MemOperand(sp)); | 1716 __ lw(a0, MemOperand(sp)); |
1696 __ push(a0); | 1717 __ push(a0); |
1697 VisitForStackValue(key); | 1718 VisitForStackValue(key); |
1698 VisitForStackValue(value); | 1719 VisitForStackValue(value); |
1699 if (property->emit_store()) { | 1720 if (property->emit_store()) { |
| 1721 EmitSetHomeObjectIfNeeded(value, 2); |
1700 __ li(a0, Operand(Smi::FromInt(SLOPPY))); // PropertyAttributes. | 1722 __ li(a0, Operand(Smi::FromInt(SLOPPY))); // PropertyAttributes. |
1701 __ push(a0); | 1723 __ push(a0); |
1702 __ CallRuntime(Runtime::kSetProperty, 4); | 1724 __ CallRuntime(Runtime::kSetProperty, 4); |
1703 } else { | 1725 } else { |
1704 __ Drop(3); | 1726 __ Drop(3); |
1705 } | 1727 } |
1706 break; | 1728 break; |
1707 case ObjectLiteral::Property::PROTOTYPE: | 1729 case ObjectLiteral::Property::PROTOTYPE: |
1708 // Duplicate receiver on stack. | 1730 // Duplicate receiver on stack. |
1709 __ lw(a0, MemOperand(sp)); | 1731 __ lw(a0, MemOperand(sp)); |
(...skipping 16 matching lines...) Expand all Loading... |
1726 | 1748 |
1727 // Emit code to define accessors, using only a single call to the runtime for | 1749 // Emit code to define accessors, using only a single call to the runtime for |
1728 // each pair of corresponding getters and setters. | 1750 // each pair of corresponding getters and setters. |
1729 for (AccessorTable::Iterator it = accessor_table.begin(); | 1751 for (AccessorTable::Iterator it = accessor_table.begin(); |
1730 it != accessor_table.end(); | 1752 it != accessor_table.end(); |
1731 ++it) { | 1753 ++it) { |
1732 __ lw(a0, MemOperand(sp)); // Duplicate receiver. | 1754 __ lw(a0, MemOperand(sp)); // Duplicate receiver. |
1733 __ push(a0); | 1755 __ push(a0); |
1734 VisitForStackValue(it->first); | 1756 VisitForStackValue(it->first); |
1735 EmitAccessor(it->second->getter); | 1757 EmitAccessor(it->second->getter); |
| 1758 EmitSetHomeObjectIfNeeded(it->second->getter, 2); |
1736 EmitAccessor(it->second->setter); | 1759 EmitAccessor(it->second->setter); |
| 1760 EmitSetHomeObjectIfNeeded(it->second->setter, 3); |
1737 __ li(a0, Operand(Smi::FromInt(NONE))); | 1761 __ li(a0, Operand(Smi::FromInt(NONE))); |
1738 __ push(a0); | 1762 __ push(a0); |
1739 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1763 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
1740 } | 1764 } |
1741 | 1765 |
1742 if (expr->has_function()) { | 1766 if (expr->has_function()) { |
1743 DCHECK(result_saved); | 1767 DCHECK(result_saved); |
1744 __ lw(a0, MemOperand(sp)); | 1768 __ lw(a0, MemOperand(sp)); |
1745 __ push(a0); | 1769 __ push(a0); |
1746 __ CallRuntime(Runtime::kToFastProperties, 1); | 1770 __ CallRuntime(Runtime::kToFastProperties, 1); |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 DCHECK(key != NULL); | 2489 DCHECK(key != NULL); |
2466 | 2490 |
2467 if (property->is_static()) { | 2491 if (property->is_static()) { |
2468 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor | 2492 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor |
2469 } else { | 2493 } else { |
2470 __ lw(scratch, MemOperand(sp, 0)); // prototype | 2494 __ lw(scratch, MemOperand(sp, 0)); // prototype |
2471 } | 2495 } |
2472 __ push(scratch); | 2496 __ push(scratch); |
2473 VisitForStackValue(key); | 2497 VisitForStackValue(key); |
2474 VisitForStackValue(value); | 2498 VisitForStackValue(value); |
| 2499 EmitSetHomeObjectIfNeeded(value, 2); |
2475 | 2500 |
2476 switch (property->kind()) { | 2501 switch (property->kind()) { |
2477 case ObjectLiteral::Property::CONSTANT: | 2502 case ObjectLiteral::Property::CONSTANT: |
2478 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2503 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2479 case ObjectLiteral::Property::COMPUTED: | 2504 case ObjectLiteral::Property::COMPUTED: |
2480 case ObjectLiteral::Property::PROTOTYPE: | 2505 case ObjectLiteral::Property::PROTOTYPE: |
2481 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2506 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2482 break; | 2507 break; |
2483 | 2508 |
2484 case ObjectLiteral::Property::GETTER: | 2509 case ObjectLiteral::Property::GETTER: |
(...skipping 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 Assembler::target_address_at(pc_immediate_load_address)) == | 5265 Assembler::target_address_at(pc_immediate_load_address)) == |
5241 reinterpret_cast<uint32_t>( | 5266 reinterpret_cast<uint32_t>( |
5242 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5267 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5243 return OSR_AFTER_STACK_CHECK; | 5268 return OSR_AFTER_STACK_CHECK; |
5244 } | 5269 } |
5245 | 5270 |
5246 | 5271 |
5247 } } // namespace v8::internal | 5272 } } // namespace v8::internal |
5248 | 5273 |
5249 #endif // V8_TARGET_ARCH_MIPS | 5274 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |