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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 642 |
643 Handle<Code> FunctionInfoWrapper::GetFunctionCode() { | 643 Handle<Code> FunctionInfoWrapper::GetFunctionCode() { |
644 Handle<Object> element = this->GetField(kCodeOffset_); | 644 Handle<Object> element = this->GetField(kCodeOffset_); |
645 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element); | 645 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element); |
646 Handle<Object> raw_result = UnwrapJSValue(value_wrapper); | 646 Handle<Object> raw_result = UnwrapJSValue(value_wrapper); |
647 CHECK(raw_result->IsCode()); | 647 CHECK(raw_result->IsCode()); |
648 return Handle<Code>::cast(raw_result); | 648 return Handle<Code>::cast(raw_result); |
649 } | 649 } |
650 | 650 |
651 | 651 |
652 Handle<FixedArray> FunctionInfoWrapper::GetFeedbackVector() { | 652 Handle<TypeFeedbackVector> FunctionInfoWrapper::GetFeedbackVector() { |
653 Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_); | 653 Handle<Object> element = this->GetField(kSharedFunctionInfoOffset_); |
654 Handle<FixedArray> result; | 654 Handle<TypeFeedbackVector> result; |
655 if (element->IsJSValue()) { | 655 if (element->IsJSValue()) { |
656 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element); | 656 Handle<JSValue> value_wrapper = Handle<JSValue>::cast(element); |
657 Handle<Object> raw_result = UnwrapJSValue(value_wrapper); | 657 Handle<Object> raw_result = UnwrapJSValue(value_wrapper); |
658 Handle<SharedFunctionInfo> shared = | 658 Handle<SharedFunctionInfo> shared = |
659 Handle<SharedFunctionInfo>::cast(raw_result); | 659 Handle<SharedFunctionInfo>::cast(raw_result); |
660 result = Handle<FixedArray>(shared->feedback_vector(), isolate()); | 660 result = Handle<TypeFeedbackVector>(shared->feedback_vector(), isolate()); |
661 CHECK_EQ(result->length(), GetSlotCount()); | 661 CHECK_EQ(result->length(), GetSlotCount()); |
662 } else { | 662 } else { |
663 // Scripts may never have a SharedFunctionInfo created, so | 663 // Scripts may never have a SharedFunctionInfo created, so |
664 // create a type feedback vector here. | 664 // create a type feedback vector here. |
665 int slot_count = GetSlotCount(); | 665 int slot_count = GetSlotCount(); |
666 result = isolate()->factory()->NewTypeFeedbackVector(slot_count); | 666 result = isolate()->factory()->NewTypeFeedbackVector(slot_count); |
667 } | 667 } |
668 return result; | 668 return result; |
669 } | 669 } |
670 | 670 |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 | 1196 |
1197 if (IsJSFunctionCode(shared_info->code())) { | 1197 if (IsJSFunctionCode(shared_info->code())) { |
1198 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); | 1198 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); |
1199 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); | 1199 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); |
1200 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 1200 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
1201 if (code_scope_info->IsFixedArray()) { | 1201 if (code_scope_info->IsFixedArray()) { |
1202 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); | 1202 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); |
1203 } | 1203 } |
1204 shared_info->DisableOptimization(kLiveEdit); | 1204 shared_info->DisableOptimization(kLiveEdit); |
1205 // Update the type feedback vector | 1205 // Update the type feedback vector |
1206 Handle<FixedArray> feedback_vector = | 1206 Handle<TypeFeedbackVector> feedback_vector = |
1207 compile_info_wrapper.GetFeedbackVector(); | 1207 compile_info_wrapper.GetFeedbackVector(); |
1208 shared_info->set_feedback_vector(*feedback_vector); | 1208 shared_info->set_feedback_vector(*feedback_vector); |
1209 } | 1209 } |
1210 | 1210 |
1211 if (shared_info->debug_info()->IsDebugInfo()) { | 1211 if (shared_info->debug_info()->IsDebugInfo()) { |
1212 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); | 1212 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); |
1213 Handle<Code> new_original_code = | 1213 Handle<Code> new_original_code = |
1214 isolate->factory()->CopyCode(compile_info_wrapper.GetFunctionCode()); | 1214 isolate->factory()->CopyCode(compile_info_wrapper.GetFunctionCode()); |
1215 debug_info->set_original_code(*new_original_code); | 1215 debug_info->set_original_code(*new_original_code); |
1216 } | 1216 } |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | 2078 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { |
2079 isolate_->active_function_info_listener()->FunctionCode(code); | 2079 isolate_->active_function_info_listener()->FunctionCode(code); |
2080 } | 2080 } |
2081 | 2081 |
2082 | 2082 |
2083 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2083 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2084 return isolate->active_function_info_listener() != NULL; | 2084 return isolate->active_function_info_listener() != NULL; |
2085 } | 2085 } |
2086 | 2086 |
2087 } } // namespace v8::internal | 2087 } } // namespace v8::internal |
OLD | NEW |