| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 if (!result_saved) { | 1513 if (!result_saved) { |
| 1514 PushOperand(eax); // array literal. | 1514 PushOperand(eax); // array literal. |
| 1515 result_saved = true; | 1515 result_saved = true; |
| 1516 } | 1516 } |
| 1517 VisitForAccumulatorValue(subexpr); | 1517 VisitForAccumulatorValue(subexpr); |
| 1518 | 1518 |
| 1519 __ mov(StoreDescriptor::NameRegister(), | 1519 __ mov(StoreDescriptor::NameRegister(), |
| 1520 Immediate(Smi::FromInt(array_index))); | 1520 Immediate(Smi::FromInt(array_index))); |
| 1521 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); | 1521 __ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 1522 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1522 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1523 Handle<Code> ic = | 1523 CallKeyedStoreIC(); |
| 1524 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 1525 CallIC(ic); | |
| 1526 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1524 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
| 1527 BailoutState::NO_REGISTERS); | 1525 BailoutState::NO_REGISTERS); |
| 1528 } | 1526 } |
| 1529 | 1527 |
| 1530 // In case the array literal contains spread expressions it has two parts. The | 1528 // In case the array literal contains spread expressions it has two parts. The |
| 1531 // first part is the "static" array which has a literal index is handled | 1529 // first part is the "static" array which has a literal index is handled |
| 1532 // above. The second part is the part after the first spread expression | 1530 // above. The second part is the part after the first spread expression |
| 1533 // (inclusive) and these elements gets appended to the array. Note that the | 1531 // (inclusive) and these elements gets appended to the array. Note that the |
| 1534 // number elements an iterable produces is unknown ahead of time. | 1532 // number elements an iterable produces is unknown ahead of time. |
| 1535 if (array_index < length && result_saved) { | 1533 if (array_index < length && result_saved) { |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 break; | 2008 break; |
| 2011 } | 2009 } |
| 2012 case KEYED_PROPERTY: { | 2010 case KEYED_PROPERTY: { |
| 2013 PushOperand(eax); // Preserve value. | 2011 PushOperand(eax); // Preserve value. |
| 2014 VisitForStackValue(prop->obj()); | 2012 VisitForStackValue(prop->obj()); |
| 2015 VisitForAccumulatorValue(prop->key()); | 2013 VisitForAccumulatorValue(prop->key()); |
| 2016 __ Move(StoreDescriptor::NameRegister(), eax); | 2014 __ Move(StoreDescriptor::NameRegister(), eax); |
| 2017 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver. | 2015 PopOperand(StoreDescriptor::ReceiverRegister()); // Receiver. |
| 2018 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2016 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
| 2019 EmitLoadStoreICSlot(slot); | 2017 EmitLoadStoreICSlot(slot); |
| 2020 Handle<Code> ic = | 2018 CallKeyedStoreIC(); |
| 2021 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 2022 CallIC(ic); | |
| 2023 break; | 2019 break; |
| 2024 } | 2020 } |
| 2025 } | 2021 } |
| 2026 context()->Plug(eax); | 2022 context()->Plug(eax); |
| 2027 } | 2023 } |
| 2028 | 2024 |
| 2029 | 2025 |
| 2030 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 2026 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
| 2031 Variable* var, MemOperand location) { | 2027 Variable* var, MemOperand location) { |
| 2032 __ mov(location, eax); | 2028 __ mov(location, eax); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 | 2151 |
| 2156 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2152 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| 2157 // Assignment to a property, using a keyed store IC. | 2153 // Assignment to a property, using a keyed store IC. |
| 2158 // eax : value | 2154 // eax : value |
| 2159 // esp[0] : key | 2155 // esp[0] : key |
| 2160 // esp[kPointerSize] : receiver | 2156 // esp[kPointerSize] : receiver |
| 2161 | 2157 |
| 2162 PopOperand(StoreDescriptor::NameRegister()); // Key. | 2158 PopOperand(StoreDescriptor::NameRegister()); // Key. |
| 2163 PopOperand(StoreDescriptor::ReceiverRegister()); | 2159 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 2164 DCHECK(StoreDescriptor::ValueRegister().is(eax)); | 2160 DCHECK(StoreDescriptor::ValueRegister().is(eax)); |
| 2165 Handle<Code> ic = | |
| 2166 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 2167 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2161 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2168 CallIC(ic); | 2162 CallKeyedStoreIC(); |
| 2169 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2163 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 2170 context()->Plug(eax); | 2164 context()->Plug(eax); |
| 2171 } | 2165 } |
| 2172 | 2166 |
| 2173 | 2167 |
| 2174 void FullCodeGenerator::CallIC(Handle<Code> code, | 2168 void FullCodeGenerator::CallIC(Handle<Code> code, |
| 2175 TypeFeedbackId ast_id) { | 2169 TypeFeedbackId ast_id) { |
| 2176 ic_total_count_++; | 2170 ic_total_count_++; |
| 2177 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2171 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
| 2178 } | 2172 } |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 context()->PlugTOS(); | 3239 context()->PlugTOS(); |
| 3246 } | 3240 } |
| 3247 } else { | 3241 } else { |
| 3248 context()->Plug(eax); | 3242 context()->Plug(eax); |
| 3249 } | 3243 } |
| 3250 break; | 3244 break; |
| 3251 } | 3245 } |
| 3252 case KEYED_PROPERTY: { | 3246 case KEYED_PROPERTY: { |
| 3253 PopOperand(StoreDescriptor::NameRegister()); | 3247 PopOperand(StoreDescriptor::NameRegister()); |
| 3254 PopOperand(StoreDescriptor::ReceiverRegister()); | 3248 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 3255 Handle<Code> ic = | |
| 3256 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 3257 EmitLoadStoreICSlot(expr->CountSlot()); | 3249 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3258 CallIC(ic); | 3250 CallKeyedStoreIC(); |
| 3259 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3251 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 3260 if (expr->is_postfix()) { | 3252 if (expr->is_postfix()) { |
| 3261 // Result is on the stack | 3253 // Result is on the stack |
| 3262 if (!context()->IsEffect()) { | 3254 if (!context()->IsEffect()) { |
| 3263 context()->PlugTOS(); | 3255 context()->PlugTOS(); |
| 3264 } | 3256 } |
| 3265 } else { | 3257 } else { |
| 3266 context()->Plug(eax); | 3258 context()->Plug(eax); |
| 3267 } | 3259 } |
| 3268 break; | 3260 break; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3631 isolate->builtins()->OnStackReplacement()->entry(), | 3623 isolate->builtins()->OnStackReplacement()->entry(), |
| 3632 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3624 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3633 return ON_STACK_REPLACEMENT; | 3625 return ON_STACK_REPLACEMENT; |
| 3634 } | 3626 } |
| 3635 | 3627 |
| 3636 | 3628 |
| 3637 } // namespace internal | 3629 } // namespace internal |
| 3638 } // namespace v8 | 3630 } // namespace v8 |
| 3639 | 3631 |
| 3640 #endif // V8_TARGET_ARCH_X87 | 3632 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |