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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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 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/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 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 break; 1909 break;
1910 default: 1910 default:
1911 UNREACHABLE(); 1911 UNREACHABLE();
1912 } 1912 }
1913 1913
1914 __ bind(&done); 1914 __ bind(&done);
1915 context()->Plug(eax); 1915 context()->Plug(eax);
1916 } 1916 }
1917 1917
1918 1918
1919 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1920 for (int i = 0; i < lit->properties()->length(); i++) {
1921 ObjectLiteral::Property* property = lit->properties()->at(i);
1922 Expression* value = property->value();
1923
1924 if (property->is_static()) {
1925 PushOperand(Operand(esp, kPointerSize)); // constructor
1926 } else {
1927 PushOperand(Operand(esp, 0)); // prototype
1928 }
1929 EmitPropertyKey(property, lit->GetIdForProperty(i));
1930
1931 // The static prototype property is read only. We handle the non computed
1932 // property name case in the parser. Since this is the only case where we
1933 // need to check for an own read only property we special case this so we do
1934 // not need to do this for every property.
1935 if (property->is_static() && property->is_computed_name()) {
1936 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
1937 __ push(eax);
1938 }
1939
1940 VisitForStackValue(value);
1941 if (NeedsHomeObject(value)) {
1942 EmitSetHomeObject(value, 2, property->GetSlot());
1943 }
1944
1945 switch (property->kind()) {
1946 case ObjectLiteral::Property::CONSTANT:
1947 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1948 case ObjectLiteral::Property::PROTOTYPE:
1949 UNREACHABLE();
1950 case ObjectLiteral::Property::COMPUTED:
1951 PushOperand(Smi::FromInt(DONT_ENUM));
1952 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
1953 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1954 break;
1955
1956 case ObjectLiteral::Property::GETTER:
1957 PushOperand(Smi::FromInt(DONT_ENUM));
1958 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1959 break;
1960
1961 case ObjectLiteral::Property::SETTER:
1962 PushOperand(Smi::FromInt(DONT_ENUM));
1963 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1964 break;
1965 }
1966 }
1967 }
1968
1969
1970 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 1919 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
1971 PopOperand(edx); 1920 PopOperand(edx);
1972 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 1921 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
1973 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 1922 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
1974 CallIC(code, expr->BinaryOperationFeedbackId()); 1923 CallIC(code, expr->BinaryOperationFeedbackId());
1975 patch_site.EmitPatchInfo(); 1924 patch_site.EmitPatchInfo();
1976 context()->Plug(eax); 1925 context()->Plug(eax);
1977 } 1926 }
1978 1927
1979 1928
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 isolate->builtins()->OnStackReplacement()->entry(), 3624 isolate->builtins()->OnStackReplacement()->entry(),
3676 Assembler::target_address_at(call_target_address, unoptimized_code)); 3625 Assembler::target_address_at(call_target_address, unoptimized_code));
3677 return ON_STACK_REPLACEMENT; 3626 return ON_STACK_REPLACEMENT;
3678 } 3627 }
3679 3628
3680 3629
3681 } // namespace internal 3630 } // namespace internal
3682 } // namespace v8 3631 } // namespace v8
3683 3632
3684 #endif // V8_TARGET_ARCH_IA32 3633 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698