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

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

Issue 2142333002: Refactor class declaration logic to the parser and runtime Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor cleanup per Adam Created 4 years, 5 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. 1895 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code.
1896 { 1896 {
1897 Assembler::BlockPoolsScope scope(masm_); 1897 Assembler::BlockPoolsScope scope(masm_);
1898 CallIC(code, expr->BinaryOperationFeedbackId()); 1898 CallIC(code, expr->BinaryOperationFeedbackId());
1899 patch_site.EmitPatchInfo(); 1899 patch_site.EmitPatchInfo();
1900 } 1900 }
1901 context()->Plug(x0); 1901 context()->Plug(x0);
1902 } 1902 }
1903 1903
1904 1904
1905 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1906 for (int i = 0; i < lit->properties()->length(); i++) {
1907 ObjectLiteral::Property* property = lit->properties()->at(i);
1908 Expression* value = property->value();
1909
1910 Register scratch = x1;
1911 if (property->is_static()) {
1912 __ Peek(scratch, kPointerSize); // constructor
1913 } else {
1914 __ Peek(scratch, 0); // prototype
1915 }
1916 PushOperand(scratch);
1917 EmitPropertyKey(property, lit->GetIdForProperty(i));
1918
1919 // The static prototype property is read only. We handle the non computed
1920 // property name case in the parser. Since this is the only case where we
1921 // need to check for an own read only property we special case this so we do
1922 // not need to do this for every property.
1923 if (property->is_static() && property->is_computed_name()) {
1924 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
1925 __ Push(x0);
1926 }
1927
1928 VisitForStackValue(value);
1929 if (NeedsHomeObject(value)) {
1930 EmitSetHomeObject(value, 2, property->GetSlot());
1931 }
1932
1933 switch (property->kind()) {
1934 case ObjectLiteral::Property::CONSTANT:
1935 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1936 case ObjectLiteral::Property::PROTOTYPE:
1937 UNREACHABLE();
1938 case ObjectLiteral::Property::COMPUTED:
1939 PushOperand(Smi::FromInt(DONT_ENUM));
1940 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1941 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1942 break;
1943
1944 case ObjectLiteral::Property::GETTER:
1945 PushOperand(Smi::FromInt(DONT_ENUM));
1946 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1947 break;
1948
1949 case ObjectLiteral::Property::SETTER:
1950 PushOperand(Smi::FromInt(DONT_ENUM));
1951 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1952 break;
1953
1954 default:
1955 UNREACHABLE();
1956 }
1957 }
1958 }
1959
1960
1961 void FullCodeGenerator::EmitAssignment(Expression* expr, 1905 void FullCodeGenerator::EmitAssignment(Expression* expr,
1962 FeedbackVectorSlot slot) { 1906 FeedbackVectorSlot slot) {
1963 DCHECK(expr->IsValidReferenceExpressionOrThis()); 1907 DCHECK(expr->IsValidReferenceExpressionOrThis());
1964 1908
1965 Property* prop = expr->AsProperty(); 1909 Property* prop = expr->AsProperty();
1966 LhsKind assign_type = Property::GetAssignType(prop); 1910 LhsKind assign_type = Property::GetAssignType(prop);
1967 1911
1968 switch (assign_type) { 1912 switch (assign_type) {
1969 case VARIABLE: { 1913 case VARIABLE: {
1970 Variable* var = expr->AsVariableProxy()->var(); 1914 Variable* var = expr->AsVariableProxy()->var();
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 } 3796 }
3853 3797
3854 return INTERRUPT; 3798 return INTERRUPT;
3855 } 3799 }
3856 3800
3857 3801
3858 } // namespace internal 3802 } // namespace internal
3859 } // namespace v8 3803 } // namespace v8
3860 3804
3861 #endif // V8_TARGET_ARCH_ARM64 3805 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698