Index: src/ia32/stub-cache-ia32.cc |
=================================================================== |
--- src/ia32/stub-cache-ia32.cc (revision 4439) |
+++ src/ia32/stub-cache-ia32.cc (working copy) |
@@ -477,107 +477,6 @@ |
}; |
-// Holds information about possible function call optimizations. |
-class CallOptimization BASE_EMBEDDED { |
- public: |
- explicit CallOptimization(LookupResult* lookup) { |
- if (!lookup->IsProperty() || !lookup->IsCacheable() || |
- lookup->type() != CONSTANT_FUNCTION) { |
- Initialize(NULL); |
- } else { |
- // We only optimize constant function calls. |
- Initialize(lookup->GetConstantFunction()); |
- } |
- } |
- |
- explicit CallOptimization(JSFunction* function) { |
- Initialize(function); |
- } |
- |
- bool is_constant_call() const { |
- return constant_function_ != NULL; |
- } |
- |
- JSFunction* constant_function() const { |
- ASSERT(constant_function_ != NULL); |
- return constant_function_; |
- } |
- |
- bool is_simple_api_call() const { |
- return is_simple_api_call_; |
- } |
- |
- FunctionTemplateInfo* expected_receiver_type() const { |
- ASSERT(is_simple_api_call_); |
- return expected_receiver_type_; |
- } |
- |
- CallHandlerInfo* api_call_info() const { |
- ASSERT(is_simple_api_call_); |
- return api_call_info_; |
- } |
- |
- // Returns the depth of the object having the expected type in the |
- // prototype chain between the two arguments. |
- int GetPrototypeDepthOfExpectedType(JSObject* object, |
- JSObject* holder) const { |
- ASSERT(is_simple_api_call_); |
- if (expected_receiver_type_ == NULL) return 0; |
- int depth = 0; |
- while (object != holder) { |
- if (object->IsInstanceOf(expected_receiver_type_)) return depth; |
- object = JSObject::cast(object->GetPrototype()); |
- ++depth; |
- } |
- if (holder->IsInstanceOf(expected_receiver_type_)) return depth; |
- return kInvalidProtoDepth; |
- } |
- |
- private: |
- void Initialize(JSFunction* function) { |
- constant_function_ = NULL; |
- is_simple_api_call_ = false; |
- expected_receiver_type_ = NULL; |
- api_call_info_ = NULL; |
- |
- if (function == NULL || !function->is_compiled()) return; |
- |
- constant_function_ = function; |
- AnalyzePossibleApiFunction(function); |
- } |
- |
- // Determines whether the given function can be called using the |
- // fast api call builtin. |
- void AnalyzePossibleApiFunction(JSFunction* function) { |
- SharedFunctionInfo* sfi = function->shared(); |
- if (!sfi->IsApiFunction()) return; |
- FunctionTemplateInfo* info = sfi->get_api_func_data(); |
- |
- // Require a C++ callback. |
- if (info->call_code()->IsUndefined()) return; |
- api_call_info_ = CallHandlerInfo::cast(info->call_code()); |
- |
- // Accept signatures that either have no restrictions at all or |
- // only have restrictions on the receiver. |
- if (!info->signature()->IsUndefined()) { |
- SignatureInfo* signature = SignatureInfo::cast(info->signature()); |
- if (!signature->args()->IsUndefined()) return; |
- if (!signature->receiver()->IsUndefined()) { |
- expected_receiver_type_ = |
- FunctionTemplateInfo::cast(signature->receiver()); |
- } |
- } |
- |
- is_simple_api_call_ = true; |
- } |
- |
- JSFunction* constant_function_; |
- bool is_simple_api_call_; |
- FunctionTemplateInfo* expected_receiver_type_; |
- CallHandlerInfo* api_call_info_; |
-}; |
- |
- |
// Reserves space for the extra arguments to FastHandleApiCall in the |
// caller's frame. |
// |