| 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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 | 1547 |
| 1548 if (!result_saved) { | 1548 if (!result_saved) { |
| 1549 PushOperand(rax); // array literal | 1549 PushOperand(rax); // array literal |
| 1550 result_saved = true; | 1550 result_saved = true; |
| 1551 } | 1551 } |
| 1552 VisitForAccumulatorValue(subexpr); | 1552 VisitForAccumulatorValue(subexpr); |
| 1553 | 1553 |
| 1554 __ Move(StoreDescriptor::NameRegister(), Smi::FromInt(array_index)); | 1554 __ Move(StoreDescriptor::NameRegister(), Smi::FromInt(array_index)); |
| 1555 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 1555 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
| 1556 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); | 1556 EmitLoadStoreICSlot(expr->LiteralFeedbackSlot()); |
| 1557 Handle<Code> ic = | 1557 CallKeyedStoreIC(); |
| 1558 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 1559 CallIC(ic); | |
| 1560 | 1558 |
| 1561 PrepareForBailoutForId(expr->GetIdForElement(array_index), | 1559 PrepareForBailoutForId(expr->GetIdForElement(array_index), |
| 1562 BailoutState::NO_REGISTERS); | 1560 BailoutState::NO_REGISTERS); |
| 1563 } | 1561 } |
| 1564 | 1562 |
| 1565 // In case the array literal contains spread expressions it has two parts. The | 1563 // In case the array literal contains spread expressions it has two parts. The |
| 1566 // first part is the "static" array which has a literal index is handled | 1564 // first part is the "static" array which has a literal index is handled |
| 1567 // above. The second part is the part after the first spread expression | 1565 // above. The second part is the part after the first spread expression |
| 1568 // (inclusive) and these elements gets appended to the array. Note that the | 1566 // (inclusive) and these elements gets appended to the array. Note that the |
| 1569 // number elements an iterable produces is unknown ahead of time. | 1567 // number elements an iterable produces is unknown ahead of time. |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 break; | 2010 break; |
| 2013 } | 2011 } |
| 2014 case KEYED_PROPERTY: { | 2012 case KEYED_PROPERTY: { |
| 2015 PushOperand(rax); // Preserve value. | 2013 PushOperand(rax); // Preserve value. |
| 2016 VisitForStackValue(prop->obj()); | 2014 VisitForStackValue(prop->obj()); |
| 2017 VisitForAccumulatorValue(prop->key()); | 2015 VisitForAccumulatorValue(prop->key()); |
| 2018 __ Move(StoreDescriptor::NameRegister(), rax); | 2016 __ Move(StoreDescriptor::NameRegister(), rax); |
| 2019 PopOperand(StoreDescriptor::ReceiverRegister()); | 2017 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 2020 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2018 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
| 2021 EmitLoadStoreICSlot(slot); | 2019 EmitLoadStoreICSlot(slot); |
| 2022 Handle<Code> ic = | 2020 CallKeyedStoreIC(); |
| 2023 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 2024 CallIC(ic); | |
| 2025 break; | 2021 break; |
| 2026 } | 2022 } |
| 2027 } | 2023 } |
| 2028 context()->Plug(rax); | 2024 context()->Plug(rax); |
| 2029 } | 2025 } |
| 2030 | 2026 |
| 2031 | 2027 |
| 2032 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 2028 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
| 2033 Variable* var, MemOperand location) { | 2029 Variable* var, MemOperand location) { |
| 2034 __ movp(location, rax); | 2030 __ movp(location, rax); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 ? Runtime::kStoreKeyedToSuper_Strict | 2147 ? Runtime::kStoreKeyedToSuper_Strict |
| 2152 : Runtime::kStoreKeyedToSuper_Sloppy); | 2148 : Runtime::kStoreKeyedToSuper_Sloppy); |
| 2153 } | 2149 } |
| 2154 | 2150 |
| 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 PopOperand(StoreDescriptor::NameRegister()); // Key. | 2154 PopOperand(StoreDescriptor::NameRegister()); // Key. |
| 2159 PopOperand(StoreDescriptor::ReceiverRegister()); | 2155 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 2160 DCHECK(StoreDescriptor::ValueRegister().is(rax)); | 2156 DCHECK(StoreDescriptor::ValueRegister().is(rax)); |
| 2161 Handle<Code> ic = | |
| 2162 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 2163 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2157 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2164 CallIC(ic); | 2158 CallKeyedStoreIC(); |
| 2165 | 2159 |
| 2166 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2160 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 2167 context()->Plug(rax); | 2161 context()->Plug(rax); |
| 2168 } | 2162 } |
| 2169 | 2163 |
| 2170 | 2164 |
| 2171 void FullCodeGenerator::CallIC(Handle<Code> code, | 2165 void FullCodeGenerator::CallIC(Handle<Code> code, |
| 2172 TypeFeedbackId ast_id) { | 2166 TypeFeedbackId ast_id) { |
| 2173 ic_total_count_++; | 2167 ic_total_count_++; |
| 2174 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2168 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3244 context()->PlugTOS(); | 3238 context()->PlugTOS(); |
| 3245 } | 3239 } |
| 3246 } else { | 3240 } else { |
| 3247 context()->Plug(rax); | 3241 context()->Plug(rax); |
| 3248 } | 3242 } |
| 3249 break; | 3243 break; |
| 3250 } | 3244 } |
| 3251 case KEYED_PROPERTY: { | 3245 case KEYED_PROPERTY: { |
| 3252 PopOperand(StoreDescriptor::NameRegister()); | 3246 PopOperand(StoreDescriptor::NameRegister()); |
| 3253 PopOperand(StoreDescriptor::ReceiverRegister()); | 3247 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 3254 Handle<Code> ic = | |
| 3255 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | |
| 3256 EmitLoadStoreICSlot(expr->CountSlot()); | 3248 EmitLoadStoreICSlot(expr->CountSlot()); |
| 3257 CallIC(ic); | 3249 CallKeyedStoreIC(); |
| 3258 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3250 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 3259 if (expr->is_postfix()) { | 3251 if (expr->is_postfix()) { |
| 3260 if (!context()->IsEffect()) { | 3252 if (!context()->IsEffect()) { |
| 3261 context()->PlugTOS(); | 3253 context()->PlugTOS(); |
| 3262 } | 3254 } |
| 3263 } else { | 3255 } else { |
| 3264 context()->Plug(rax); | 3256 context()->Plug(rax); |
| 3265 } | 3257 } |
| 3266 break; | 3258 break; |
| 3267 } | 3259 } |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 DCHECK_EQ( | 3621 DCHECK_EQ( |
| 3630 isolate->builtins()->OnStackReplacement()->entry(), | 3622 isolate->builtins()->OnStackReplacement()->entry(), |
| 3631 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3623 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3632 return ON_STACK_REPLACEMENT; | 3624 return ON_STACK_REPLACEMENT; |
| 3633 } | 3625 } |
| 3634 | 3626 |
| 3635 } // namespace internal | 3627 } // namespace internal |
| 3636 } // namespace v8 | 3628 } // namespace v8 |
| 3637 | 3629 |
| 3638 #endif // V8_TARGET_ARCH_X64 | 3630 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |