| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 Callable CodeFactory::LoadIC(Isolate* isolate, TypeofMode typeof_mode) { | 15 Callable CodeFactory::LoadIC(Isolate* isolate, TypeofMode typeof_mode) { |
| 16 LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode)); | 16 LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode)); |
| 17 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 17 return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 Callable CodeFactory::ApiGetter(Isolate* isolate) { | 21 Callable CodeFactory::ApiGetter(Isolate* isolate) { |
| 22 CallApiGetterStub stub(isolate); | 22 CallApiGetterStub stub(isolate); |
| 23 return Callable(stub.GetCode(), ApiGetterDescriptor(isolate)); | 23 return Callable(stub.GetCode(), ApiGetterDescriptor(isolate)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 Callable CodeFactory::LoadICInOptimizedCode( | 27 Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate, |
| 28 Isolate* isolate, TypeofMode typeof_mode, | 28 TypeofMode typeof_mode) { |
| 29 InlineCacheState initialization_state) { | |
| 30 auto code = LoadIC::initialize_stub_in_optimized_code( | 29 auto code = LoadIC::initialize_stub_in_optimized_code( |
| 31 isolate, LoadICState(typeof_mode).GetExtraICState(), | 30 isolate, LoadICState(typeof_mode).GetExtraICState()); |
| 32 initialization_state); | |
| 33 return Callable(code, LoadWithVectorDescriptor(isolate)); | 31 return Callable(code, LoadWithVectorDescriptor(isolate)); |
| 34 } | 32 } |
| 35 | 33 |
| 36 | 34 |
| 37 // static | 35 // static |
| 38 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { | 36 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { |
| 39 KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState)); | 37 KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState)); |
| 40 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 38 return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
| 41 } | 39 } |
| 42 | 40 |
| 43 | 41 |
| 44 // static | 42 // static |
| 45 Callable CodeFactory::KeyedLoadICInOptimizedCode( | 43 Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) { |
| 46 Isolate* isolate, InlineCacheState initialization_state) { | 44 auto code = |
| 47 auto code = KeyedLoadIC::initialize_stub_in_optimized_code( | 45 KeyedLoadIC::initialize_stub_in_optimized_code(isolate, kNoExtraICState); |
| 48 isolate, initialization_state, kNoExtraICState); | 46 return Callable(code, LoadWithVectorDescriptor(isolate)); |
| 49 if (initialization_state != MEGAMORPHIC) { | |
| 50 return Callable(code, LoadWithVectorDescriptor(isolate)); | |
| 51 } | |
| 52 return Callable(code, LoadDescriptor(isolate)); | |
| 53 } | 47 } |
| 54 | 48 |
| 55 | 49 |
| 56 // static | 50 // static |
| 57 Callable CodeFactory::CallIC(Isolate* isolate, int argc, | 51 Callable CodeFactory::CallIC(Isolate* isolate, int argc, |
| 58 ConvertReceiverMode mode, | 52 ConvertReceiverMode mode, |
| 59 TailCallMode tail_call_mode) { | 53 TailCallMode tail_call_mode) { |
| 60 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); | 54 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
| 61 return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate)); | 55 return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate)); |
| 62 } | 56 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 73 | 67 |
| 74 | 68 |
| 75 // static | 69 // static |
| 76 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { | 70 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { |
| 77 VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); | 71 VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
| 78 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); | 72 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
| 79 } | 73 } |
| 80 | 74 |
| 81 | 75 |
| 82 // static | 76 // static |
| 83 Callable CodeFactory::StoreICInOptimizedCode( | 77 Callable CodeFactory::StoreICInOptimizedCode(Isolate* isolate, |
| 84 Isolate* isolate, LanguageMode language_mode, | 78 LanguageMode language_mode) { |
| 85 InlineCacheState initialization_state) { | 79 CallInterfaceDescriptor descriptor = VectorStoreICDescriptor(isolate); |
| 86 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC | 80 return Callable( |
| 87 ? VectorStoreICDescriptor(isolate) | 81 StoreIC::initialize_stub_in_optimized_code(isolate, language_mode), |
| 88 : StoreDescriptor(isolate); | 82 descriptor); |
| 89 return Callable(StoreIC::initialize_stub_in_optimized_code( | |
| 90 isolate, language_mode, initialization_state), | |
| 91 descriptor); | |
| 92 } | 83 } |
| 93 | 84 |
| 94 | 85 |
| 95 // static | 86 // static |
| 96 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, | 87 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, |
| 97 LanguageMode language_mode) { | 88 LanguageMode language_mode) { |
| 98 VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); | 89 VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
| 99 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); | 90 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
| 100 } | 91 } |
| 101 | 92 |
| 102 | 93 |
| 103 // static | 94 // static |
| 104 Callable CodeFactory::KeyedStoreICInOptimizedCode( | 95 Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate, |
| 105 Isolate* isolate, LanguageMode language_mode, | 96 LanguageMode language_mode) { |
| 106 InlineCacheState initialization_state) { | 97 CallInterfaceDescriptor descriptor = VectorStoreICDescriptor(isolate); |
| 107 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC | 98 return Callable( |
| 108 ? VectorStoreICDescriptor(isolate) | 99 KeyedStoreIC::initialize_stub_in_optimized_code(isolate, language_mode), |
| 109 : StoreDescriptor(isolate); | 100 descriptor); |
| 110 return Callable(KeyedStoreIC::initialize_stub_in_optimized_code( | |
| 111 isolate, language_mode, initialization_state), | |
| 112 descriptor); | |
| 113 } | 101 } |
| 114 | 102 |
| 115 | 103 |
| 116 // static | 104 // static |
| 117 Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { | 105 Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { |
| 118 Handle<Code> code = CompareIC::GetUninitialized(isolate, op); | 106 Handle<Code> code = CompareIC::GetUninitialized(isolate, op); |
| 119 return Callable(code, CompareDescriptor(isolate)); | 107 return Callable(code, CompareDescriptor(isolate)); |
| 120 } | 108 } |
| 121 | 109 |
| 122 | 110 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 // static | 558 // static |
| 571 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { | 559 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { |
| 572 // Note: If we ever use fpregs in the interpreter then we will need to | 560 // Note: If we ever use fpregs in the interpreter then we will need to |
| 573 // save fpregs too. | 561 // save fpregs too. |
| 574 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); | 562 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); |
| 575 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); | 563 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); |
| 576 } | 564 } |
| 577 | 565 |
| 578 } // namespace internal | 566 } // namespace internal |
| 579 } // namespace v8 | 567 } // namespace v8 |
| OLD | NEW |