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 return Callable(LoadIC::initialize_stub( | 16 LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode)); |
17 isolate, LoadICState(typeof_mode).GetExtraICState()), | 17 return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
18 LoadDescriptor(isolate)); | |
19 } | 18 } |
20 | 19 |
21 | 20 |
22 // static | 21 // static |
23 Callable CodeFactory::LoadICInOptimizedCode( | 22 Callable CodeFactory::LoadICInOptimizedCode( |
24 Isolate* isolate, TypeofMode typeof_mode, | 23 Isolate* isolate, TypeofMode typeof_mode, |
25 InlineCacheState initialization_state) { | 24 InlineCacheState initialization_state) { |
26 auto code = LoadIC::initialize_stub_in_optimized_code( | 25 auto code = LoadIC::initialize_stub_in_optimized_code( |
27 isolate, LoadICState(typeof_mode).GetExtraICState(), | 26 isolate, LoadICState(typeof_mode).GetExtraICState(), |
28 initialization_state); | 27 initialization_state); |
29 return Callable(code, LoadWithVectorDescriptor(isolate)); | 28 return Callable(code, LoadWithVectorDescriptor(isolate)); |
30 } | 29 } |
31 | 30 |
32 | 31 |
33 // static | 32 // static |
34 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { | 33 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { |
35 return Callable(KeyedLoadIC::initialize_stub(isolate, kNoExtraICState), | 34 KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState)); |
36 LoadDescriptor(isolate)); | 35 return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
37 } | 36 } |
38 | 37 |
39 | 38 |
40 // static | 39 // static |
41 Callable CodeFactory::KeyedLoadICInOptimizedCode( | 40 Callable CodeFactory::KeyedLoadICInOptimizedCode( |
42 Isolate* isolate, InlineCacheState initialization_state) { | 41 Isolate* isolate, InlineCacheState initialization_state) { |
43 auto code = KeyedLoadIC::initialize_stub_in_optimized_code( | 42 auto code = KeyedLoadIC::initialize_stub_in_optimized_code( |
44 isolate, initialization_state, kNoExtraICState); | 43 isolate, initialization_state, kNoExtraICState); |
45 if (initialization_state != MEGAMORPHIC) { | 44 if (initialization_state != MEGAMORPHIC) { |
46 return Callable(code, LoadWithVectorDescriptor(isolate)); | 45 return Callable(code, LoadWithVectorDescriptor(isolate)); |
47 } | 46 } |
48 return Callable(code, LoadDescriptor(isolate)); | 47 return Callable(code, LoadDescriptor(isolate)); |
49 } | 48 } |
50 | 49 |
51 | 50 |
52 // static | 51 // static |
53 Callable CodeFactory::CallIC(Isolate* isolate, int argc, | 52 Callable CodeFactory::CallIC(Isolate* isolate, int argc, |
54 ConvertReceiverMode mode, | 53 ConvertReceiverMode mode, |
55 TailCallMode tail_call_mode) { | 54 TailCallMode tail_call_mode) { |
56 return Callable(CallIC::initialize_stub(isolate, argc, mode, tail_call_mode), | 55 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
57 CallFunctionWithFeedbackDescriptor(isolate)); | 56 return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate)); |
58 } | 57 } |
59 | 58 |
60 | 59 |
61 // static | 60 // static |
62 Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc, | 61 Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc, |
63 ConvertReceiverMode mode, | 62 ConvertReceiverMode mode, |
64 TailCallMode tail_call_mode) { | 63 TailCallMode tail_call_mode) { |
65 return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode, | 64 return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode, |
66 tail_call_mode), | 65 tail_call_mode), |
67 CallFunctionWithFeedbackAndVectorDescriptor(isolate)); | 66 CallFunctionWithFeedbackAndVectorDescriptor(isolate)); |
68 } | 67 } |
69 | 68 |
70 | 69 |
71 // static | 70 // static |
72 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { | 71 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { |
73 return Callable( | 72 VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
74 StoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED), | 73 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
75 VectorStoreICTrampolineDescriptor(isolate)); | |
76 } | 74 } |
77 | 75 |
78 | 76 |
79 // static | 77 // static |
80 Callable CodeFactory::StoreICInOptimizedCode( | 78 Callable CodeFactory::StoreICInOptimizedCode( |
81 Isolate* isolate, LanguageMode language_mode, | 79 Isolate* isolate, LanguageMode language_mode, |
82 InlineCacheState initialization_state) { | 80 InlineCacheState initialization_state) { |
83 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC | 81 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC |
84 ? VectorStoreICDescriptor(isolate) | 82 ? VectorStoreICDescriptor(isolate) |
85 : StoreDescriptor(isolate); | 83 : StoreDescriptor(isolate); |
86 return Callable(StoreIC::initialize_stub_in_optimized_code( | 84 return Callable(StoreIC::initialize_stub_in_optimized_code( |
87 isolate, language_mode, initialization_state), | 85 isolate, language_mode, initialization_state), |
88 descriptor); | 86 descriptor); |
89 } | 87 } |
90 | 88 |
91 | 89 |
92 // static | 90 // static |
93 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, | 91 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, |
94 LanguageMode language_mode) { | 92 LanguageMode language_mode) { |
95 return Callable( | 93 VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
96 KeyedStoreIC::initialize_stub(isolate, language_mode, UNINITIALIZED), | 94 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
97 VectorStoreICTrampolineDescriptor(isolate)); | |
98 } | 95 } |
99 | 96 |
100 | 97 |
101 // static | 98 // static |
102 Callable CodeFactory::KeyedStoreICInOptimizedCode( | 99 Callable CodeFactory::KeyedStoreICInOptimizedCode( |
103 Isolate* isolate, LanguageMode language_mode, | 100 Isolate* isolate, LanguageMode language_mode, |
104 InlineCacheState initialization_state) { | 101 InlineCacheState initialization_state) { |
105 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC | 102 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC |
106 ? VectorStoreICDescriptor(isolate) | 103 ? VectorStoreICDescriptor(isolate) |
107 : StoreDescriptor(isolate); | 104 : StoreDescriptor(isolate); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // static | 535 // static |
539 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { | 536 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { |
540 // Note: If we ever use fpregs in the interpreter then we will need to | 537 // Note: If we ever use fpregs in the interpreter then we will need to |
541 // save fpregs too. | 538 // save fpregs too. |
542 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); | 539 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); |
543 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); | 540 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); |
544 } | 541 } |
545 | 542 |
546 } // namespace internal | 543 } // namespace internal |
547 } // namespace v8 | 544 } // namespace v8 |
OLD | NEW |