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

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

Powered by Google App Engine
This is Rietveld 408576698