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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 __ bind(&done); 1890 __ bind(&done);
1891 context()->Plug(eax); 1891 context()->Plug(eax);
1892 } 1892 }
1893 1893
1894 1894
1895 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1895 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1896 for (int i = 0; i < lit->properties()->length(); i++) { 1896 for (int i = 0; i < lit->properties()->length(); i++) {
1897 ClassLiteral::Property* property = lit->properties()->at(i); 1897 ClassLiteral::Property* property = lit->properties()->at(i);
1898 Expression* value = property->value(); 1898 Expression* value = property->value();
1899 1899
1900 if (property->kind() == ClassLiteral::Property::FIELD &&
1901 !property->is_static()) {
1902 // This just does the ToName call on the field name and stores it in a
1903 // variable (a proxy for which is the value() of this property)
1904 DCHECK(property->value()->IsVariableProxy());
1905 Variable* variable = property->value()->AsVariableProxy()->var();
1906 VisitForStackValue(property->key());
1907 EmitVariableAssignment(variable, Token::INIT,
1908 FeedbackVectorSlot::Invalid());
1909 DropOperands(1);
1910 continue;
1911 }
1912
1900 if (property->is_static()) { 1913 if (property->is_static()) {
1901 PushOperand(Operand(esp, kPointerSize)); // constructor 1914 PushOperand(Operand(esp, kPointerSize)); // constructor
1902 } else { 1915 } else {
1903 PushOperand(Operand(esp, 0)); // prototype 1916 PushOperand(Operand(esp, 0)); // prototype
1904 } 1917 }
1905 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1918 EmitPropertyKey(property, lit->GetIdForProperty(i));
1906 1919
1907 // The static prototype property is read only. We handle the non computed 1920 // The static prototype property is read only. We handle the non computed
1908 // property name case in the parser. Since this is the only case where we 1921 // property name case in the parser. Since this is the only case where we
1909 // need to check for an own read only property we special case this so we do 1922 // need to check for an own read only property we special case this so we do
(...skipping 19 matching lines...) Expand all
1929 PushOperand(Smi::FromInt(DONT_ENUM)); 1942 PushOperand(Smi::FromInt(DONT_ENUM));
1930 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 1943 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1931 break; 1944 break;
1932 1945
1933 case ClassLiteral::Property::SETTER: 1946 case ClassLiteral::Property::SETTER:
1934 PushOperand(Smi::FromInt(DONT_ENUM)); 1947 PushOperand(Smi::FromInt(DONT_ENUM));
1935 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 1948 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1936 break; 1949 break;
1937 1950
1938 case ClassLiteral::Property::FIELD: 1951 case ClassLiteral::Property::FIELD:
1939 UNREACHABLE(); 1952 DCHECK(property->is_static());
1953 PushOperand(Smi::FromInt(DONT_ENUM));
1954 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1955 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1940 break; 1956 break;
1941 } 1957 }
1942 } 1958 }
1943 } 1959 }
1944 1960
1945 1961
1946 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 1962 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
1947 PopOperand(edx); 1963 PopOperand(edx);
1948 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 1964 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
1949 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 1965 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 isolate->builtins()->OnStackReplacement()->entry(), 3647 isolate->builtins()->OnStackReplacement()->entry(),
3632 Assembler::target_address_at(call_target_address, unoptimized_code)); 3648 Assembler::target_address_at(call_target_address, unoptimized_code));
3633 return ON_STACK_REPLACEMENT; 3649 return ON_STACK_REPLACEMENT;
3634 } 3650 }
3635 3651
3636 3652
3637 } // namespace internal 3653 } // namespace internal
3638 } // namespace v8 3654 } // namespace v8
3639 3655
3640 #endif // V8_TARGET_ARCH_IA32 3656 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698