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

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: rebase 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
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 UNREACHABLE(); 1879 UNREACHABLE();
1880 } 1880 }
1881 1881
1882 __ bind(&done); 1882 __ bind(&done);
1883 context()->Plug(eax); 1883 context()->Plug(eax);
1884 } 1884 }
1885 1885
1886 1886
1887 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1887 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1888 for (int i = 0; i < lit->properties()->length(); i++) { 1888 for (int i = 0; i < lit->properties()->length(); i++) {
1889 ObjectLiteral::Property* property = lit->properties()->at(i); 1889 ClassLiteral::Property* property = lit->properties()->at(i);
1890 Expression* value = property->value(); 1890 Expression* value = property->value();
1891 1891
1892 if (property->is_static()) { 1892 if (property->is_static()) {
1893 PushOperand(Operand(esp, kPointerSize)); // constructor 1893 PushOperand(Operand(esp, kPointerSize)); // constructor
1894 } else { 1894 } else {
1895 PushOperand(Operand(esp, 0)); // prototype 1895 PushOperand(Operand(esp, 0)); // prototype
1896 } 1896 }
1897 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1897 EmitPropertyKey(property, lit->GetIdForProperty(i));
1898 1898
1899 // The static prototype property is read only. We handle the non computed 1899 // The static prototype property is read only. We handle the non computed
1900 // property name case in the parser. Since this is the only case where we 1900 // property name case in the parser. Since this is the only case where we
1901 // need to check for an own read only property we special case this so we do 1901 // need to check for an own read only property we special case this so we do
1902 // not need to do this for every property. 1902 // not need to do this for every property.
1903 if (property->is_static() && property->is_computed_name()) { 1903 if (property->is_static() && property->is_computed_name()) {
1904 __ CallRuntime(Runtime::kThrowIfStaticPrototype); 1904 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
1905 __ push(eax); 1905 __ push(eax);
1906 } 1906 }
1907 1907
1908 VisitForStackValue(value); 1908 VisitForStackValue(value);
1909 if (NeedsHomeObject(value)) { 1909 if (NeedsHomeObject(value)) {
1910 EmitSetHomeObject(value, 2, property->GetSlot()); 1910 EmitSetHomeObject(value, 2, property->GetSlot());
1911 } 1911 }
1912 1912
1913 switch (property->kind()) { 1913 switch (property->kind()) {
1914 case ObjectLiteral::Property::CONSTANT: 1914 case ClassLiteral::Property::METHOD:
1915 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1916 case ObjectLiteral::Property::PROTOTYPE:
1917 UNREACHABLE();
1918 case ObjectLiteral::Property::COMPUTED:
1919 PushOperand(Smi::FromInt(DONT_ENUM)); 1915 PushOperand(Smi::FromInt(DONT_ENUM));
1920 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); 1916 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1921 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); 1917 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1922 break; 1918 break;
1923 1919
1924 case ObjectLiteral::Property::GETTER: 1920 case ClassLiteral::Property::GETTER:
1925 PushOperand(Smi::FromInt(DONT_ENUM)); 1921 PushOperand(Smi::FromInt(DONT_ENUM));
1926 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 1922 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1927 break; 1923 break;
1928 1924
1929 case ObjectLiteral::Property::SETTER: 1925 case ClassLiteral::Property::SETTER:
1930 PushOperand(Smi::FromInt(DONT_ENUM)); 1926 PushOperand(Smi::FromInt(DONT_ENUM));
1931 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 1927 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1932 break; 1928 break;
1933 } 1929 }
1934 } 1930 }
1935 } 1931 }
1936 1932
1937 1933
1938 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 1934 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
1939 PopOperand(edx); 1935 PopOperand(edx);
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 isolate->builtins()->OnStackReplacement()->entry(), 3619 isolate->builtins()->OnStackReplacement()->entry(),
3624 Assembler::target_address_at(call_target_address, unoptimized_code)); 3620 Assembler::target_address_at(call_target_address, unoptimized_code));
3625 return ON_STACK_REPLACEMENT; 3621 return ON_STACK_REPLACEMENT;
3626 } 3622 }
3627 3623
3628 3624
3629 } // namespace internal 3625 } // namespace internal
3630 } // namespace v8 3626 } // namespace v8
3631 3627
3632 #endif // V8_TARGET_ARCH_X87 3628 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698