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

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

Issue 2330473002: Class fields, part 3 (backends)
Patch Set: clean up test properly 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_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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ClassLiteral::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->kind() == ClassLiteral::Property::FIELD &&
1892 !property->is_static()) {
1893 // This just does the ToName call on the field name and stores it in a
1894 // variable (a proxy for which is the value() of this property)
1895 DCHECK(property->value()->IsVariableProxy());
1896 Variable* variable = property->value()->AsVariableProxy()->var();
1897 VisitForStackValue(property->key());
1898 EmitVariableAssignment(variable, Token::INIT,
1899 FeedbackVectorSlot::Invalid());
1900 DropOperands(1);
1901 continue;
1902 }
1903
1891 if (property->is_static()) { 1904 if (property->is_static()) {
1892 PushOperand(Operand(rsp, kPointerSize)); // constructor 1905 PushOperand(Operand(rsp, kPointerSize)); // constructor
1893 } else { 1906 } else {
1894 PushOperand(Operand(rsp, 0)); // prototype 1907 PushOperand(Operand(rsp, 0)); // prototype
1895 } 1908 }
1896 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1909 EmitPropertyKey(property, lit->GetIdForProperty(i));
1897 1910
1898 // The static prototype property is read only. We handle the non computed 1911 // 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 1912 // 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 1913 // need to check for an own read only property we special case this so we do
(...skipping 19 matching lines...) Expand all
1920 PushOperand(Smi::FromInt(DONT_ENUM)); 1933 PushOperand(Smi::FromInt(DONT_ENUM));
1921 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 1934 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1922 break; 1935 break;
1923 1936
1924 case ClassLiteral::Property::SETTER: 1937 case ClassLiteral::Property::SETTER:
1925 PushOperand(Smi::FromInt(DONT_ENUM)); 1938 PushOperand(Smi::FromInt(DONT_ENUM));
1926 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 1939 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1927 break; 1940 break;
1928 1941
1929 case ClassLiteral::Property::FIELD: 1942 case ClassLiteral::Property::FIELD:
1930 default: 1943 DCHECK(property->is_static());
1931 UNREACHABLE(); 1944 PushOperand(Smi::FromInt(DONT_ENUM));
1945 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1946 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1947 break;
1932 } 1948 }
1933 } 1949 }
1934 } 1950 }
1935 1951
1936 1952
1937 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 1953 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
1938 PopOperand(rdx); 1954 PopOperand(rdx);
1939 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 1955 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
1940 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 1956 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
1941 CallIC(code, expr->BinaryOperationFeedbackId()); 1957 CallIC(code, expr->BinaryOperationFeedbackId());
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 DCHECK_EQ( 3634 DCHECK_EQ(
3619 isolate->builtins()->OnStackReplacement()->entry(), 3635 isolate->builtins()->OnStackReplacement()->entry(),
3620 Assembler::target_address_at(call_target_address, unoptimized_code)); 3636 Assembler::target_address_at(call_target_address, unoptimized_code));
3621 return ON_STACK_REPLACEMENT; 3637 return ON_STACK_REPLACEMENT;
3622 } 3638 }
3623 3639
3624 } // namespace internal 3640 } // namespace internal
3625 } // namespace v8 3641 } // namespace v8
3626 3642
3627 #endif // V8_TARGET_ARCH_X64 3643 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698