| 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 | 5 |
| 6 #include "src/v8.h" | 6 #include "src/v8.h" |
| 7 | 7 |
| 8 #include "src/liveedit.h" | 8 #include "src/liveedit.h" |
| 9 | 9 |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 m_output->set(m_pos, fun); | 1082 m_output->set(m_pos, fun); |
| 1083 m_pos++; | 1083 m_pos++; |
| 1084 } | 1084 } |
| 1085 private: | 1085 private: |
| 1086 Handle<FixedArray> m_output; | 1086 Handle<FixedArray> m_output; |
| 1087 int m_pos; | 1087 int m_pos; |
| 1088 }; | 1088 }; |
| 1089 }; | 1089 }; |
| 1090 | 1090 |
| 1091 | 1091 |
| 1092 namespace { |
| 1093 |
| 1092 // Check whether the code is natural function code (not a lazy-compile stub | 1094 // Check whether the code is natural function code (not a lazy-compile stub |
| 1093 // code). | 1095 // code). |
| 1094 static bool IsJSFunctionCode(Code* code) { | 1096 bool IsJSFunctionCode(Code* code) { return code->kind() == Code::FUNCTION; } |
| 1095 return code->kind() == Code::FUNCTION; | |
| 1096 } | |
| 1097 | 1097 |
| 1098 | 1098 |
| 1099 // Returns true if an instance of candidate were inlined into function's code. | 1099 // Returns true if an instance of candidate were inlined into function's code. |
| 1100 static bool IsInlined(JSFunction* function, SharedFunctionInfo* candidate) { | 1100 bool IsInlined(JSFunction* function, SharedFunctionInfo* candidate) { |
| 1101 DisallowHeapAllocation no_gc; | 1101 DisallowHeapAllocation no_gc; |
| 1102 | 1102 |
| 1103 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION) return false; | 1103 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION) return false; |
| 1104 | 1104 |
| 1105 DeoptimizationInputData* data = | 1105 DeoptimizationInputData* const data = |
| 1106 DeoptimizationInputData::cast(function->code()->deoptimization_data()); | 1106 DeoptimizationInputData::cast(function->code()->deoptimization_data()); |
| 1107 | 1107 if (data != function->GetIsolate()->heap()->empty_fixed_array()) { |
| 1108 if (data == function->GetIsolate()->heap()->empty_fixed_array()) { | 1108 FixedArray* const literals = data->LiteralArray(); |
| 1109 return false; | 1109 int const inlined_count = data->InlinedFunctionCount()->value(); |
| 1110 } | 1110 for (int i = 0; i < inlined_count; ++i) { |
| 1111 | 1111 if (SharedFunctionInfo::cast(literals->get(i)) == candidate) { |
| 1112 FixedArray* literals = data->LiteralArray(); | 1112 return true; |
| 1113 | 1113 } |
| 1114 int inlined_count = data->InlinedFunctionCount()->value(); | 1114 } |
| 1115 for (int i = 0; i < inlined_count; ++i) { | |
| 1116 JSFunction* inlined = JSFunction::cast(literals->get(i)); | |
| 1117 if (inlined->shared() == candidate) return true; | |
| 1118 } | 1115 } |
| 1119 | 1116 |
| 1120 return false; | 1117 return false; |
| 1121 } | 1118 } |
| 1122 | 1119 |
| 1120 } // namespace |
| 1121 |
| 1123 | 1122 |
| 1124 // Marks code that shares the same shared function info or has inlined | 1123 // Marks code that shares the same shared function info or has inlined |
| 1125 // code that shares the same function info. | 1124 // code that shares the same function info. |
| 1126 class DependentFunctionMarker: public OptimizedFunctionVisitor { | 1125 class DependentFunctionMarker: public OptimizedFunctionVisitor { |
| 1127 public: | 1126 public: |
| 1128 SharedFunctionInfo* shared_info_; | 1127 SharedFunctionInfo* shared_info_; |
| 1129 bool found_; | 1128 bool found_; |
| 1130 | 1129 |
| 1131 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info) | 1130 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info) |
| 1132 : shared_info_(shared_info), found_(false) { } | 1131 : shared_info_(shared_info), found_(false) { } |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | 2054 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { |
| 2056 isolate_->active_function_info_listener()->FunctionCode(code); | 2055 isolate_->active_function_info_listener()->FunctionCode(code); |
| 2057 } | 2056 } |
| 2058 | 2057 |
| 2059 | 2058 |
| 2060 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2059 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 2061 return isolate->active_function_info_listener() != NULL; | 2060 return isolate->active_function_info_listener() != NULL; |
| 2062 } | 2061 } |
| 2063 | 2062 |
| 2064 } } // namespace v8::internal | 2063 } } // namespace v8::internal |
| OLD | NEW |