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

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

Powered by Google App Engine
This is Rietveld 408576698