| 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 #ifndef V8_IC_CALL_OPTIMIZATION_H_ | 5 #ifndef V8_IC_CALL_OPTIMIZATION_H_ |
| 6 #define V8_IC_CALL_OPTIMIZATION_H_ | 6 #define V8_IC_CALL_OPTIMIZATION_H_ |
| 7 | 7 |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/ic/access-compiler.h" | 9 #include "src/ic/access-compiler.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| 11 #include "src/objects.h" | 11 #include "src/objects.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 // Holds information about possible function call optimizations. | 15 // Holds information about possible function call optimizations. |
| 16 class CallOptimization BASE_EMBEDDED { | 16 class CallOptimization BASE_EMBEDDED { |
| 17 public: | 17 public: |
| 18 explicit CallOptimization(Handle<Object> function); | 18 explicit CallOptimization(Handle<JSFunction> function); |
| 19 | 19 |
| 20 bool is_constant_call() const { return !constant_function_.is_null(); } | 20 bool is_constant_call() const { return !constant_function_.is_null(); } |
| 21 | 21 |
| 22 Handle<JSFunction> constant_function() const { | 22 Handle<JSFunction> constant_function() const { |
| 23 DCHECK(is_constant_call()); | 23 DCHECK(is_constant_call()); |
| 24 return constant_function_; | 24 return constant_function_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool is_simple_api_call() const { return is_simple_api_call_; } | 27 bool is_simple_api_call() const { return is_simple_api_call_; } |
| 28 | 28 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 // Check if the api holder is between the receiver and the holder. | 44 // Check if the api holder is between the receiver and the holder. |
| 45 bool IsCompatibleReceiver(Handle<Object> receiver, | 45 bool IsCompatibleReceiver(Handle<Object> receiver, |
| 46 Handle<JSObject> holder) const; | 46 Handle<JSObject> holder) const; |
| 47 | 47 |
| 48 // Check if the api holder is between the receiver and the holder. | 48 // Check if the api holder is between the receiver and the holder. |
| 49 bool IsCompatibleReceiverMap(Handle<Map> receiver_map, | 49 bool IsCompatibleReceiverMap(Handle<Map> receiver_map, |
| 50 Handle<JSObject> holder) const; | 50 Handle<JSObject> holder) const; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 void Initialize(Handle<JSFunction> function); | 53 void Initialize(Handle<JSFunction> function); |
| 54 void Initialize(Handle<FunctionTemplateInfo> function_template_info); | |
| 55 | 54 |
| 56 // Determines whether the given function can be called using the | 55 // Determines whether the given function can be called using the |
| 57 // fast api call builtin. | 56 // fast api call builtin. |
| 58 void AnalyzePossibleApiFunction(Handle<JSFunction> function); | 57 void AnalyzePossibleApiFunction(Handle<JSFunction> function); |
| 59 | 58 |
| 60 Handle<JSFunction> constant_function_; | 59 Handle<JSFunction> constant_function_; |
| 61 bool is_simple_api_call_; | 60 bool is_simple_api_call_; |
| 62 Handle<FunctionTemplateInfo> expected_receiver_type_; | 61 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 63 Handle<CallHandlerInfo> api_call_info_; | 62 Handle<CallHandlerInfo> api_call_info_; |
| 64 }; | 63 }; |
| 65 } // namespace internal | 64 } // namespace internal |
| 66 } // namespace v8 | 65 } // namespace v8 |
| 67 | 66 |
| 68 #endif // V8_IC_CALL_OPTIMIZATION_H_ | 67 #endif // V8_IC_CALL_OPTIMIZATION_H_ |
| OLD | NEW |