| 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_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 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 default: | 2140 default: |
| 2141 UNREACHABLE(); | 2141 UNREACHABLE(); |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 __ bind(&done); | 2144 __ bind(&done); |
| 2145 context()->Plug(eax); | 2145 context()->Plug(eax); |
| 2146 } | 2146 } |
| 2147 | 2147 |
| 2148 | 2148 |
| 2149 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2149 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
| 2150 // Constructor is in eax. | |
| 2151 DCHECK(lit != NULL); | |
| 2152 __ push(eax); | |
| 2153 | |
| 2154 // No access check is needed here since the constructor is created by the | |
| 2155 // class literal. | |
| 2156 Register scratch = ebx; | |
| 2157 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 2158 __ Push(scratch); | |
| 2159 | |
| 2160 for (int i = 0; i < lit->properties()->length(); i++) { | 2150 for (int i = 0; i < lit->properties()->length(); i++) { |
| 2161 ObjectLiteral::Property* property = lit->properties()->at(i); | 2151 ObjectLiteral::Property* property = lit->properties()->at(i); |
| 2162 Expression* value = property->value(); | 2152 Expression* value = property->value(); |
| 2163 | 2153 |
| 2164 if (property->is_static()) { | 2154 if (property->is_static()) { |
| 2165 __ push(Operand(esp, kPointerSize)); // constructor | 2155 __ push(Operand(esp, kPointerSize)); // constructor |
| 2166 } else { | 2156 } else { |
| 2167 __ push(Operand(esp, 0)); // prototype | 2157 __ push(Operand(esp, 0)); // prototype |
| 2168 } | 2158 } |
| 2169 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2159 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2197 __ Push(Smi::FromInt(DONT_ENUM)); | 2187 __ Push(Smi::FromInt(DONT_ENUM)); |
| 2198 __ CallRuntime(Runtime::kDefineGetterPropertyUnchecked); | 2188 __ CallRuntime(Runtime::kDefineGetterPropertyUnchecked); |
| 2199 break; | 2189 break; |
| 2200 | 2190 |
| 2201 case ObjectLiteral::Property::SETTER: | 2191 case ObjectLiteral::Property::SETTER: |
| 2202 __ Push(Smi::FromInt(DONT_ENUM)); | 2192 __ Push(Smi::FromInt(DONT_ENUM)); |
| 2203 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); | 2193 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); |
| 2204 break; | 2194 break; |
| 2205 } | 2195 } |
| 2206 } | 2196 } |
| 2207 | |
| 2208 // Set both the prototype and constructor to have fast properties, and also | |
| 2209 // freeze them in strong mode. | |
| 2210 __ CallRuntime(Runtime::kFinalizeClassDefinition); | |
| 2211 } | 2197 } |
| 2212 | 2198 |
| 2213 | 2199 |
| 2214 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2200 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2215 __ pop(edx); | 2201 __ pop(edx); |
| 2216 Handle<Code> code = | 2202 Handle<Code> code = |
| 2217 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2203 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2218 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2204 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2219 CallIC(code, expr->BinaryOperationFeedbackId()); | 2205 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2220 patch_site.EmitPatchInfo(); | 2206 patch_site.EmitPatchInfo(); |
| (...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4612 Assembler::target_address_at(call_target_address, | 4598 Assembler::target_address_at(call_target_address, |
| 4613 unoptimized_code)); | 4599 unoptimized_code)); |
| 4614 return OSR_AFTER_STACK_CHECK; | 4600 return OSR_AFTER_STACK_CHECK; |
| 4615 } | 4601 } |
| 4616 | 4602 |
| 4617 | 4603 |
| 4618 } // namespace internal | 4604 } // namespace internal |
| 4619 } // namespace v8 | 4605 } // namespace v8 |
| 4620 | 4606 |
| 4621 #endif // V8_TARGET_ARCH_IA32 | 4607 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |