OLD | NEW |
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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 break; | 1918 break; |
1919 | 1919 |
1920 case ClassLiteral::Property::FIELD: | 1920 case ClassLiteral::Property::FIELD: |
1921 default: | 1921 default: |
1922 UNREACHABLE(); | 1922 UNREACHABLE(); |
1923 } | 1923 } |
1924 } | 1924 } |
1925 } | 1925 } |
1926 | 1926 |
1927 | 1927 |
| 1928 void FullCodeGenerator::EmitClassDefineNameProperty(ClassLiteral* lit) { |
| 1929 DCHECK(!lit->constructor()->name().is_null()); |
| 1930 |
| 1931 // abort if 'name' is undefined |
| 1932 if (lit->constructor()->name()->length() == 0) return; |
| 1933 |
| 1934 Label exit; |
| 1935 |
| 1936 // if "name" is already defined, exit |
| 1937 PushOperand(Operand(rsp, 0)); // constructor |
| 1938 PushOperand(isolate()->factory()->name_string()); |
| 1939 CallRuntimeWithOperands(Runtime::kObjectHasOwnProperty); |
| 1940 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); |
| 1941 __ j(equal, &exit, Label::kNear); |
| 1942 |
| 1943 // define "name" property |
| 1944 PushOperand(Operand(rsp, 0)); // constructor |
| 1945 PushOperand(isolate()->factory()->name_string()); |
| 1946 PushOperand(lit->constructor()->name()); |
| 1947 PushOperand(Smi::FromInt(DONT_ENUM | READ_ONLY)); |
| 1948 PushOperand(Smi::FromInt(0)); // NeedsSetFunctionName() |
| 1949 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); |
| 1950 |
| 1951 __ bind(&exit); |
| 1952 } |
| 1953 |
| 1954 |
1928 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 1955 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
1929 PopOperand(rdx); | 1956 PopOperand(rdx); |
1930 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 1957 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
1931 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 1958 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
1932 CallIC(code, expr->BinaryOperationFeedbackId()); | 1959 CallIC(code, expr->BinaryOperationFeedbackId()); |
1933 patch_site.EmitPatchInfo(); | 1960 patch_site.EmitPatchInfo(); |
1934 context()->Plug(rax); | 1961 context()->Plug(rax); |
1935 } | 1962 } |
1936 | 1963 |
1937 | 1964 |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 DCHECK_EQ( | 3636 DCHECK_EQ( |
3610 isolate->builtins()->OnStackReplacement()->entry(), | 3637 isolate->builtins()->OnStackReplacement()->entry(), |
3611 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3638 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3612 return ON_STACK_REPLACEMENT; | 3639 return ON_STACK_REPLACEMENT; |
3613 } | 3640 } |
3614 | 3641 |
3615 } // namespace internal | 3642 } // namespace internal |
3616 } // namespace v8 | 3643 } // namespace v8 |
3617 | 3644 |
3618 #endif // V8_TARGET_ARCH_X64 | 3645 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |