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/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 1510 matching lines...) Loading... |
1521 if (!result_saved) { | 1521 if (!result_saved) { |
1522 PushOperand(eax); // array literal. | 1522 PushOperand(eax); // array literal. |
1523 result_saved = true; | 1523 result_saved = true; |
1524 } | 1524 } |
1525 VisitForAccumulatorValue(subexpr); | 1525 VisitForAccumulatorValue(subexpr); |
1526 | 1526 |
1527 __ mov(StoreDescriptor::NameRegister(), | 1527 __ mov(StoreDescriptor::NameRegister(), |
1528 Immediate(Smi::FromInt(array_index))); | 1528 Immediate(Smi::FromInt(array_index))); |
1529 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1529 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
1530 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1530 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
1531 Handle<Code> ic = | 1531 CallKeyedStoreIC(); |
1532 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
1533 CallIC(ic); | |
1534 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1532 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
1535 BailoutState::NO_REGISTERS); | 1533 BailoutState::NO_REGISTERS); |
1536 } | 1534 } |
1537 | 1535 |
1538 // In case the array literal contains spread expressions it has two parts. The | 1536 // In case the array literal contains spread expressions it has two parts. The |
1539 // first part is the "static" array which has a literal index is handled | 1537 // first part is the "static" array which has a literal index is handled |
1540 // above. The second part is the part after the first spread expression | 1538 // above. The second part is the part after the first spread expression |
1541 // (inclusive) and these elements gets appended to the array. Note that the | 1539 // (inclusive) and these elements gets appended to the array. Note that the |
1542 // number elements an iterable produces is unknown ahead of time. | 1540 // number elements an iterable produces is unknown ahead of time. |
1543 if (array_index < length && result_saved) { | 1541 if (array_index < length && result_saved) { |
(...skipping 474 matching lines...) Loading... |
2018 break; | 2016 break; |
2019 } | 2017 } |
2020 case KEYED_PROPERTY: { | 2018 case KEYED_PROPERTY: { |
2021 PushOperand(eax); // Preserve value. | 2019 PushOperand(eax); // Preserve value. |
2022 VisitForStackValue(prop->obj()); | 2020 VisitForStackValue(prop->obj()); |
2023 VisitForAccumulatorValue(prop->key()); | 2021 VisitForAccumulatorValue(prop->key()); |
2024 __ Move(StoreDescriptor::NameRegister(), eax); | 2022 __ Move(StoreDescriptor::NameRegister(), eax); |
2025 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver. | 2023 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver. |
2026 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2024 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
2027 EmitLoadStoreICSlot(slot); | 2025 EmitLoadStoreICSlot(slot); |
2028 Handle<Code> ic = | 2026 CallKeyedStoreIC(); |
2029 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
2030 CallIC(ic); | |
2031 break; | 2027 break; |
2032 } | 2028 } |
2033 } | 2029 } |
2034 context()->Plug(eax); | 2030 context()->Plug(eax); |
2035 } | 2031 } |
2036 | 2032 |
2037 | 2033 |
2038 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 2034 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
2039 Variable* var, MemOperand location) { | 2035 Variable* var, MemOperand location) { |
2040 __ mov(location, eax); | 2036 __ mov(location, eax); |
(...skipping 122 matching lines...) Loading... |
2163 | 2159 |
2164 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2160 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2165 // Assignment to a property, using a keyed store IC. | 2161 // Assignment to a property, using a keyed store IC. |
2166 // eax : value | 2162 // eax : value |
2167 // esp[0] : key | 2163 // esp[0] : key |
2168 // esp[kPointerSize] : receiver | 2164 // esp[kPointerSize] : receiver |
2169 | 2165 |
2170 PopOperand(StoreDescriptor::NameRegister()); // Key. | 2166 PopOperand(StoreDescriptor::NameRegister()); // Key. |
2171 PopOperand(StoreDescriptor::ReceiverRegister()); | 2167 PopOperand(StoreDescriptor::ReceiverRegister()); |
2172 DCHECK(StoreDescriptor::ValueRegister().is(eax)); | 2168 DCHECK(StoreDescriptor::ValueRegister().is(eax)); |
2173 Handle<Code> ic = | |
2174 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
2175 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2169 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
2176 CallIC(ic); | 2170 CallKeyedStoreIC(); |
2177 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2171 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2178 context()->Plug(eax); | 2172 context()->Plug(eax); |
2179 } | 2173 } |
2180 | 2174 |
2181 | 2175 |
2182 void FullCodeGenerator::CallIC(Handle<Code> code, | 2176 void FullCodeGenerator::CallIC(Handle<Code> code, |
2183 TypeFeedbackId ast_id) { | 2177 TypeFeedbackId ast_id) { |
2184 ic_total_count_++; | 2178 ic_total_count_++; |
2185 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2179 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
2186 } | 2180 } |
(...skipping 1066 matching lines...) Loading... |
3253 context()->PlugTOS(); | 3247 context()->PlugTOS(); |
3254 } | 3248 } |
3255 } else { | 3249 } else { |
3256 context()->Plug(eax); | 3250 context()->Plug(eax); |
3257 } | 3251 } |
3258 break; | 3252 break; |
3259 } | 3253 } |
3260 case KEYED_PROPERTY: { | 3254 case KEYED_PROPERTY: { |
3261 PopOperand(StoreDescriptor::NameRegister()); | 3255 PopOperand(StoreDescriptor::NameRegister()); |
3262 PopOperand(StoreDescriptor::ReceiverRegister()); | 3256 PopOperand(StoreDescriptor::ReceiverRegister()); |
3263 Handle<Code> ic = | |
3264 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
3265 EmitLoadStoreICSlot(expr->CountSlot()); | 3257 EmitLoadStoreICSlot(expr->CountSlot()); |
3266 CallIC(ic); | 3258 CallKeyedStoreIC(); |
3267 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3259 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
3268 if (expr->is_postfix()) { | 3260 if (expr->is_postfix()) { |
3269 // Result is on the stack | 3261 // Result is on the stack |
3270 if (!context()->IsEffect()) { | 3262 if (!context()->IsEffect()) { |
3271 context()->PlugTOS(); | 3263 context()->PlugTOS(); |
3272 } | 3264 } |
3273 } else { | 3265 } else { |
3274 context()->Plug(eax); | 3266 context()->Plug(eax); |
3275 } | 3267 } |
3276 break; | 3268 break; |
(...skipping 362 matching lines...) Loading... |
3639 isolate->builtins()->OnStackReplacement()->entry(), | 3631 isolate->builtins()->OnStackReplacement()->entry(), |
3640 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3632 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3641 return ON_STACK_REPLACEMENT; | 3633 return ON_STACK_REPLACEMENT; |
3642 } | 3634 } |
3643 | 3635 |
3644 | 3636 |
3645 } // namespace internal | 3637 } // namespace internal |
3646 } // namespace v8 | 3638 } // namespace v8 |
3647 | 3639 |
3648 #endif // V8_TARGET_ARCH_IA32 | 3640 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |