Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.cc

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: remove spurious classliteralproperty typedef Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_X87 5 #if V8_TARGET_ARCH_X87
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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 UNREACHABLE(); 1881 UNREACHABLE();
1882 } 1882 }
1883 1883
1884 __ bind(&done); 1884 __ bind(&done);
1885 context()->Plug(eax); 1885 context()->Plug(eax);
1886 } 1886 }
1887 1887
1888 1888
1889 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1889 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1890 for (int i = 0; i < lit->properties()->length(); i++) { 1890 for (int i = 0; i < lit->properties()->length(); i++) {
1891 ObjectLiteral::Property* property = lit->properties()->at(i); 1891 ClassLiteral::Property* property = lit->properties()->at(i);
1892 Expression* value = property->value(); 1892 Expression* value = property->value();
1893 1893
1894 if (property->is_static()) { 1894 if (property->is_static()) {
1895 PushOperand(Operand(esp, kPointerSize)); // constructor 1895 PushOperand(Operand(esp, kPointerSize)); // constructor
1896 } else { 1896 } else {
1897 PushOperand(Operand(esp, 0)); // prototype 1897 PushOperand(Operand(esp, 0)); // prototype
1898 } 1898 }
1899 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1899 EmitPropertyKey(property, lit->GetIdForProperty(i));
1900 1900
1901 // The static prototype property is read only. We handle the non computed 1901 // The static prototype property is read only. We handle the non computed
1902 // property name case in the parser. Since this is the only case where we 1902 // property name case in the parser. Since this is the only case where we
1903 // need to check for an own read only property we special case this so we do 1903 // need to check for an own read only property we special case this so we do
1904 // not need to do this for every property. 1904 // not need to do this for every property.
1905 if (property->is_static() && property->is_computed_name()) { 1905 if (property->is_static() && property->is_computed_name()) {
1906 __ CallRuntime(Runtime::kThrowIfStaticPrototype); 1906 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
1907 __ push(eax); 1907 __ push(eax);
1908 } 1908 }
1909 1909
1910 VisitForStackValue(value); 1910 VisitForStackValue(value);
1911 if (NeedsHomeObject(value)) { 1911 if (NeedsHomeObject(value)) {
1912 EmitSetHomeObject(value, 2, property->GetSlot()); 1912 EmitSetHomeObject(value, 2, property->GetSlot());
1913 } 1913 }
1914 1914
1915 switch (property->kind()) { 1915 switch (property->kind()) {
1916 case ObjectLiteral::Property::CONSTANT: 1916 case ClassLiteral::Property::METHOD:
1917 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1918 case ObjectLiteral::Property::PROTOTYPE:
1919 UNREACHABLE();
1920 case ObjectLiteral::Property::COMPUTED:
1921 PushOperand(Smi::FromInt(DONT_ENUM)); 1917 PushOperand(Smi::FromInt(DONT_ENUM));
1922 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); 1918 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1923 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); 1919 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1924 break; 1920 break;
1925 1921
1926 case ObjectLiteral::Property::GETTER: 1922 case ClassLiteral::Property::GETTER:
1927 PushOperand(Smi::FromInt(DONT_ENUM)); 1923 PushOperand(Smi::FromInt(DONT_ENUM));
1928 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 1924 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1929 break; 1925 break;
1930 1926
1931 case ObjectLiteral::Property::SETTER: 1927 case ClassLiteral::Property::SETTER:
1932 PushOperand(Smi::FromInt(DONT_ENUM)); 1928 PushOperand(Smi::FromInt(DONT_ENUM));
1933 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 1929 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1934 break; 1930 break;
1935 } 1931 }
1936 } 1932 }
1937 } 1933 }
1938 1934
1939 1935
1940 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 1936 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
1941 PopOperand(edx); 1937 PopOperand(edx);
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_X87 3636 #endif // V8_TARGET_ARCH_X87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698