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