| 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 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || | 224 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || |
| 225 StoreDescriptor::kStackArgumentsCount == 2); | 225 StoreDescriptor::kStackArgumentsCount == 2); |
| 226 if (StoreDescriptor::kPassLastArgsOnStack) { | 226 if (StoreDescriptor::kPassLastArgsOnStack) { |
| 227 __ Push(StoreDescriptor::ValueRegister()); | 227 __ Push(StoreDescriptor::ValueRegister()); |
| 228 EmitPushSlot(slot); | 228 EmitPushSlot(slot); |
| 229 } else { | 229 } else { |
| 230 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot); | 230 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot); |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Ensure that language mode is in sync with the IC slot kind. |
| 234 DCHECK_EQ(GetLanguageModeFromICKind(feedback_vector_spec()->GetKind(slot)), |
| 235 language_mode()); |
| 233 Handle<Code> code = CodeFactory::StoreIC(isolate(), language_mode()).code(); | 236 Handle<Code> code = CodeFactory::StoreIC(isolate(), language_mode()).code(); |
| 234 __ Call(code, RelocInfo::CODE_TARGET); | 237 __ Call(code, RelocInfo::CODE_TARGET); |
| 235 RestoreContext(); | 238 RestoreContext(); |
| 236 } | 239 } |
| 237 | 240 |
| 238 void FullCodeGenerator::CallKeyedStoreIC(FeedbackVectorSlot slot) { | 241 void FullCodeGenerator::CallKeyedStoreIC(FeedbackVectorSlot slot) { |
| 239 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || | 242 STATIC_ASSERT(!StoreDescriptor::kPassLastArgsOnStack || |
| 240 StoreDescriptor::kStackArgumentsCount == 2); | 243 StoreDescriptor::kStackArgumentsCount == 2); |
| 241 if (StoreDescriptor::kPassLastArgsOnStack) { | 244 if (StoreDescriptor::kPassLastArgsOnStack) { |
| 242 __ Push(StoreDescriptor::ValueRegister()); | 245 __ Push(StoreDescriptor::ValueRegister()); |
| 243 EmitPushSlot(slot); | 246 EmitPushSlot(slot); |
| 244 } else { | 247 } else { |
| 245 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot); | 248 EmitLoadSlot(StoreDescriptor::SlotRegister(), slot); |
| 246 } | 249 } |
| 247 | 250 |
| 251 // Ensure that language mode is in sync with the IC slot kind. |
| 252 DCHECK_EQ(GetLanguageModeFromICKind(feedback_vector_spec()->GetKind(slot)), |
| 253 language_mode()); |
| 248 Handle<Code> code = | 254 Handle<Code> code = |
| 249 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 255 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 250 __ Call(code, RelocInfo::CODE_TARGET); | 256 __ Call(code, RelocInfo::CODE_TARGET); |
| 251 RestoreContext(); | 257 RestoreContext(); |
| 252 } | 258 } |
| 253 | 259 |
| 254 void FullCodeGenerator::RecordJSReturnSite(Call* call) { | 260 void FullCodeGenerator::RecordJSReturnSite(Call* call) { |
| 255 // We record the offset of the function return so we can rebuild the frame | 261 // We record the offset of the function return so we can rebuild the frame |
| 256 // if the function was inlined, i.e., this is the return address in the | 262 // if the function was inlined, i.e., this is the return address in the |
| 257 // inlined function's frame. | 263 // inlined function's frame. |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 LanguageMode FullCodeGenerator::language_mode() { | 1599 LanguageMode FullCodeGenerator::language_mode() { |
| 1594 return scope()->language_mode(); | 1600 return scope()->language_mode(); |
| 1595 } | 1601 } |
| 1596 | 1602 |
| 1597 bool FullCodeGenerator::has_simple_parameters() { | 1603 bool FullCodeGenerator::has_simple_parameters() { |
| 1598 return info_->has_simple_parameters(); | 1604 return info_->has_simple_parameters(); |
| 1599 } | 1605 } |
| 1600 | 1606 |
| 1601 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } | 1607 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } |
| 1602 | 1608 |
| 1609 const FeedbackVectorSpec* FullCodeGenerator::feedback_vector_spec() const { |
| 1610 return literal()->feedback_vector_spec(); |
| 1611 } |
| 1612 |
| 1603 #undef __ | 1613 #undef __ |
| 1604 | 1614 |
| 1605 | 1615 |
| 1606 } // namespace internal | 1616 } // namespace internal |
| 1607 } // namespace v8 | 1617 } // namespace v8 |
| OLD | NEW |