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