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/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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 UNREACHABLE(); | 2126 UNREACHABLE(); |
2127 break; | 2127 break; |
2128 } | 2128 } |
2129 | 2129 |
2130 __ bind(&done); | 2130 __ bind(&done); |
2131 context()->Plug(rax); | 2131 context()->Plug(rax); |
2132 } | 2132 } |
2133 | 2133 |
2134 | 2134 |
2135 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2135 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
2136 // Constructor is in rax. | |
2137 DCHECK(lit != NULL); | |
2138 __ Push(rax); | |
2139 | |
2140 // No access check is needed here since the constructor is created by the | |
2141 // class literal. | |
2142 Register scratch = rbx; | |
2143 __ movp(scratch, FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset)); | |
2144 __ Push(scratch); | |
2145 | |
2146 for (int i = 0; i < lit->properties()->length(); i++) { | 2136 for (int i = 0; i < lit->properties()->length(); i++) { |
2147 ObjectLiteral::Property* property = lit->properties()->at(i); | 2137 ObjectLiteral::Property* property = lit->properties()->at(i); |
2148 Expression* value = property->value(); | 2138 Expression* value = property->value(); |
2149 | 2139 |
2150 if (property->is_static()) { | 2140 if (property->is_static()) { |
2151 __ Push(Operand(rsp, kPointerSize)); // constructor | 2141 __ Push(Operand(rsp, kPointerSize)); // constructor |
2152 } else { | 2142 } else { |
2153 __ Push(Operand(rsp, 0)); // prototype | 2143 __ Push(Operand(rsp, 0)); // prototype |
2154 } | 2144 } |
2155 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2145 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
(...skipping 30 matching lines...) Expand all Loading... |
2186 | 2176 |
2187 case ObjectLiteral::Property::SETTER: | 2177 case ObjectLiteral::Property::SETTER: |
2188 __ Push(Smi::FromInt(DONT_ENUM)); | 2178 __ Push(Smi::FromInt(DONT_ENUM)); |
2189 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); | 2179 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); |
2190 break; | 2180 break; |
2191 | 2181 |
2192 default: | 2182 default: |
2193 UNREACHABLE(); | 2183 UNREACHABLE(); |
2194 } | 2184 } |
2195 } | 2185 } |
2196 | |
2197 // Set both the prototype and constructor to have fast properties, and also | |
2198 // freeze them in strong mode. | |
2199 __ CallRuntime(Runtime::kFinalizeClassDefinition); | |
2200 } | 2186 } |
2201 | 2187 |
2202 | 2188 |
2203 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2189 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2204 __ Pop(rdx); | 2190 __ Pop(rdx); |
2205 Handle<Code> code = | 2191 Handle<Code> code = |
2206 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2192 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2207 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2193 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2208 CallIC(code, expr->BinaryOperationFeedbackId()); | 2194 CallIC(code, expr->BinaryOperationFeedbackId()); |
2209 patch_site.EmitPatchInfo(); | 2195 patch_site.EmitPatchInfo(); |
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4599 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4614 Assembler::target_address_at(call_target_address, | 4600 Assembler::target_address_at(call_target_address, |
4615 unoptimized_code)); | 4601 unoptimized_code)); |
4616 return OSR_AFTER_STACK_CHECK; | 4602 return OSR_AFTER_STACK_CHECK; |
4617 } | 4603 } |
4618 | 4604 |
4619 } // namespace internal | 4605 } // namespace internal |
4620 } // namespace v8 | 4606 } // namespace v8 |
4621 | 4607 |
4622 #endif // V8_TARGET_ARCH_X64 | 4608 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |