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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 default: | 1895 default: |
1896 UNREACHABLE(); | 1896 UNREACHABLE(); |
1897 break; | 1897 break; |
1898 } | 1898 } |
1899 | 1899 |
1900 __ bind(&done); | 1900 __ bind(&done); |
1901 context()->Plug(rax); | 1901 context()->Plug(rax); |
1902 } | 1902 } |
1903 | 1903 |
1904 | 1904 |
1905 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | |
1906 for (int i = 0; i < lit->properties()->length(); i++) { | |
1907 ObjectLiteral::Property* property = lit->properties()->at(i); | |
1908 Expression* value = property->value(); | |
1909 | |
1910 if (property->is_static()) { | |
1911 PushOperand(Operand(rsp, kPointerSize)); // constructor | |
1912 } else { | |
1913 PushOperand(Operand(rsp, 0)); // prototype | |
1914 } | |
1915 EmitPropertyKey(property, lit->GetIdForProperty(i)); | |
1916 | |
1917 // The static prototype property is read only. We handle the non computed | |
1918 // property name case in the parser. Since this is the only case where we | |
1919 // need to check for an own read only property we special case this so we do | |
1920 // not need to do this for every property. | |
1921 if (property->is_static() && property->is_computed_name()) { | |
1922 __ CallRuntime(Runtime::kThrowIfStaticPrototype); | |
1923 __ Push(rax); | |
1924 } | |
1925 | |
1926 VisitForStackValue(value); | |
1927 if (NeedsHomeObject(value)) { | |
1928 EmitSetHomeObject(value, 2, property->GetSlot()); | |
1929 } | |
1930 | |
1931 switch (property->kind()) { | |
1932 case ObjectLiteral::Property::CONSTANT: | |
1933 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | |
1934 case ObjectLiteral::Property::PROTOTYPE: | |
1935 UNREACHABLE(); | |
1936 case ObjectLiteral::Property::COMPUTED: | |
1937 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1938 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); | |
1939 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); | |
1940 break; | |
1941 | |
1942 case ObjectLiteral::Property::GETTER: | |
1943 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1944 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | |
1945 break; | |
1946 | |
1947 case ObjectLiteral::Property::SETTER: | |
1948 PushOperand(Smi::FromInt(DONT_ENUM)); | |
1949 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | |
1950 break; | |
1951 | |
1952 default: | |
1953 UNREACHABLE(); | |
1954 } | |
1955 } | |
1956 } | |
1957 | |
1958 | |
1959 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 1905 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
1960 PopOperand(rdx); | 1906 PopOperand(rdx); |
1961 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 1907 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
1962 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 1908 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
1963 CallIC(code, expr->BinaryOperationFeedbackId()); | 1909 CallIC(code, expr->BinaryOperationFeedbackId()); |
1964 patch_site.EmitPatchInfo(); | 1910 patch_site.EmitPatchInfo(); |
1965 context()->Plug(rax); | 1911 context()->Plug(rax); |
1966 } | 1912 } |
1967 | 1913 |
1968 | 1914 |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3659 DCHECK_EQ( | 3605 DCHECK_EQ( |
3660 isolate->builtins()->OnStackReplacement()->entry(), | 3606 isolate->builtins()->OnStackReplacement()->entry(), |
3661 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3607 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3662 return ON_STACK_REPLACEMENT; | 3608 return ON_STACK_REPLACEMENT; |
3663 } | 3609 } |
3664 | 3610 |
3665 } // namespace internal | 3611 } // namespace internal |
3666 } // namespace v8 | 3612 } // namespace v8 |
3667 | 3613 |
3668 #endif // V8_TARGET_ARCH_X64 | 3614 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |