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

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

Powered by Google App Engine
This is Rietveld 408576698