| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 624 |
| 625 | 625 |
| 626 // Unwraps JSValue object, returning its field "value" | 626 // Unwraps JSValue object, returning its field "value" |
| 627 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { | 627 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { |
| 628 return Handle<Object>(jsValue->value(), jsValue->GetIsolate()); | 628 return Handle<Object>(jsValue->value(), jsValue->GetIsolate()); |
| 629 } | 629 } |
| 630 | 630 |
| 631 | 631 |
| 632 // Wraps any object into a OpaqueReference, that will hide the object | 632 // Wraps any object into a OpaqueReference, that will hide the object |
| 633 // from JavaScript. | 633 // from JavaScript. |
| 634 static Handle<JSValue> WrapInJSValue(Handle<Object> object) { | 634 static Handle<JSValue> WrapInJSValue(Handle<HeapObject> object) { |
| 635 Isolate* isolate = Isolate::Current(); | 635 Isolate* isolate = object->GetIsolate(); |
| 636 Handle<JSFunction> constructor = isolate->opaque_reference_function(); | 636 Handle<JSFunction> constructor = isolate->opaque_reference_function(); |
| 637 Handle<JSValue> result = | 637 Handle<JSValue> result = |
| 638 Handle<JSValue>::cast(isolate->factory()->NewJSObject(constructor)); | 638 Handle<JSValue>::cast(isolate->factory()->NewJSObject(constructor)); |
| 639 result->set_value(*object); | 639 result->set_value(*object); |
| 640 return result; | 640 return result; |
| 641 } | 641 } |
| 642 | 642 |
| 643 | 643 |
| 644 static Handle<SharedFunctionInfo> UnwrapSharedFunctionInfoFromJSValue( | 644 static Handle<SharedFunctionInfo> UnwrapSharedFunctionInfoFromJSValue( |
| 645 Handle<JSValue> jsValue) { | 645 Handle<JSValue> jsValue) { |
| 646 Object* shared = jsValue->value(); | 646 Object* shared = jsValue->value(); |
| 647 CHECK(shared->IsSharedFunctionInfo()); | 647 CHECK(shared->IsSharedFunctionInfo()); |
| 648 return Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(shared)); | 648 return Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(shared)); |
| 649 } | 649 } |
| 650 | 650 |
| 651 | 651 |
| 652 static int GetArrayLength(Handle<JSArray> array) { | 652 static int GetArrayLength(Handle<JSArray> array) { |
| 653 Object* length = array->length(); | 653 Object* length = array->length(); |
| 654 CHECK(length->IsSmi()); | 654 CHECK(length->IsSmi()); |
| 655 return Smi::cast(length)->value(); | 655 return Smi::cast(length)->value(); |
| 656 } | 656 } |
| 657 | 657 |
| 658 | 658 |
| 659 // Simple helper class that creates more or less typed structures over | 659 // Simple helper class that creates more or less typed structures over |
| 660 // JSArray object. This is an adhoc method of passing structures from C++ | 660 // JSArray object. This is an adhoc method of passing structures from C++ |
| 661 // to JavaScript. | 661 // to JavaScript. |
| 662 template<typename S> | 662 template<typename S> |
| 663 class JSArrayBasedStruct { | 663 class JSArrayBasedStruct { |
| 664 public: | 664 public: |
| 665 static S Create() { | 665 static S Create(Isolate* isolate) { |
| 666 Factory* factory = Isolate::Current()->factory(); | 666 Factory* factory = isolate->factory(); |
| 667 Handle<JSArray> array = factory->NewJSArray(S::kSize_); | 667 Handle<JSArray> array = factory->NewJSArray(S::kSize_); |
| 668 return S(array); | 668 return S(array); |
| 669 } | 669 } |
| 670 static S cast(Object* object) { | 670 static S cast(Object* object) { |
| 671 JSArray* array = JSArray::cast(object); | 671 JSArray* array = JSArray::cast(object); |
| 672 Handle<JSArray> array_handle(array); | 672 Handle<JSArray> array_handle(array); |
| 673 return S(array_handle); | 673 return S(array_handle); |
| 674 } | 674 } |
| 675 explicit JSArrayBasedStruct(Handle<JSArray> array) : array_(array) { | 675 explicit JSArrayBasedStruct(Handle<JSArray> array) : array_(array) { |
| 676 } | 676 } |
| 677 Handle<JSArray> GetJSArray() { | 677 Handle<JSArray> GetJSArray() { |
| 678 return array_; | 678 return array_; |
| 679 } | 679 } |
| 680 Isolate* isolate() const { | 680 Isolate* isolate() const { |
| 681 return array_->GetIsolate(); | 681 return array_->GetIsolate(); |
| 682 } | 682 } |
| 683 | 683 |
| 684 protected: | 684 protected: |
| 685 void SetField(int field_position, Handle<Object> value) { | 685 void SetField(int field_position, Handle<Object> value) { |
| 686 SetElementNonStrict(array_, field_position, value); | 686 SetElementNonStrict(array_, field_position, value); |
| 687 } | 687 } |
| 688 void SetSmiValueField(int field_position, int value) { | 688 void SetSmiValueField(int field_position, int value) { |
| 689 SetElementNonStrict(array_, | 689 SetElementNonStrict(array_, |
| 690 field_position, | 690 field_position, |
| 691 Handle<Smi>(Smi::FromInt(value), isolate())); | 691 Handle<Smi>(Smi::FromInt(value), isolate())); |
| 692 } | 692 } |
| 693 Object* GetField(int field_position) { | 693 Object* GetField(int field_position) { |
| 694 return array_->GetElementNoExceptionThrown(field_position); | 694 return array_->GetElementNoExceptionThrown(isolate(), field_position); |
| 695 } | 695 } |
| 696 int GetSmiValueField(int field_position) { | 696 int GetSmiValueField(int field_position) { |
| 697 Object* res = GetField(field_position); | 697 Object* res = GetField(field_position); |
| 698 CHECK(res->IsSmi()); | 698 CHECK(res->IsSmi()); |
| 699 return Smi::cast(res)->value(); | 699 return Smi::cast(res)->value(); |
| 700 } | 700 } |
| 701 | 701 |
| 702 private: | 702 private: |
| 703 Handle<JSArray> array_; | 703 Handle<JSArray> array_; |
| 704 }; | 704 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 717 int literal_count, int parent_index) { | 717 int literal_count, int parent_index) { |
| 718 HandleScope scope(isolate()); | 718 HandleScope scope(isolate()); |
| 719 this->SetField(kFunctionNameOffset_, name); | 719 this->SetField(kFunctionNameOffset_, name); |
| 720 this->SetSmiValueField(kStartPositionOffset_, start_position); | 720 this->SetSmiValueField(kStartPositionOffset_, start_position); |
| 721 this->SetSmiValueField(kEndPositionOffset_, end_position); | 721 this->SetSmiValueField(kEndPositionOffset_, end_position); |
| 722 this->SetSmiValueField(kParamNumOffset_, param_num); | 722 this->SetSmiValueField(kParamNumOffset_, param_num); |
| 723 this->SetSmiValueField(kLiteralNumOffset_, literal_count); | 723 this->SetSmiValueField(kLiteralNumOffset_, literal_count); |
| 724 this->SetSmiValueField(kParentIndexOffset_, parent_index); | 724 this->SetSmiValueField(kParentIndexOffset_, parent_index); |
| 725 } | 725 } |
| 726 void SetFunctionCode(Handle<Code> function_code, | 726 void SetFunctionCode(Handle<Code> function_code, |
| 727 Handle<Object> code_scope_info) { | 727 Handle<HeapObject> code_scope_info) { |
| 728 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); | 728 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); |
| 729 this->SetField(kCodeOffset_, code_wrapper); | 729 this->SetField(kCodeOffset_, code_wrapper); |
| 730 | 730 |
| 731 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info); | 731 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info); |
| 732 this->SetField(kCodeScopeInfoOffset_, scope_wrapper); | 732 this->SetField(kCodeScopeInfoOffset_, scope_wrapper); |
| 733 } | 733 } |
| 734 void SetOuterScopeInfo(Handle<Object> scope_info_array) { | 734 void SetOuterScopeInfo(Handle<Object> scope_info_array) { |
| 735 this->SetField(kOuterScopeInfoOffset_, scope_info_array); | 735 this->SetField(kOuterScopeInfoOffset_, scope_info_array); |
| 736 } | 736 } |
| 737 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) { | 737 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 }; | 781 }; |
| 782 | 782 |
| 783 | 783 |
| 784 // Wraps SharedFunctionInfo along with some of its fields for passing it | 784 // Wraps SharedFunctionInfo along with some of its fields for passing it |
| 785 // back to JavaScript. SharedFunctionInfo object itself is additionally | 785 // back to JavaScript. SharedFunctionInfo object itself is additionally |
| 786 // wrapped into BlindReference for sanitizing reasons. | 786 // wrapped into BlindReference for sanitizing reasons. |
| 787 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { | 787 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { |
| 788 public: | 788 public: |
| 789 static bool IsInstance(Handle<JSArray> array) { | 789 static bool IsInstance(Handle<JSArray> array) { |
| 790 return array->length() == Smi::FromInt(kSize_) && | 790 return array->length() == Smi::FromInt(kSize_) && |
| 791 array->GetElementNoExceptionThrown(kSharedInfoOffset_)->IsJSValue(); | 791 array->GetElementNoExceptionThrown( |
| 792 array->GetIsolate(), kSharedInfoOffset_)->IsJSValue(); |
| 792 } | 793 } |
| 793 | 794 |
| 794 explicit SharedInfoWrapper(Handle<JSArray> array) | 795 explicit SharedInfoWrapper(Handle<JSArray> array) |
| 795 : JSArrayBasedStruct<SharedInfoWrapper>(array) { | 796 : JSArrayBasedStruct<SharedInfoWrapper>(array) { |
| 796 } | 797 } |
| 797 | 798 |
| 798 void SetProperties(Handle<String> name, int start_position, int end_position, | 799 void SetProperties(Handle<String> name, int start_position, int end_position, |
| 799 Handle<SharedFunctionInfo> info) { | 800 Handle<SharedFunctionInfo> info) { |
| 800 HandleScope scope(isolate()); | 801 HandleScope scope(isolate()); |
| 801 this->SetField(kFunctionNameOffset_, name); | 802 this->SetField(kFunctionNameOffset_, name); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 825 class FunctionInfoListener { | 826 class FunctionInfoListener { |
| 826 public: | 827 public: |
| 827 explicit FunctionInfoListener(Isolate* isolate) { | 828 explicit FunctionInfoListener(Isolate* isolate) { |
| 828 current_parent_index_ = -1; | 829 current_parent_index_ = -1; |
| 829 len_ = 0; | 830 len_ = 0; |
| 830 result_ = isolate->factory()->NewJSArray(10); | 831 result_ = isolate->factory()->NewJSArray(10); |
| 831 } | 832 } |
| 832 | 833 |
| 833 void FunctionStarted(FunctionLiteral* fun) { | 834 void FunctionStarted(FunctionLiteral* fun) { |
| 834 HandleScope scope(isolate()); | 835 HandleScope scope(isolate()); |
| 835 FunctionInfoWrapper info = FunctionInfoWrapper::Create(); | 836 FunctionInfoWrapper info = FunctionInfoWrapper::Create(isolate()); |
| 836 info.SetInitialProperties(fun->name(), fun->start_position(), | 837 info.SetInitialProperties(fun->name(), fun->start_position(), |
| 837 fun->end_position(), fun->parameter_count(), | 838 fun->end_position(), fun->parameter_count(), |
| 838 fun->materialized_literal_count(), | 839 fun->materialized_literal_count(), |
| 839 current_parent_index_); | 840 current_parent_index_); |
| 840 current_parent_index_ = len_; | 841 current_parent_index_ = len_; |
| 841 SetElementNonStrict(result_, len_, info.GetJSArray()); | 842 SetElementNonStrict(result_, len_, info.GetJSArray()); |
| 842 len_++; | 843 len_++; |
| 843 } | 844 } |
| 844 | 845 |
| 845 void FunctionDone() { | 846 void FunctionDone() { |
| 846 HandleScope scope(isolate()); | 847 HandleScope scope(isolate()); |
| 847 FunctionInfoWrapper info = | 848 FunctionInfoWrapper info = |
| 848 FunctionInfoWrapper::cast( | 849 FunctionInfoWrapper::cast( |
| 849 result_->GetElementNoExceptionThrown(current_parent_index_)); | 850 result_->GetElementNoExceptionThrown( |
| 851 isolate(), current_parent_index_)); |
| 850 current_parent_index_ = info.GetParentIndex(); | 852 current_parent_index_ = info.GetParentIndex(); |
| 851 } | 853 } |
| 852 | 854 |
| 853 // Saves only function code, because for a script function we | 855 // Saves only function code, because for a script function we |
| 854 // may never create a SharedFunctionInfo object. | 856 // may never create a SharedFunctionInfo object. |
| 855 void FunctionCode(Handle<Code> function_code) { | 857 void FunctionCode(Handle<Code> function_code) { |
| 856 FunctionInfoWrapper info = | 858 FunctionInfoWrapper info = |
| 857 FunctionInfoWrapper::cast( | 859 FunctionInfoWrapper::cast( |
| 858 result_->GetElementNoExceptionThrown(current_parent_index_)); | 860 result_->GetElementNoExceptionThrown( |
| 861 isolate(), current_parent_index_)); |
| 859 info.SetFunctionCode(function_code, | 862 info.SetFunctionCode(function_code, |
| 860 Handle<Object>(isolate()->heap()->null_value(), | 863 Handle<HeapObject>(isolate()->heap()->null_value())); |
| 861 isolate())); | |
| 862 } | 864 } |
| 863 | 865 |
| 864 // Saves full information about a function: its code, its scope info | 866 // Saves full information about a function: its code, its scope info |
| 865 // and a SharedFunctionInfo object. | 867 // and a SharedFunctionInfo object. |
| 866 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, | 868 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, |
| 867 Zone* zone) { | 869 Zone* zone) { |
| 868 if (!shared->IsSharedFunctionInfo()) { | 870 if (!shared->IsSharedFunctionInfo()) { |
| 869 return; | 871 return; |
| 870 } | 872 } |
| 871 FunctionInfoWrapper info = | 873 FunctionInfoWrapper info = |
| 872 FunctionInfoWrapper::cast( | 874 FunctionInfoWrapper::cast( |
| 873 result_->GetElementNoExceptionThrown(current_parent_index_)); | 875 result_->GetElementNoExceptionThrown( |
| 876 isolate(), current_parent_index_)); |
| 874 info.SetFunctionCode(Handle<Code>(shared->code()), | 877 info.SetFunctionCode(Handle<Code>(shared->code()), |
| 875 Handle<Object>(shared->scope_info(), isolate())); | 878 Handle<HeapObject>(shared->scope_info())); |
| 876 info.SetSharedFunctionInfo(shared); | 879 info.SetSharedFunctionInfo(shared); |
| 877 | 880 |
| 878 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone), | 881 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone), |
| 879 isolate()); | 882 isolate()); |
| 880 info.SetOuterScopeInfo(scope_info_list); | 883 info.SetOuterScopeInfo(scope_info_list); |
| 881 } | 884 } |
| 882 | 885 |
| 883 Handle<JSArray> GetResult() { return result_; } | 886 Handle<JSArray> GetResult() { return result_; } |
| 884 | 887 |
| 885 private: | 888 private: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 931 } |
| 929 | 932 |
| 930 Handle<JSArray> result_; | 933 Handle<JSArray> result_; |
| 931 int len_; | 934 int len_; |
| 932 int current_parent_index_; | 935 int current_parent_index_; |
| 933 }; | 936 }; |
| 934 | 937 |
| 935 | 938 |
| 936 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, | 939 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, |
| 937 Handle<String> source) { | 940 Handle<String> source) { |
| 938 Isolate* isolate = Isolate::Current(); | 941 Isolate* isolate = script->GetIsolate(); |
| 939 | 942 |
| 940 FunctionInfoListener listener(isolate); | 943 FunctionInfoListener listener(isolate); |
| 941 Handle<Object> original_source = | 944 Handle<Object> original_source = |
| 942 Handle<Object>(script->source(), isolate); | 945 Handle<Object>(script->source(), isolate); |
| 943 script->set_source(*source); | 946 script->set_source(*source); |
| 944 isolate->set_active_function_info_listener(&listener); | 947 isolate->set_active_function_info_listener(&listener); |
| 945 | 948 |
| 946 { | 949 { |
| 947 // Creating verbose TryCatch from public API is currently the only way to | 950 // Creating verbose TryCatch from public API is currently the only way to |
| 948 // force code save location. We do not use this the object directly. | 951 // force code save location. We do not use this the object directly. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 if (rethrow_exception.is_null()) { | 997 if (rethrow_exception.is_null()) { |
| 995 return *(listener.GetResult()); | 998 return *(listener.GetResult()); |
| 996 } else { | 999 } else { |
| 997 isolate->Throw(*rethrow_exception); | 1000 isolate->Throw(*rethrow_exception); |
| 998 return 0; | 1001 return 0; |
| 999 } | 1002 } |
| 1000 } | 1003 } |
| 1001 | 1004 |
| 1002 | 1005 |
| 1003 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { | 1006 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { |
| 1004 HandleScope scope(array->GetIsolate()); | 1007 Isolate* isolate = array->GetIsolate(); |
| 1008 HandleScope scope(isolate); |
| 1005 int len = GetArrayLength(array); | 1009 int len = GetArrayLength(array); |
| 1006 for (int i = 0; i < len; i++) { | 1010 for (int i = 0; i < len; i++) { |
| 1007 Handle<SharedFunctionInfo> info( | 1011 Handle<SharedFunctionInfo> info( |
| 1008 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i))); | 1012 SharedFunctionInfo::cast( |
| 1009 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); | 1013 array->GetElementNoExceptionThrown(isolate, i))); |
| 1014 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate); |
| 1010 Handle<String> name_handle(String::cast(info->name())); | 1015 Handle<String> name_handle(String::cast(info->name())); |
| 1011 info_wrapper.SetProperties(name_handle, info->start_position(), | 1016 info_wrapper.SetProperties(name_handle, info->start_position(), |
| 1012 info->end_position(), info); | 1017 info->end_position(), info); |
| 1013 SetElementNonStrict(array, i, info_wrapper.GetJSArray()); | 1018 SetElementNonStrict(array, i, info_wrapper.GetJSArray()); |
| 1014 } | 1019 } |
| 1015 } | 1020 } |
| 1016 | 1021 |
| 1017 | 1022 |
| 1018 // Visitor that finds all references to a particular code object, | 1023 // Visitor that finds all references to a particular code object, |
| 1019 // including "CODE_TARGET" references in other code objects and replaces | 1024 // including "CODE_TARGET" references in other code objects and replaces |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 int inlined_count = data->InlinedFunctionCount()->value(); | 1240 int inlined_count = data->InlinedFunctionCount()->value(); |
| 1236 for (int i = 0; i < inlined_count; ++i) { | 1241 for (int i = 0; i < inlined_count; ++i) { |
| 1237 JSFunction* inlined = JSFunction::cast(literals->get(i)); | 1242 JSFunction* inlined = JSFunction::cast(literals->get(i)); |
| 1238 if (inlined->shared() == candidate) return true; | 1243 if (inlined->shared() == candidate) return true; |
| 1239 } | 1244 } |
| 1240 | 1245 |
| 1241 return false; | 1246 return false; |
| 1242 } | 1247 } |
| 1243 | 1248 |
| 1244 | 1249 |
| 1245 class DependentFunctionFilter : public OptimizedFunctionFilter { | 1250 // Marks code that shares the same shared function info or has inlined |
| 1251 // code that shares the same function info. |
| 1252 class DependentFunctionMarker: public OptimizedFunctionVisitor { |
| 1246 public: | 1253 public: |
| 1247 explicit DependentFunctionFilter( | 1254 SharedFunctionInfo* shared_info_; |
| 1248 SharedFunctionInfo* function_info) | 1255 bool found_; |
| 1249 : function_info_(function_info) {} | |
| 1250 | 1256 |
| 1251 virtual bool TakeFunction(JSFunction* function) { | 1257 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info) |
| 1252 return (function->shared() == function_info_ || | 1258 : shared_info_(shared_info), found_(false) { } |
| 1253 IsInlined(function, function_info_)); | 1259 |
| 1260 virtual void EnterContext(Context* context) { } // Don't care. |
| 1261 virtual void LeaveContext(Context* context) { } // Don't care. |
| 1262 virtual void VisitFunction(JSFunction* function) { |
| 1263 // It should be guaranteed by the iterator that everything is optimized. |
| 1264 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
| 1265 if (shared_info_ == function->shared() || |
| 1266 IsInlined(function, shared_info_)) { |
| 1267 // Mark the code for deoptimization. |
| 1268 function->code()->set_marked_for_deoptimization(true); |
| 1269 found_ = true; |
| 1270 } |
| 1254 } | 1271 } |
| 1255 | |
| 1256 private: | |
| 1257 SharedFunctionInfo* function_info_; | |
| 1258 }; | 1272 }; |
| 1259 | 1273 |
| 1260 | 1274 |
| 1261 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) { | 1275 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) { |
| 1262 DisallowHeapAllocation no_allocation; | 1276 DisallowHeapAllocation no_allocation; |
| 1277 DependentFunctionMarker marker(function_info); |
| 1278 // TODO(titzer): need to traverse all optimized code to find OSR code here. |
| 1279 Deoptimizer::VisitAllOptimizedFunctions(function_info->GetIsolate(), &marker); |
| 1263 | 1280 |
| 1264 DependentFunctionFilter filter(function_info); | 1281 if (marker.found_) { |
| 1265 Deoptimizer::DeoptimizeAllFunctionsWith(function_info->GetIsolate(), &filter); | 1282 // Only go through with the deoptimization if something was found. |
| 1283 Deoptimizer::DeoptimizeMarkedCode(function_info->GetIsolate()); |
| 1284 } |
| 1266 } | 1285 } |
| 1267 | 1286 |
| 1268 | 1287 |
| 1269 MaybeObject* LiveEdit::ReplaceFunctionCode( | 1288 MaybeObject* LiveEdit::ReplaceFunctionCode( |
| 1270 Handle<JSArray> new_compile_info_array, | 1289 Handle<JSArray> new_compile_info_array, |
| 1271 Handle<JSArray> shared_info_array) { | 1290 Handle<JSArray> shared_info_array) { |
| 1272 Isolate* isolate = Isolate::Current(); | 1291 Isolate* isolate = new_compile_info_array->GetIsolate(); |
| 1273 HandleScope scope(isolate); | 1292 HandleScope scope(isolate); |
| 1274 | 1293 |
| 1275 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1294 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
| 1276 return isolate->ThrowIllegalOperation(); | 1295 return isolate->ThrowIllegalOperation(); |
| 1277 } | 1296 } |
| 1278 | 1297 |
| 1279 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); | 1298 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); |
| 1280 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1299 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
| 1281 | 1300 |
| 1282 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 1301 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 } | 1355 } |
| 1337 | 1356 |
| 1338 | 1357 |
| 1339 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, | 1358 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, |
| 1340 Handle<Object> script_handle) { | 1359 Handle<Object> script_handle) { |
| 1341 Handle<SharedFunctionInfo> shared_info = | 1360 Handle<SharedFunctionInfo> shared_info = |
| 1342 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); | 1361 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); |
| 1343 CHECK(script_handle->IsScript() || script_handle->IsUndefined()); | 1362 CHECK(script_handle->IsScript() || script_handle->IsUndefined()); |
| 1344 shared_info->set_script(*script_handle); | 1363 shared_info->set_script(*script_handle); |
| 1345 | 1364 |
| 1346 Isolate::Current()->compilation_cache()->Remove(shared_info); | 1365 function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info); |
| 1347 } | 1366 } |
| 1348 | 1367 |
| 1349 | 1368 |
| 1350 // For a script text change (defined as position_change_array), translates | 1369 // For a script text change (defined as position_change_array), translates |
| 1351 // position in unchanged text to position in changed text. | 1370 // position in unchanged text to position in changed text. |
| 1352 // Text change is a set of non-overlapping regions in text, that have changed | 1371 // Text change is a set of non-overlapping regions in text, that have changed |
| 1353 // their contents and length. It is specified as array of groups of 3 numbers: | 1372 // their contents and length. It is specified as array of groups of 3 numbers: |
| 1354 // (change_begin, change_end, change_end_new_position). | 1373 // (change_begin, change_end, change_end_new_position). |
| 1355 // Each group describes a change in text; groups are sorted by change_begin. | 1374 // Each group describes a change in text; groups are sorted by change_begin. |
| 1356 // Only position in text beyond any changes may be successfully translated. | 1375 // Only position in text beyond any changes may be successfully translated. |
| 1357 // If a positions is inside some region that changed, result is currently | 1376 // If a positions is inside some region that changed, result is currently |
| 1358 // undefined. | 1377 // undefined. |
| 1359 static int TranslatePosition(int original_position, | 1378 static int TranslatePosition(int original_position, |
| 1360 Handle<JSArray> position_change_array) { | 1379 Handle<JSArray> position_change_array) { |
| 1361 int position_diff = 0; | 1380 int position_diff = 0; |
| 1362 int array_len = GetArrayLength(position_change_array); | 1381 int array_len = GetArrayLength(position_change_array); |
| 1382 Isolate* isolate = position_change_array->GetIsolate(); |
| 1363 // TODO(635): binary search may be used here | 1383 // TODO(635): binary search may be used here |
| 1364 for (int i = 0; i < array_len; i += 3) { | 1384 for (int i = 0; i < array_len; i += 3) { |
| 1365 Object* element = position_change_array->GetElementNoExceptionThrown(i); | 1385 Object* element = |
| 1386 position_change_array->GetElementNoExceptionThrown(isolate, i); |
| 1366 CHECK(element->IsSmi()); | 1387 CHECK(element->IsSmi()); |
| 1367 int chunk_start = Smi::cast(element)->value(); | 1388 int chunk_start = Smi::cast(element)->value(); |
| 1368 if (original_position < chunk_start) { | 1389 if (original_position < chunk_start) { |
| 1369 break; | 1390 break; |
| 1370 } | 1391 } |
| 1371 element = position_change_array->GetElementNoExceptionThrown(i + 1); | 1392 element = position_change_array->GetElementNoExceptionThrown(isolate, |
| 1393 i + 1); |
| 1372 CHECK(element->IsSmi()); | 1394 CHECK(element->IsSmi()); |
| 1373 int chunk_end = Smi::cast(element)->value(); | 1395 int chunk_end = Smi::cast(element)->value(); |
| 1374 // Position mustn't be inside a chunk. | 1396 // Position mustn't be inside a chunk. |
| 1375 ASSERT(original_position >= chunk_end); | 1397 ASSERT(original_position >= chunk_end); |
| 1376 element = position_change_array->GetElementNoExceptionThrown(i + 2); | 1398 element = position_change_array->GetElementNoExceptionThrown(isolate, |
| 1399 i + 2); |
| 1377 CHECK(element->IsSmi()); | 1400 CHECK(element->IsSmi()); |
| 1378 int chunk_changed_end = Smi::cast(element)->value(); | 1401 int chunk_changed_end = Smi::cast(element)->value(); |
| 1379 position_diff = chunk_changed_end - chunk_end; | 1402 position_diff = chunk_changed_end - chunk_end; |
| 1380 } | 1403 } |
| 1381 | 1404 |
| 1382 return original_position + position_diff; | 1405 return original_position + position_diff; |
| 1383 } | 1406 } |
| 1384 | 1407 |
| 1385 | 1408 |
| 1386 // Auto-growing buffer for writing relocation info code section. This buffer | 1409 // Auto-growing buffer for writing relocation info code section. This buffer |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 // code object. | 1524 // code object. |
| 1502 Handle<Code> result(isolate->factory()->CopyCode(code, buffer)); | 1525 Handle<Code> result(isolate->factory()->CopyCode(code, buffer)); |
| 1503 return result; | 1526 return result; |
| 1504 } | 1527 } |
| 1505 } | 1528 } |
| 1506 | 1529 |
| 1507 | 1530 |
| 1508 MaybeObject* LiveEdit::PatchFunctionPositions( | 1531 MaybeObject* LiveEdit::PatchFunctionPositions( |
| 1509 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) { | 1532 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) { |
| 1510 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1533 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
| 1511 return Isolate::Current()->ThrowIllegalOperation(); | 1534 return shared_info_array->GetIsolate()->ThrowIllegalOperation(); |
| 1512 } | 1535 } |
| 1513 | 1536 |
| 1514 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1537 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
| 1515 Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo(); | 1538 Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo(); |
| 1516 | 1539 |
| 1517 int old_function_start = info->start_position(); | 1540 int old_function_start = info->start_position(); |
| 1518 int new_function_start = TranslatePosition(old_function_start, | 1541 int new_function_start = TranslatePosition(old_function_start, |
| 1519 position_change_array); | 1542 position_change_array); |
| 1520 int new_function_end = TranslatePosition(info->end_position(), | 1543 int new_function_end = TranslatePosition(info->end_position(), |
| 1521 position_change_array); | 1544 position_change_array); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 Handle<JSArray> result, | 1646 Handle<JSArray> result, |
| 1624 StackFrame* frame, | 1647 StackFrame* frame, |
| 1625 LiveEdit::FunctionPatchabilityStatus status) { | 1648 LiveEdit::FunctionPatchabilityStatus status) { |
| 1626 if (!frame->is_java_script()) return false; | 1649 if (!frame->is_java_script()) return false; |
| 1627 | 1650 |
| 1628 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function()); | 1651 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function()); |
| 1629 | 1652 |
| 1630 Isolate* isolate = shared_info_array->GetIsolate(); | 1653 Isolate* isolate = shared_info_array->GetIsolate(); |
| 1631 int len = GetArrayLength(shared_info_array); | 1654 int len = GetArrayLength(shared_info_array); |
| 1632 for (int i = 0; i < len; i++) { | 1655 for (int i = 0; i < len; i++) { |
| 1633 Object* element = shared_info_array->GetElementNoExceptionThrown(i); | 1656 Object* element = |
| 1657 shared_info_array->GetElementNoExceptionThrown(isolate, i); |
| 1634 CHECK(element->IsJSValue()); | 1658 CHECK(element->IsJSValue()); |
| 1635 Handle<JSValue> jsvalue(JSValue::cast(element)); | 1659 Handle<JSValue> jsvalue(JSValue::cast(element)); |
| 1636 Handle<SharedFunctionInfo> shared = | 1660 Handle<SharedFunctionInfo> shared = |
| 1637 UnwrapSharedFunctionInfoFromJSValue(jsvalue); | 1661 UnwrapSharedFunctionInfoFromJSValue(jsvalue); |
| 1638 | 1662 |
| 1639 if (function->shared() == *shared || IsInlined(*function, *shared)) { | 1663 if (function->shared() == *shared || IsInlined(*function, *shared)) { |
| 1640 SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status), | 1664 SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status), |
| 1641 isolate)); | 1665 isolate)); |
| 1642 return true; | 1666 return true; |
| 1643 } | 1667 } |
| 1644 } | 1668 } |
| 1645 return false; | 1669 return false; |
| 1646 } | 1670 } |
| 1647 | 1671 |
| 1648 | 1672 |
| 1649 // Iterates over handler chain and removes all elements that are inside | 1673 // Iterates over handler chain and removes all elements that are inside |
| 1650 // frames being dropped. | 1674 // frames being dropped. |
| 1651 static bool FixTryCatchHandler(StackFrame* top_frame, | 1675 static bool FixTryCatchHandler(StackFrame* top_frame, |
| 1652 StackFrame* bottom_frame) { | 1676 StackFrame* bottom_frame) { |
| 1653 Address* pointer_address = | 1677 Address* pointer_address = |
| 1654 &Memory::Address_at(Isolate::Current()->get_address_from_id( | 1678 &Memory::Address_at(top_frame->isolate()->get_address_from_id( |
| 1655 Isolate::kHandlerAddress)); | 1679 Isolate::kHandlerAddress)); |
| 1656 | 1680 |
| 1657 while (*pointer_address < top_frame->sp()) { | 1681 while (*pointer_address < top_frame->sp()) { |
| 1658 pointer_address = &Memory::Address_at(*pointer_address); | 1682 pointer_address = &Memory::Address_at(*pointer_address); |
| 1659 } | 1683 } |
| 1660 Address* above_frame_address = pointer_address; | 1684 Address* above_frame_address = pointer_address; |
| 1661 while (*pointer_address < bottom_frame->fp()) { | 1685 while (*pointer_address < bottom_frame->fp()) { |
| 1662 pointer_address = &Memory::Address_at(*pointer_address); | 1686 pointer_address = &Memory::Address_at(*pointer_address); |
| 1663 } | 1687 } |
| 1664 bool change = *above_frame_address != *pointer_address; | 1688 bool change = *above_frame_address != *pointer_address; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1680 return "Stack manipulations are not supported in this architecture."; | 1704 return "Stack manipulations are not supported in this architecture."; |
| 1681 } | 1705 } |
| 1682 | 1706 |
| 1683 StackFrame* pre_top_frame = frames[top_frame_index - 1]; | 1707 StackFrame* pre_top_frame = frames[top_frame_index - 1]; |
| 1684 StackFrame* top_frame = frames[top_frame_index]; | 1708 StackFrame* top_frame = frames[top_frame_index]; |
| 1685 StackFrame* bottom_js_frame = frames[bottom_js_frame_index]; | 1709 StackFrame* bottom_js_frame = frames[bottom_js_frame_index]; |
| 1686 | 1710 |
| 1687 ASSERT(bottom_js_frame->is_java_script()); | 1711 ASSERT(bottom_js_frame->is_java_script()); |
| 1688 | 1712 |
| 1689 // Check the nature of the top frame. | 1713 // Check the nature of the top frame. |
| 1690 Isolate* isolate = Isolate::Current(); | 1714 Isolate* isolate = bottom_js_frame->isolate(); |
| 1691 Code* pre_top_frame_code = pre_top_frame->LookupCode(); | 1715 Code* pre_top_frame_code = pre_top_frame->LookupCode(); |
| 1692 bool frame_has_padding; | 1716 bool frame_has_padding; |
| 1693 if (pre_top_frame_code->is_inline_cache_stub() && | 1717 if (pre_top_frame_code->is_inline_cache_stub() && |
| 1694 pre_top_frame_code->is_debug_stub()) { | 1718 pre_top_frame_code->is_debug_stub()) { |
| 1695 // OK, we can drop inline cache calls. | 1719 // OK, we can drop inline cache calls. |
| 1696 *mode = Debug::FRAME_DROPPED_IN_IC_CALL; | 1720 *mode = Debug::FRAME_DROPPED_IN_IC_CALL; |
| 1697 frame_has_padding = Debug::FramePaddingLayout::kIsSupported; | 1721 frame_has_padding = Debug::FramePaddingLayout::kIsSupported; |
| 1698 } else if (pre_top_frame_code == | 1722 } else if (pre_top_frame_code == |
| 1699 isolate->debug()->debug_break_slot()) { | 1723 isolate->debug()->debug_break_slot()) { |
| 1700 // OK, we can drop debug break slot. | 1724 // OK, we can drop debug break slot. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 return "Not enough space for frame dropper frame"; | 1807 return "Not enough space for frame dropper frame"; |
| 1784 } | 1808 } |
| 1785 } | 1809 } |
| 1786 | 1810 |
| 1787 // Committing now. After this point we should return only NULL value. | 1811 // Committing now. After this point we should return only NULL value. |
| 1788 | 1812 |
| 1789 FixTryCatchHandler(pre_top_frame, bottom_js_frame); | 1813 FixTryCatchHandler(pre_top_frame, bottom_js_frame); |
| 1790 // Make sure FixTryCatchHandler is idempotent. | 1814 // Make sure FixTryCatchHandler is idempotent. |
| 1791 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); | 1815 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); |
| 1792 | 1816 |
| 1793 Handle<Code> code = Isolate::Current()->builtins()->FrameDropper_LiveEdit(); | 1817 Handle<Code> code = isolate->builtins()->FrameDropper_LiveEdit(); |
| 1794 *top_frame_pc_address = code->entry(); | 1818 *top_frame_pc_address = code->entry(); |
| 1795 pre_top_frame->SetCallerFp(bottom_js_frame->fp()); | 1819 pre_top_frame->SetCallerFp(bottom_js_frame->fp()); |
| 1796 | 1820 |
| 1797 *restarter_frame_function_pointer = | 1821 *restarter_frame_function_pointer = |
| 1798 Debug::SetUpFrameDropperFrame(bottom_js_frame, code); | 1822 Debug::SetUpFrameDropperFrame(bottom_js_frame, code); |
| 1799 | 1823 |
| 1800 ASSERT((**restarter_frame_function_pointer)->IsJSFunction()); | 1824 ASSERT((**restarter_frame_function_pointer)->IsJSFunction()); |
| 1801 | 1825 |
| 1802 for (Address a = unused_stack_top; | 1826 for (Address a = unused_stack_top; |
| 1803 a < unused_stack_bottom; | 1827 a < unused_stack_bottom; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1831 } | 1855 } |
| 1832 private: | 1856 private: |
| 1833 Handle<JSArray> m_shared_info_array; | 1857 Handle<JSArray> m_shared_info_array; |
| 1834 Handle<JSArray> m_result; | 1858 Handle<JSArray> m_result; |
| 1835 }; | 1859 }; |
| 1836 | 1860 |
| 1837 | 1861 |
| 1838 // Drops all call frame matched by target and all frames above them. | 1862 // Drops all call frame matched by target and all frames above them. |
| 1839 template<typename TARGET> | 1863 template<typename TARGET> |
| 1840 static const char* DropActivationsInActiveThreadImpl( | 1864 static const char* DropActivationsInActiveThreadImpl( |
| 1841 TARGET& target, bool do_drop) { | 1865 Isolate* isolate, TARGET& target, bool do_drop) { |
| 1842 Isolate* isolate = Isolate::Current(); | |
| 1843 Debug* debug = isolate->debug(); | 1866 Debug* debug = isolate->debug(); |
| 1844 Zone zone(isolate); | 1867 Zone zone(isolate); |
| 1845 Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); | 1868 Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); |
| 1846 | 1869 |
| 1847 | 1870 |
| 1848 int top_frame_index = -1; | 1871 int top_frame_index = -1; |
| 1849 int frame_index = 0; | 1872 int frame_index = 0; |
| 1850 for (; frame_index < frames.length(); frame_index++) { | 1873 for (; frame_index < frames.length(); frame_index++) { |
| 1851 StackFrame* frame = frames[frame_index]; | 1874 StackFrame* frame = frames[frame_index]; |
| 1852 if (frame->id() == debug->break_frame_id()) { | 1875 if (frame->id() == debug->break_frame_id()) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 return NULL; | 1954 return NULL; |
| 1932 } | 1955 } |
| 1933 | 1956 |
| 1934 | 1957 |
| 1935 // Fills result array with statuses of functions. Modifies the stack | 1958 // Fills result array with statuses of functions. Modifies the stack |
| 1936 // removing all listed function if possible and if do_drop is true. | 1959 // removing all listed function if possible and if do_drop is true. |
| 1937 static const char* DropActivationsInActiveThread( | 1960 static const char* DropActivationsInActiveThread( |
| 1938 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) { | 1961 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) { |
| 1939 MultipleFunctionTarget target(shared_info_array, result); | 1962 MultipleFunctionTarget target(shared_info_array, result); |
| 1940 | 1963 |
| 1941 const char* message = | 1964 const char* message = DropActivationsInActiveThreadImpl( |
| 1942 DropActivationsInActiveThreadImpl(target, do_drop); | 1965 shared_info_array->GetIsolate(), target, do_drop); |
| 1943 if (message) { | 1966 if (message) { |
| 1944 return message; | 1967 return message; |
| 1945 } | 1968 } |
| 1946 | 1969 |
| 1947 Isolate* isolate = shared_info_array->GetIsolate(); | 1970 Isolate* isolate = shared_info_array->GetIsolate(); |
| 1948 int array_len = GetArrayLength(shared_info_array); | 1971 int array_len = GetArrayLength(shared_info_array); |
| 1949 | 1972 |
| 1950 // Replace "blocked on active" with "replaced on active" status. | 1973 // Replace "blocked on active" with "replaced on active" status. |
| 1951 for (int i = 0; i < array_len; i++) { | 1974 for (int i = 0; i < array_len; i++) { |
| 1952 if (result->GetElement(i) == | 1975 if (result->GetElement(result->GetIsolate(), i) == |
| 1953 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { | 1976 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { |
| 1954 Handle<Object> replaced( | 1977 Handle<Object> replaced( |
| 1955 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); | 1978 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); |
| 1956 SetElementNonStrict(result, i, replaced); | 1979 SetElementNonStrict(result, i, replaced); |
| 1957 } | 1980 } |
| 1958 } | 1981 } |
| 1959 return NULL; | 1982 return NULL; |
| 1960 } | 1983 } |
| 1961 | 1984 |
| 1962 | 1985 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 SetElementNonStrict( | 2020 SetElementNonStrict( |
| 1998 result, | 2021 result, |
| 1999 i, | 2022 i, |
| 2000 Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate)); | 2023 Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate)); |
| 2001 } | 2024 } |
| 2002 | 2025 |
| 2003 | 2026 |
| 2004 // First check inactive threads. Fail if some functions are blocked there. | 2027 // First check inactive threads. Fail if some functions are blocked there. |
| 2005 InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array, | 2028 InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array, |
| 2006 result); | 2029 result); |
| 2007 Isolate::Current()->thread_manager()->IterateArchivedThreads( | 2030 isolate->thread_manager()->IterateArchivedThreads( |
| 2008 &inactive_threads_checker); | 2031 &inactive_threads_checker); |
| 2009 if (inactive_threads_checker.HasBlockedFunctions()) { | 2032 if (inactive_threads_checker.HasBlockedFunctions()) { |
| 2010 return result; | 2033 return result; |
| 2011 } | 2034 } |
| 2012 | 2035 |
| 2013 // Try to drop activations from the current stack. | 2036 // Try to drop activations from the current stack. |
| 2014 const char* error_message = | 2037 const char* error_message = |
| 2015 DropActivationsInActiveThread(shared_info_array, result, do_drop); | 2038 DropActivationsInActiveThread(shared_info_array, result, do_drop); |
| 2016 if (error_message != NULL) { | 2039 if (error_message != NULL) { |
| 2017 // Add error message as an array extra element. | 2040 // Add error message as an array extra element. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 JavaScriptFrame* m_frame; | 2072 JavaScriptFrame* m_frame; |
| 2050 LiveEdit::FunctionPatchabilityStatus m_saved_status; | 2073 LiveEdit::FunctionPatchabilityStatus m_saved_status; |
| 2051 }; | 2074 }; |
| 2052 | 2075 |
| 2053 | 2076 |
| 2054 // Finds a drops required frame and all frames above. | 2077 // Finds a drops required frame and all frames above. |
| 2055 // Returns error message or NULL. | 2078 // Returns error message or NULL. |
| 2056 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) { | 2079 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) { |
| 2057 SingleFrameTarget target(frame); | 2080 SingleFrameTarget target(frame); |
| 2058 | 2081 |
| 2059 const char* result = DropActivationsInActiveThreadImpl(target, true); | 2082 const char* result = DropActivationsInActiveThreadImpl( |
| 2083 frame->isolate(), target, true); |
| 2060 if (result != NULL) { | 2084 if (result != NULL) { |
| 2061 return result; | 2085 return result; |
| 2062 } | 2086 } |
| 2063 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) { | 2087 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) { |
| 2064 return "Function is blocked under native code"; | 2088 return "Function is blocked under native code"; |
| 2065 } | 2089 } |
| 2066 return NULL; | 2090 return NULL; |
| 2067 } | 2091 } |
| 2068 | 2092 |
| 2069 | 2093 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 | 2152 |
| 2129 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 2130 return false; | 2154 return false; |
| 2131 } | 2155 } |
| 2132 | 2156 |
| 2133 #endif // ENABLE_DEBUGGER_SUPPORT | 2157 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2134 | 2158 |
| 2135 | 2159 |
| 2136 | 2160 |
| 2137 } } // namespace v8::internal | 2161 } } // namespace v8::internal |
| OLD | NEW |