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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 default: | 1682 default: |
1683 UNREACHABLE(); | 1683 UNREACHABLE(); |
1684 break; | 1684 break; |
1685 } | 1685 } |
1686 | 1686 |
1687 __ bind(&done); | 1687 __ bind(&done); |
1688 context()->Plug(rax); | 1688 context()->Plug(rax); |
1689 } | 1689 } |
1690 | 1690 |
1691 | 1691 |
1692 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | |
1693 for (int i = 0; i < lit->properties()->length(); i++) { | |
1694 ClassLiteral::Property* property = lit->properties()->at(i); | |
1695 Expression* value = property->value(); | |
1696 | |
1697 if (property->is_static()) { | |
1698 PushOperand(Operand(rsp, kPointerSize)); // constructor | |
1699 } else { | |
1700 PushOperand(Operand(rsp, 0)); // prototype | |
1701 } | |
1702 EmitPropertyKey(property, lit->GetIdForProperty(i)); | |
1703 | |
1704 // The static prototype property is read only. We handle the non computed | |
1705 // property name case in the parser. Since this is the only case where we | |
1706 // need to check for an own read only property we special case this so we do | |
1707 // not need to do this for every property. | |
1708 if (property->is_static() && property->is_computed_name()) { | |
1709 __ CallRuntime(Runtime::kThrowIfStaticPrototype); | |
1710 __ Push(rax); | |
1711 } | |
1712 | |
1713 VisitForStackValue(value); | |
1714 if (NeedsHomeObject(value)) { | |
1715 EmitSetHomeObject(value, 2, property->GetSlot()); | |
1716 } | |
1717 | |
1718 switch (property->kind()) { | |
1719 case ClassLiteral::Property::METHOD: | |
1720 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1721 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); | |
1722 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); | |
1723 break; | |
1724 | |
1725 case ClassLiteral::Property::GETTER: | |
1726 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1727 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | |
1728 break; | |
1729 | |
1730 case ClassLiteral::Property::SETTER: | |
1731 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1732 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | |
1733 break; | |
1734 | |
1735 case ClassLiteral::Property::FIELD: | |
1736 default: | |
1737 UNREACHABLE(); | |
1738 } | |
1739 } | |
1740 } | |
1741 | |
1742 | |
1743 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 1692 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
1744 PopOperand(rdx); | 1693 PopOperand(rdx); |
1745 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 1694 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
1746 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 1695 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
1747 CallIC(code, expr->BinaryOperationFeedbackId()); | 1696 CallIC(code, expr->BinaryOperationFeedbackId()); |
1748 patch_site.EmitPatchInfo(); | 1697 patch_site.EmitPatchInfo(); |
1749 context()->Plug(rax); | 1698 context()->Plug(rax); |
1750 } | 1699 } |
1751 | 1700 |
1752 | 1701 |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 DCHECK_EQ( | 3178 DCHECK_EQ( |
3230 isolate->builtins()->OnStackReplacement()->entry(), | 3179 isolate->builtins()->OnStackReplacement()->entry(), |
3231 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3180 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3232 return ON_STACK_REPLACEMENT; | 3181 return ON_STACK_REPLACEMENT; |
3233 } | 3182 } |
3234 | 3183 |
3235 } // namespace internal | 3184 } // namespace internal |
3236 } // namespace v8 | 3185 } // namespace v8 |
3237 | 3186 |
3238 #endif // V8_TARGET_ARCH_X64 | 3187 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |