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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 __ xor_(eax, ecx); | 1690 __ xor_(eax, ecx); |
1691 break; | 1691 break; |
1692 default: | 1692 default: |
1693 UNREACHABLE(); | 1693 UNREACHABLE(); |
1694 } | 1694 } |
1695 | 1695 |
1696 __ bind(&done); | 1696 __ bind(&done); |
1697 context()->Plug(eax); | 1697 context()->Plug(eax); |
1698 } | 1698 } |
1699 | 1699 |
1700 | |
1701 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | |
1702 for (int i = 0; i < lit->properties()->length(); i++) { | |
1703 ClassLiteral::Property* property = lit->properties()->at(i); | |
1704 Expression* value = property->value(); | |
1705 | |
1706 if (property->is_static()) { | |
1707 PushOperand(Operand(esp, kPointerSize)); // constructor | |
1708 } else { | |
1709 PushOperand(Operand(esp, 0)); // prototype | |
1710 } | |
1711 EmitPropertyKey(property, lit->GetIdForProperty(i)); | |
1712 | |
1713 // The static prototype property is read only. We handle the non computed | |
1714 // property name case in the parser. Since this is the only case where we | |
1715 // need to check for an own read only property we special case this so we do | |
1716 // not need to do this for every property. | |
1717 if (property->is_static() && property->is_computed_name()) { | |
1718 __ CallRuntime(Runtime::kThrowIfStaticPrototype); | |
1719 __ push(eax); | |
1720 } | |
1721 | |
1722 VisitForStackValue(value); | |
1723 if (NeedsHomeObject(value)) { | |
1724 EmitSetHomeObject(value, 2, property->GetSlot()); | |
1725 } | |
1726 | |
1727 switch (property->kind()) { | |
1728 case ClassLiteral::Property::METHOD: | |
1729 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1730 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); | |
1731 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); | |
1732 break; | |
1733 | |
1734 case ClassLiteral::Property::GETTER: | |
1735 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1736 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | |
1737 break; | |
1738 | |
1739 case ClassLiteral::Property::SETTER: | |
1740 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1741 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | |
1742 break; | |
1743 | |
1744 case ClassLiteral::Property::FIELD: | |
1745 UNREACHABLE(); | |
1746 break; | |
1747 } | |
1748 } | |
1749 } | |
1750 | |
1751 | |
1752 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 1700 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
1753 PopOperand(edx); | 1701 PopOperand(edx); |
1754 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 1702 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
1755 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 1703 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
1756 CallIC(code, expr->BinaryOperationFeedbackId()); | 1704 CallIC(code, expr->BinaryOperationFeedbackId()); |
1757 patch_site.EmitPatchInfo(); | 1705 patch_site.EmitPatchInfo(); |
1758 context()->Plug(eax); | 1706 context()->Plug(eax); |
1759 } | 1707 } |
1760 | 1708 |
1761 | 1709 |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 isolate->builtins()->OnStackReplacement()->entry(), | 3190 isolate->builtins()->OnStackReplacement()->entry(), |
3243 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3191 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3244 return ON_STACK_REPLACEMENT; | 3192 return ON_STACK_REPLACEMENT; |
3245 } | 3193 } |
3246 | 3194 |
3247 | 3195 |
3248 } // namespace internal | 3196 } // namespace internal |
3249 } // namespace v8 | 3197 } // namespace v8 |
3250 | 3198 |
3251 #endif // V8_TARGET_ARCH_IA32 | 3199 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |