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

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

Powered by Google App Engine
This is Rietveld 408576698