| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 __ cmp(eax, isolate()->factory()->undefined_value()); | 1290 __ cmp(eax, isolate()->factory()->undefined_value()); |
| 1291 Label done; | 1291 Label done; |
| 1292 __ j(not_equal, &done); | 1292 __ j(not_equal, &done); |
| 1293 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1293 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
| 1294 __ bind(&done); | 1294 __ bind(&done); |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 | 1297 |
| 1298 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
| 1299 int offset) { |
| 1300 if (NeedsHomeObject(initializer)) { |
| 1301 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1302 __ mov(StoreDescriptor::NameRegister(), |
| 1303 Immediate(isolate()->factory()->home_object_symbol())); |
| 1304 __ mov(StoreDescriptor::ValueRegister(), |
| 1305 Operand(esp, offset * kPointerSize)); |
| 1306 CallStoreIC(); |
| 1307 } |
| 1308 } |
| 1309 |
| 1310 |
| 1298 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1311 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| 1299 TypeofState typeof_state, | 1312 TypeofState typeof_state, |
| 1300 Label* slow) { | 1313 Label* slow) { |
| 1301 Register context = esi; | 1314 Register context = esi; |
| 1302 Register temp = edx; | 1315 Register temp = edx; |
| 1303 | 1316 |
| 1304 Scope* s = scope(); | 1317 Scope* s = scope(); |
| 1305 while (s != NULL) { | 1318 while (s != NULL) { |
| 1306 if (s->num_heap_slots() > 0) { | 1319 if (s->num_heap_slots() > 0) { |
| 1307 if (s->calls_sloppy_eval()) { | 1320 if (s->calls_sloppy_eval()) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 // It is safe to use [[Put]] here because the boilerplate already | 1665 // It is safe to use [[Put]] here because the boilerplate already |
| 1653 // contains computed properties with an uninitialized value. | 1666 // contains computed properties with an uninitialized value. |
| 1654 if (key->value()->IsInternalizedString()) { | 1667 if (key->value()->IsInternalizedString()) { |
| 1655 if (property->emit_store()) { | 1668 if (property->emit_store()) { |
| 1656 VisitForAccumulatorValue(value); | 1669 VisitForAccumulatorValue(value); |
| 1657 DCHECK(StoreDescriptor::ValueRegister().is(eax)); | 1670 DCHECK(StoreDescriptor::ValueRegister().is(eax)); |
| 1658 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); | 1671 __ mov(StoreDescriptor::NameRegister(), Immediate(key->value())); |
| 1659 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1672 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1660 CallStoreIC(key->LiteralFeedbackId()); | 1673 CallStoreIC(key->LiteralFeedbackId()); |
| 1661 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1674 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1675 |
| 1676 if (NeedsHomeObject(value)) { |
| 1677 __ mov(StoreDescriptor::ReceiverRegister(), eax); |
| 1678 __ mov(StoreDescriptor::NameRegister(), |
| 1679 Immediate(isolate()->factory()->home_object_symbol())); |
| 1680 __ mov(StoreDescriptor::ValueRegister(), Operand(esp, 0)); |
| 1681 CallStoreIC(); |
| 1682 } |
| 1662 } else { | 1683 } else { |
| 1663 VisitForEffect(value); | 1684 VisitForEffect(value); |
| 1664 } | 1685 } |
| 1665 break; | 1686 break; |
| 1666 } | 1687 } |
| 1667 __ push(Operand(esp, 0)); // Duplicate receiver. | 1688 __ push(Operand(esp, 0)); // Duplicate receiver. |
| 1668 VisitForStackValue(key); | 1689 VisitForStackValue(key); |
| 1669 VisitForStackValue(value); | 1690 VisitForStackValue(value); |
| 1670 if (property->emit_store()) { | 1691 if (property->emit_store()) { |
| 1692 EmitSetHomeObjectIfNeeded(value, 2); |
| 1671 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode | 1693 __ push(Immediate(Smi::FromInt(SLOPPY))); // Strict mode |
| 1672 __ CallRuntime(Runtime::kSetProperty, 4); | 1694 __ CallRuntime(Runtime::kSetProperty, 4); |
| 1673 } else { | 1695 } else { |
| 1674 __ Drop(3); | 1696 __ Drop(3); |
| 1675 } | 1697 } |
| 1676 break; | 1698 break; |
| 1677 case ObjectLiteral::Property::PROTOTYPE: | 1699 case ObjectLiteral::Property::PROTOTYPE: |
| 1678 __ push(Operand(esp, 0)); // Duplicate receiver. | 1700 __ push(Operand(esp, 0)); // Duplicate receiver. |
| 1679 VisitForStackValue(value); | 1701 VisitForStackValue(value); |
| 1680 if (property->emit_store()) { | 1702 if (property->emit_store()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1693 } | 1715 } |
| 1694 | 1716 |
| 1695 // Emit code to define accessors, using only a single call to the runtime for | 1717 // Emit code to define accessors, using only a single call to the runtime for |
| 1696 // each pair of corresponding getters and setters. | 1718 // each pair of corresponding getters and setters. |
| 1697 for (AccessorTable::Iterator it = accessor_table.begin(); | 1719 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1698 it != accessor_table.end(); | 1720 it != accessor_table.end(); |
| 1699 ++it) { | 1721 ++it) { |
| 1700 __ push(Operand(esp, 0)); // Duplicate receiver. | 1722 __ push(Operand(esp, 0)); // Duplicate receiver. |
| 1701 VisitForStackValue(it->first); | 1723 VisitForStackValue(it->first); |
| 1702 EmitAccessor(it->second->getter); | 1724 EmitAccessor(it->second->getter); |
| 1725 EmitSetHomeObjectIfNeeded(it->second->getter, 2); |
| 1703 EmitAccessor(it->second->setter); | 1726 EmitAccessor(it->second->setter); |
| 1727 EmitSetHomeObjectIfNeeded(it->second->setter, 3); |
| 1704 __ push(Immediate(Smi::FromInt(NONE))); | 1728 __ push(Immediate(Smi::FromInt(NONE))); |
| 1705 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1729 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| 1706 } | 1730 } |
| 1707 | 1731 |
| 1708 if (expr->has_function()) { | 1732 if (expr->has_function()) { |
| 1709 DCHECK(result_saved); | 1733 DCHECK(result_saved); |
| 1710 __ push(Operand(esp, 0)); | 1734 __ push(Operand(esp, 0)); |
| 1711 __ CallRuntime(Runtime::kToFastProperties, 1); | 1735 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 1712 } | 1736 } |
| 1713 | 1737 |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 Expression* value = property->value(); | 2452 Expression* value = property->value(); |
| 2429 DCHECK(key != NULL); | 2453 DCHECK(key != NULL); |
| 2430 | 2454 |
| 2431 if (property->is_static()) { | 2455 if (property->is_static()) { |
| 2432 __ push(Operand(esp, kPointerSize)); // constructor | 2456 __ push(Operand(esp, kPointerSize)); // constructor |
| 2433 } else { | 2457 } else { |
| 2434 __ push(Operand(esp, 0)); // prototype | 2458 __ push(Operand(esp, 0)); // prototype |
| 2435 } | 2459 } |
| 2436 VisitForStackValue(key); | 2460 VisitForStackValue(key); |
| 2437 VisitForStackValue(value); | 2461 VisitForStackValue(value); |
| 2462 EmitSetHomeObjectIfNeeded(value, 2); |
| 2438 | 2463 |
| 2439 switch (property->kind()) { | 2464 switch (property->kind()) { |
| 2440 case ObjectLiteral::Property::CONSTANT: | 2465 case ObjectLiteral::Property::CONSTANT: |
| 2441 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2466 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 2442 case ObjectLiteral::Property::COMPUTED: | 2467 case ObjectLiteral::Property::COMPUTED: |
| 2443 case ObjectLiteral::Property::PROTOTYPE: | 2468 case ObjectLiteral::Property::PROTOTYPE: |
| 2444 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2469 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
| 2445 break; | 2470 break; |
| 2446 | 2471 |
| 2447 case ObjectLiteral::Property::GETTER: | 2472 case ObjectLiteral::Property::GETTER: |
| (...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5204 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5229 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5205 Assembler::target_address_at(call_target_address, | 5230 Assembler::target_address_at(call_target_address, |
| 5206 unoptimized_code)); | 5231 unoptimized_code)); |
| 5207 return OSR_AFTER_STACK_CHECK; | 5232 return OSR_AFTER_STACK_CHECK; |
| 5208 } | 5233 } |
| 5209 | 5234 |
| 5210 | 5235 |
| 5211 } } // namespace v8::internal | 5236 } } // namespace v8::internal |
| 5212 | 5237 |
| 5213 #endif // V8_TARGET_ARCH_X87 | 5238 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |