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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 UNREACHABLE(); | 1887 UNREACHABLE(); |
1888 } | 1888 } |
1889 | 1889 |
1890 __ bind(&done); | 1890 __ bind(&done); |
1891 context()->Plug(eax); | 1891 context()->Plug(eax); |
1892 } | 1892 } |
1893 | 1893 |
1894 | 1894 |
1895 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 1895 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
1896 for (int i = 0; i < lit->properties()->length(); i++) { | 1896 for (int i = 0; i < lit->properties()->length(); i++) { |
1897 ObjectLiteral::Property* property = lit->properties()->at(i); | 1897 ClassLiteral::Property* property = lit->properties()->at(i); |
1898 Expression* value = property->value(); | 1898 Expression* value = property->value(); |
1899 | 1899 |
1900 if (property->is_static()) { | 1900 if (property->is_static()) { |
1901 PushOperand(Operand(esp, kPointerSize)); // constructor | 1901 PushOperand(Operand(esp, kPointerSize)); // constructor |
1902 } else { | 1902 } else { |
1903 PushOperand(Operand(esp, 0)); // prototype | 1903 PushOperand(Operand(esp, 0)); // prototype |
1904 } | 1904 } |
1905 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 1905 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
1906 | 1906 |
1907 // The static prototype property is read only. We handle the non computed | 1907 // The static prototype property is read only. We handle the non computed |
1908 // property name case in the parser. Since this is the only case where we | 1908 // property name case in the parser. Since this is the only case where we |
1909 // need to check for an own read only property we special case this so we do | 1909 // need to check for an own read only property we special case this so we do |
1910 // not need to do this for every property. | 1910 // not need to do this for every property. |
1911 if (property->is_static() && property->is_computed_name()) { | 1911 if (property->is_static() && property->is_computed_name()) { |
1912 __ CallRuntime(Runtime::kThrowIfStaticPrototype); | 1912 __ CallRuntime(Runtime::kThrowIfStaticPrototype); |
1913 __ push(eax); | 1913 __ push(eax); |
1914 } | 1914 } |
1915 | 1915 |
1916 VisitForStackValue(value); | 1916 VisitForStackValue(value); |
1917 if (NeedsHomeObject(value)) { | 1917 if (NeedsHomeObject(value)) { |
1918 EmitSetHomeObject(value, 2, property->GetSlot()); | 1918 EmitSetHomeObject(value, 2, property->GetSlot()); |
1919 } | 1919 } |
1920 | 1920 |
1921 switch (property->kind()) { | 1921 switch (property->kind()) { |
1922 case ObjectLiteral::Property::CONSTANT: | 1922 case ClassLiteral::Property::METHOD: |
1923 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | |
1924 case ObjectLiteral::Property::PROTOTYPE: | |
1925 UNREACHABLE(); | |
1926 case ObjectLiteral::Property::COMPUTED: | |
1927 PushOperand(Smi::FromInt(DONT_ENUM)); | 1923 PushOperand(Smi::FromInt(DONT_ENUM)); |
1928 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); | 1924 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); |
1929 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); | 1925 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); |
1930 break; | 1926 break; |
1931 | 1927 |
1932 case ObjectLiteral::Property::GETTER: | 1928 case ClassLiteral::Property::GETTER: |
1933 PushOperand(Smi::FromInt(DONT_ENUM)); | 1929 PushOperand(Smi::FromInt(DONT_ENUM)); |
1934 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | 1930 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); |
1935 break; | 1931 break; |
1936 | 1932 |
1937 case ObjectLiteral::Property::SETTER: | 1933 case ClassLiteral::Property::SETTER: |
1938 PushOperand(Smi::FromInt(DONT_ENUM)); | 1934 PushOperand(Smi::FromInt(DONT_ENUM)); |
1939 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | 1935 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); |
1940 break; | 1936 break; |
1941 } | 1937 } |
1942 } | 1938 } |
1943 } | 1939 } |
1944 | 1940 |
1945 | 1941 |
1946 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 1942 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
1947 PopOperand(edx); | 1943 PopOperand(edx); |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 isolate->builtins()->OnStackReplacement()->entry(), | 3627 isolate->builtins()->OnStackReplacement()->entry(), |
3632 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3628 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3633 return ON_STACK_REPLACEMENT; | 3629 return ON_STACK_REPLACEMENT; |
3634 } | 3630 } |
3635 | 3631 |
3636 | 3632 |
3637 } // namespace internal | 3633 } // namespace internal |
3638 } // namespace v8 | 3634 } // namespace v8 |
3639 | 3635 |
3640 #endif // V8_TARGET_ARCH_IA32 | 3636 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |