| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 line_pos1 += subrange_offset1_; | 535 line_pos1 += subrange_offset1_; |
| 536 line_pos2 += subrange_offset2_; | 536 line_pos2 += subrange_offset2_; |
| 537 | 537 |
| 538 int char_pos1 = line_ends1_.GetLineStart(line_pos1); | 538 int char_pos1 = line_ends1_.GetLineStart(line_pos1); |
| 539 int char_pos2 = line_ends2_.GetLineStart(line_pos2); | 539 int char_pos2 = line_ends2_.GetLineStart(line_pos2); |
| 540 int char_len1 = line_ends1_.GetLineStart(line_pos1 + line_len1) - char_pos1; | 540 int char_len1 = line_ends1_.GetLineStart(line_pos1 + line_len1) - char_pos1; |
| 541 int char_len2 = line_ends2_.GetLineStart(line_pos2 + line_len2) - char_pos2; | 541 int char_len2 = line_ends2_.GetLineStart(line_pos2 + line_len2) - char_pos2; |
| 542 | 542 |
| 543 if (char_len1 < CHUNK_LEN_LIMIT && char_len2 < CHUNK_LEN_LIMIT) { | 543 if (char_len1 < CHUNK_LEN_LIMIT && char_len2 < CHUNK_LEN_LIMIT) { |
| 544 // Chunk is small enough to conduct a nested token-level diff. | 544 // Chunk is small enough to conduct a nested token-level diff. |
| 545 HandleScope subTaskScope; | 545 HandleScope subTaskScope(s1_->GetIsolate()); |
| 546 | 546 |
| 547 TokensCompareInput tokens_input(s1_, char_pos1, char_len1, | 547 TokensCompareInput tokens_input(s1_, char_pos1, char_len1, |
| 548 s2_, char_pos2, char_len2); | 548 s2_, char_pos2, char_len2); |
| 549 TokensCompareOutput tokens_output(&array_writer_, char_pos1, | 549 TokensCompareOutput tokens_output(&array_writer_, char_pos1, |
| 550 char_pos2); | 550 char_pos2); |
| 551 | 551 |
| 552 Comparator::CalculateDifference(&tokens_input, &tokens_output); | 552 Comparator::CalculateDifference(&tokens_input, &tokens_output); |
| 553 } else { | 553 } else { |
| 554 array_writer_.WriteChunk(char_pos1, char_pos2, char_len1, char_len2); | 554 array_writer_.WriteChunk(char_pos1, char_pos2, char_len1, char_len2); |
| 555 } | 555 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 static S cast(Object* object) { | 664 static S cast(Object* object) { |
| 665 JSArray* array = JSArray::cast(object); | 665 JSArray* array = JSArray::cast(object); |
| 666 Handle<JSArray> array_handle(array); | 666 Handle<JSArray> array_handle(array); |
| 667 return S(array_handle); | 667 return S(array_handle); |
| 668 } | 668 } |
| 669 explicit JSArrayBasedStruct(Handle<JSArray> array) : array_(array) { | 669 explicit JSArrayBasedStruct(Handle<JSArray> array) : array_(array) { |
| 670 } | 670 } |
| 671 Handle<JSArray> GetJSArray() { | 671 Handle<JSArray> GetJSArray() { |
| 672 return array_; | 672 return array_; |
| 673 } | 673 } |
| 674 Isolate* isolate() const { |
| 675 return array_->GetIsolate(); |
| 676 } |
| 674 | 677 |
| 675 protected: | 678 protected: |
| 676 void SetField(int field_position, Handle<Object> value) { | 679 void SetField(int field_position, Handle<Object> value) { |
| 677 SetElementNonStrict(array_, field_position, value); | 680 SetElementNonStrict(array_, field_position, value); |
| 678 } | 681 } |
| 679 void SetSmiValueField(int field_position, int value) { | 682 void SetSmiValueField(int field_position, int value) { |
| 680 SetElementNonStrict(array_, | 683 SetElementNonStrict(array_, |
| 681 field_position, | 684 field_position, |
| 682 Handle<Smi>(Smi::FromInt(value))); | 685 Handle<Smi>(Smi::FromInt(value))); |
| 683 } | 686 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 699 // from JavaScript. It contains Code object, which is kept wrapped | 702 // from JavaScript. It contains Code object, which is kept wrapped |
| 700 // into a BlindReference for sanitizing reasons. | 703 // into a BlindReference for sanitizing reasons. |
| 701 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { | 704 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { |
| 702 public: | 705 public: |
| 703 explicit FunctionInfoWrapper(Handle<JSArray> array) | 706 explicit FunctionInfoWrapper(Handle<JSArray> array) |
| 704 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { | 707 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { |
| 705 } | 708 } |
| 706 void SetInitialProperties(Handle<String> name, int start_position, | 709 void SetInitialProperties(Handle<String> name, int start_position, |
| 707 int end_position, int param_num, | 710 int end_position, int param_num, |
| 708 int literal_count, int parent_index) { | 711 int literal_count, int parent_index) { |
| 709 HandleScope scope; | 712 HandleScope scope(isolate()); |
| 710 this->SetField(kFunctionNameOffset_, name); | 713 this->SetField(kFunctionNameOffset_, name); |
| 711 this->SetSmiValueField(kStartPositionOffset_, start_position); | 714 this->SetSmiValueField(kStartPositionOffset_, start_position); |
| 712 this->SetSmiValueField(kEndPositionOffset_, end_position); | 715 this->SetSmiValueField(kEndPositionOffset_, end_position); |
| 713 this->SetSmiValueField(kParamNumOffset_, param_num); | 716 this->SetSmiValueField(kParamNumOffset_, param_num); |
| 714 this->SetSmiValueField(kLiteralNumOffset_, literal_count); | 717 this->SetSmiValueField(kLiteralNumOffset_, literal_count); |
| 715 this->SetSmiValueField(kParentIndexOffset_, parent_index); | 718 this->SetSmiValueField(kParentIndexOffset_, parent_index); |
| 716 } | 719 } |
| 717 void SetFunctionCode(Handle<Code> function_code, | 720 void SetFunctionCode(Handle<Code> function_code, |
| 718 Handle<Object> code_scope_info) { | 721 Handle<Object> code_scope_info) { |
| 719 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); | 722 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 return array->length() == Smi::FromInt(kSize_) && | 784 return array->length() == Smi::FromInt(kSize_) && |
| 782 array->GetElementNoExceptionThrown(kSharedInfoOffset_)->IsJSValue(); | 785 array->GetElementNoExceptionThrown(kSharedInfoOffset_)->IsJSValue(); |
| 783 } | 786 } |
| 784 | 787 |
| 785 explicit SharedInfoWrapper(Handle<JSArray> array) | 788 explicit SharedInfoWrapper(Handle<JSArray> array) |
| 786 : JSArrayBasedStruct<SharedInfoWrapper>(array) { | 789 : JSArrayBasedStruct<SharedInfoWrapper>(array) { |
| 787 } | 790 } |
| 788 | 791 |
| 789 void SetProperties(Handle<String> name, int start_position, int end_position, | 792 void SetProperties(Handle<String> name, int start_position, int end_position, |
| 790 Handle<SharedFunctionInfo> info) { | 793 Handle<SharedFunctionInfo> info) { |
| 791 HandleScope scope; | 794 HandleScope scope(isolate()); |
| 792 this->SetField(kFunctionNameOffset_, name); | 795 this->SetField(kFunctionNameOffset_, name); |
| 793 Handle<JSValue> info_holder = WrapInJSValue(info); | 796 Handle<JSValue> info_holder = WrapInJSValue(info); |
| 794 this->SetField(kSharedInfoOffset_, info_holder); | 797 this->SetField(kSharedInfoOffset_, info_holder); |
| 795 this->SetSmiValueField(kStartPositionOffset_, start_position); | 798 this->SetSmiValueField(kStartPositionOffset_, start_position); |
| 796 this->SetSmiValueField(kEndPositionOffset_, end_position); | 799 this->SetSmiValueField(kEndPositionOffset_, end_position); |
| 797 } | 800 } |
| 798 Handle<SharedFunctionInfo> GetInfo() { | 801 Handle<SharedFunctionInfo> GetInfo() { |
| 799 Object* element = this->GetField(kSharedInfoOffset_); | 802 Object* element = this->GetField(kSharedInfoOffset_); |
| 800 CHECK(element->IsJSValue()); | 803 CHECK(element->IsJSValue()); |
| 801 Handle<JSValue> value_wrapper(JSValue::cast(element)); | 804 Handle<JSValue> value_wrapper(JSValue::cast(element)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 815 | 818 |
| 816 class FunctionInfoListener { | 819 class FunctionInfoListener { |
| 817 public: | 820 public: |
| 818 FunctionInfoListener() { | 821 FunctionInfoListener() { |
| 819 current_parent_index_ = -1; | 822 current_parent_index_ = -1; |
| 820 len_ = 0; | 823 len_ = 0; |
| 821 result_ = FACTORY->NewJSArray(10); | 824 result_ = FACTORY->NewJSArray(10); |
| 822 } | 825 } |
| 823 | 826 |
| 824 void FunctionStarted(FunctionLiteral* fun) { | 827 void FunctionStarted(FunctionLiteral* fun) { |
| 825 HandleScope scope; | 828 HandleScope scope(result_->GetIsolate()); |
| 826 FunctionInfoWrapper info = FunctionInfoWrapper::Create(); | 829 FunctionInfoWrapper info = FunctionInfoWrapper::Create(); |
| 827 info.SetInitialProperties(fun->name(), fun->start_position(), | 830 info.SetInitialProperties(fun->name(), fun->start_position(), |
| 828 fun->end_position(), fun->parameter_count(), | 831 fun->end_position(), fun->parameter_count(), |
| 829 fun->materialized_literal_count(), | 832 fun->materialized_literal_count(), |
| 830 current_parent_index_); | 833 current_parent_index_); |
| 831 current_parent_index_ = len_; | 834 current_parent_index_ = len_; |
| 832 SetElementNonStrict(result_, len_, info.GetJSArray()); | 835 SetElementNonStrict(result_, len_, info.GetJSArray()); |
| 833 len_++; | 836 len_++; |
| 834 } | 837 } |
| 835 | 838 |
| 836 void FunctionDone() { | 839 void FunctionDone() { |
| 837 HandleScope scope; | 840 HandleScope scope(result_->GetIsolate()); |
| 838 FunctionInfoWrapper info = | 841 FunctionInfoWrapper info = |
| 839 FunctionInfoWrapper::cast( | 842 FunctionInfoWrapper::cast( |
| 840 result_->GetElementNoExceptionThrown(current_parent_index_)); | 843 result_->GetElementNoExceptionThrown(current_parent_index_)); |
| 841 current_parent_index_ = info.GetParentIndex(); | 844 current_parent_index_ = info.GetParentIndex(); |
| 842 } | 845 } |
| 843 | 846 |
| 844 // Saves only function code, because for a script function we | 847 // Saves only function code, because for a script function we |
| 845 // may never create a SharedFunctionInfo object. | 848 // may never create a SharedFunctionInfo object. |
| 846 void FunctionCode(Handle<Code> function_code) { | 849 void FunctionCode(Handle<Code> function_code) { |
| 847 FunctionInfoWrapper info = | 850 FunctionInfoWrapper info = |
| 848 FunctionInfoWrapper::cast( | 851 FunctionInfoWrapper::cast( |
| 849 result_->GetElementNoExceptionThrown(current_parent_index_)); | 852 result_->GetElementNoExceptionThrown(current_parent_index_)); |
| 850 info.SetFunctionCode(function_code, Handle<Object>(HEAP->null_value())); | 853 info.SetFunctionCode(function_code, Handle<Object>(HEAP->null_value())); |
| 851 } | 854 } |
| 852 | 855 |
| 853 // Saves full information about a function: its code, its scope info | 856 // Saves full information about a function: its code, its scope info |
| 854 // and a SharedFunctionInfo object. | 857 // and a SharedFunctionInfo object. |
| 855 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, | 858 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, |
| 856 Zone* zone) { | 859 Zone* zone) { |
| 857 if (!shared->IsSharedFunctionInfo()) { | 860 if (!shared->IsSharedFunctionInfo()) { |
| 858 return; | 861 return; |
| 859 } | 862 } |
| 860 FunctionInfoWrapper info = | 863 FunctionInfoWrapper info = |
| 861 FunctionInfoWrapper::cast( | 864 FunctionInfoWrapper::cast( |
| 862 result_->GetElementNoExceptionThrown(current_parent_index_)); | 865 result_->GetElementNoExceptionThrown(current_parent_index_)); |
| 863 info.SetFunctionCode(Handle<Code>(shared->code()), | 866 info.SetFunctionCode(Handle<Code>(shared->code()), |
| 864 Handle<Object>(shared->scope_info())); | 867 Handle<Object>(shared->scope_info())); |
| 865 info.SetSharedFunctionInfo(shared); | 868 info.SetSharedFunctionInfo(shared); |
| 866 | 869 |
| 867 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone)); | 870 Handle<Object> scope_info_list( |
| 871 SerializeFunctionScope(shared->GetIsolate(), scope, zone)); |
| 868 info.SetOuterScopeInfo(scope_info_list); | 872 info.SetOuterScopeInfo(scope_info_list); |
| 869 } | 873 } |
| 870 | 874 |
| 871 Handle<JSArray> GetResult() { return result_; } | 875 Handle<JSArray> GetResult() { return result_; } |
| 872 | 876 |
| 873 private: | 877 private: |
| 874 Object* SerializeFunctionScope(Scope* scope, Zone* zone) { | 878 Object* SerializeFunctionScope(Isolate* isolate, Scope* scope, Zone* zone) { |
| 875 HandleScope handle_scope; | 879 HandleScope handle_scope(isolate); |
| 876 | 880 |
| 877 Handle<JSArray> scope_info_list = FACTORY->NewJSArray(10); | 881 Handle<JSArray> scope_info_list = isolate->factory()->NewJSArray(10); |
| 878 int scope_info_length = 0; | 882 int scope_info_length = 0; |
| 879 | 883 |
| 880 // Saves some description of scope. It stores name and indexes of | 884 // Saves some description of scope. It stores name and indexes of |
| 881 // variables in the whole scope chain. Null-named slots delimit | 885 // variables in the whole scope chain. Null-named slots delimit |
| 882 // scopes of this chain. | 886 // scopes of this chain. |
| 883 Scope* outer_scope = scope->outer_scope(); | 887 Scope* outer_scope = scope->outer_scope(); |
| 884 if (outer_scope == NULL) { | 888 if (outer_scope == NULL) { |
| 885 return HEAP->undefined_value(); | 889 return isolate->heap()->undefined_value(); |
| 886 } | 890 } |
| 887 do { | 891 do { |
| 888 ZoneList<Variable*> stack_list(outer_scope->StackLocalCount(), zone); | 892 ZoneList<Variable*> stack_list(outer_scope->StackLocalCount(), zone); |
| 889 ZoneList<Variable*> context_list(outer_scope->ContextLocalCount(), zone); | 893 ZoneList<Variable*> context_list(outer_scope->ContextLocalCount(), zone); |
| 890 outer_scope->CollectStackAndContextLocals(&stack_list, &context_list); | 894 outer_scope->CollectStackAndContextLocals(&stack_list, &context_list); |
| 891 context_list.Sort(&Variable::CompareIndex); | 895 context_list.Sort(&Variable::CompareIndex); |
| 892 | 896 |
| 893 for (int i = 0; i < context_list.length(); i++) { | 897 for (int i = 0; i < context_list.length(); i++) { |
| 894 SetElementNonStrict(scope_info_list, | 898 SetElementNonStrict(scope_info_list, |
| 895 scope_info_length, | 899 scope_info_length, |
| 896 context_list[i]->name()); | 900 context_list[i]->name()); |
| 897 scope_info_length++; | 901 scope_info_length++; |
| 898 SetElementNonStrict( | 902 SetElementNonStrict( |
| 899 scope_info_list, | 903 scope_info_list, |
| 900 scope_info_length, | 904 scope_info_length, |
| 901 Handle<Smi>(Smi::FromInt(context_list[i]->index()))); | 905 Handle<Smi>(Smi::FromInt(context_list[i]->index()))); |
| 902 scope_info_length++; | 906 scope_info_length++; |
| 903 } | 907 } |
| 904 SetElementNonStrict(scope_info_list, | 908 SetElementNonStrict(scope_info_list, |
| 905 scope_info_length, | 909 scope_info_length, |
| 906 Handle<Object>(HEAP->null_value())); | 910 Handle<Object>(isolate->heap()->null_value())); |
| 907 scope_info_length++; | 911 scope_info_length++; |
| 908 | 912 |
| 909 outer_scope = outer_scope->outer_scope(); | 913 outer_scope = outer_scope->outer_scope(); |
| 910 } while (outer_scope != NULL); | 914 } while (outer_scope != NULL); |
| 911 | 915 |
| 912 return *scope_info_list; | 916 return *scope_info_list; |
| 913 } | 917 } |
| 914 | 918 |
| 915 Handle<JSArray> result_; | 919 Handle<JSArray> result_; |
| 916 int len_; | 920 int len_; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 if (rethrow_exception.is_null()) { | 980 if (rethrow_exception.is_null()) { |
| 977 return *(listener.GetResult()); | 981 return *(listener.GetResult()); |
| 978 } else { | 982 } else { |
| 979 isolate->Throw(*rethrow_exception); | 983 isolate->Throw(*rethrow_exception); |
| 980 return 0; | 984 return 0; |
| 981 } | 985 } |
| 982 } | 986 } |
| 983 | 987 |
| 984 | 988 |
| 985 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { | 989 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { |
| 986 HandleScope scope; | 990 HandleScope scope(array->GetIsolate()); |
| 987 int len = GetArrayLength(array); | 991 int len = GetArrayLength(array); |
| 988 for (int i = 0; i < len; i++) { | 992 for (int i = 0; i < len; i++) { |
| 989 Handle<SharedFunctionInfo> info( | 993 Handle<SharedFunctionInfo> info( |
| 990 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i))); | 994 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i))); |
| 991 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); | 995 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); |
| 992 Handle<String> name_handle(String::cast(info->name())); | 996 Handle<String> name_handle(String::cast(info->name())); |
| 993 info_wrapper.SetProperties(name_handle, info->start_position(), | 997 info_wrapper.SetProperties(name_handle, info->start_position(), |
| 994 info->end_position(), info); | 998 info->end_position(), info); |
| 995 SetElementNonStrict(array, i, info_wrapper.GetJSArray()); | 999 SetElementNonStrict(array, i, info_wrapper.GetJSArray()); |
| 996 } | 1000 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 AssertNoAllocation no_allocation; | 1248 AssertNoAllocation no_allocation; |
| 1245 | 1249 |
| 1246 DependentFunctionFilter filter(function_info); | 1250 DependentFunctionFilter filter(function_info); |
| 1247 Deoptimizer::DeoptimizeAllFunctionsWith(&filter); | 1251 Deoptimizer::DeoptimizeAllFunctionsWith(&filter); |
| 1248 } | 1252 } |
| 1249 | 1253 |
| 1250 | 1254 |
| 1251 MaybeObject* LiveEdit::ReplaceFunctionCode( | 1255 MaybeObject* LiveEdit::ReplaceFunctionCode( |
| 1252 Handle<JSArray> new_compile_info_array, | 1256 Handle<JSArray> new_compile_info_array, |
| 1253 Handle<JSArray> shared_info_array) { | 1257 Handle<JSArray> shared_info_array) { |
| 1254 HandleScope scope; | |
| 1255 Isolate* isolate = Isolate::Current(); | 1258 Isolate* isolate = Isolate::Current(); |
| 1259 HandleScope scope(isolate); |
| 1256 | 1260 |
| 1257 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1261 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
| 1258 return isolate->ThrowIllegalOperation(); | 1262 return isolate->ThrowIllegalOperation(); |
| 1259 } | 1263 } |
| 1260 | 1264 |
| 1261 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); | 1265 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); |
| 1262 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1266 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
| 1263 | 1267 |
| 1264 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 1268 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
| 1265 | 1269 |
| 1266 HEAP->EnsureHeapIsIterable(); | 1270 isolate->heap()->EnsureHeapIsIterable(); |
| 1267 | 1271 |
| 1268 if (IsJSFunctionCode(shared_info->code())) { | 1272 if (IsJSFunctionCode(shared_info->code())) { |
| 1269 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); | 1273 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); |
| 1270 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); | 1274 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); |
| 1271 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 1275 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
| 1272 if (code_scope_info->IsFixedArray()) { | 1276 if (code_scope_info->IsFixedArray()) { |
| 1273 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); | 1277 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); |
| 1274 } | 1278 } |
| 1275 } | 1279 } |
| 1276 | 1280 |
| 1277 if (shared_info->debug_info()->IsDebugInfo()) { | 1281 if (shared_info->debug_info()->IsDebugInfo()) { |
| 1278 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); | 1282 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); |
| 1279 Handle<Code> new_original_code = | 1283 Handle<Code> new_original_code = |
| 1280 FACTORY->CopyCode(compile_info_wrapper.GetFunctionCode()); | 1284 FACTORY->CopyCode(compile_info_wrapper.GetFunctionCode()); |
| 1281 debug_info->set_original_code(*new_original_code); | 1285 debug_info->set_original_code(*new_original_code); |
| 1282 } | 1286 } |
| 1283 | 1287 |
| 1284 int start_position = compile_info_wrapper.GetStartPosition(); | 1288 int start_position = compile_info_wrapper.GetStartPosition(); |
| 1285 int end_position = compile_info_wrapper.GetEndPosition(); | 1289 int end_position = compile_info_wrapper.GetEndPosition(); |
| 1286 shared_info->set_start_position(start_position); | 1290 shared_info->set_start_position(start_position); |
| 1287 shared_info->set_end_position(end_position); | 1291 shared_info->set_end_position(end_position); |
| 1288 | 1292 |
| 1289 LiteralFixer::PatchLiterals(&compile_info_wrapper, shared_info, isolate); | 1293 LiteralFixer::PatchLiterals(&compile_info_wrapper, shared_info, isolate); |
| 1290 | 1294 |
| 1291 shared_info->set_construct_stub( | 1295 shared_info->set_construct_stub( |
| 1292 Isolate::Current()->builtins()->builtin( | 1296 isolate->builtins()->builtin(Builtins::kJSConstructStubGeneric)); |
| 1293 Builtins::kJSConstructStubGeneric)); | |
| 1294 | 1297 |
| 1295 DeoptimizeDependentFunctions(*shared_info); | 1298 DeoptimizeDependentFunctions(*shared_info); |
| 1296 Isolate::Current()->compilation_cache()->Remove(shared_info); | 1299 isolate->compilation_cache()->Remove(shared_info); |
| 1297 | 1300 |
| 1298 return HEAP->undefined_value(); | 1301 return isolate->heap()->undefined_value(); |
| 1299 } | 1302 } |
| 1300 | 1303 |
| 1301 | 1304 |
| 1302 MaybeObject* LiveEdit::FunctionSourceUpdated( | 1305 MaybeObject* LiveEdit::FunctionSourceUpdated( |
| 1303 Handle<JSArray> shared_info_array) { | 1306 Handle<JSArray> shared_info_array) { |
| 1304 HandleScope scope; | 1307 Isolate* isolate = shared_info_array->GetIsolate(); |
| 1308 HandleScope scope(isolate); |
| 1305 | 1309 |
| 1306 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1310 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
| 1307 return Isolate::Current()->ThrowIllegalOperation(); | 1311 return isolate->ThrowIllegalOperation(); |
| 1308 } | 1312 } |
| 1309 | 1313 |
| 1310 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1314 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
| 1311 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 1315 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
| 1312 | 1316 |
| 1313 DeoptimizeDependentFunctions(*shared_info); | 1317 DeoptimizeDependentFunctions(*shared_info); |
| 1314 Isolate::Current()->compilation_cache()->Remove(shared_info); | 1318 isolate->compilation_cache()->Remove(shared_info); |
| 1315 | 1319 |
| 1316 return HEAP->undefined_value(); | 1320 return isolate->heap()->undefined_value(); |
| 1317 } | 1321 } |
| 1318 | 1322 |
| 1319 | 1323 |
| 1320 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, | 1324 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, |
| 1321 Handle<Object> script_handle) { | 1325 Handle<Object> script_handle) { |
| 1322 Handle<SharedFunctionInfo> shared_info = | 1326 Handle<SharedFunctionInfo> shared_info = |
| 1323 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); | 1327 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); |
| 1324 CHECK(script_handle->IsScript() || script_handle->IsUndefined()); | 1328 CHECK(script_handle->IsScript() || script_handle->IsUndefined()); |
| 1325 shared_info->set_script(*script_handle); | 1329 shared_info->set_script(*script_handle); |
| 1326 | 1330 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 Handle<JSArray> m_result; | 1811 Handle<JSArray> m_result; |
| 1808 }; | 1812 }; |
| 1809 | 1813 |
| 1810 // Drops all call frame matched by target and all frames above them. | 1814 // Drops all call frame matched by target and all frames above them. |
| 1811 template<typename TARGET> | 1815 template<typename TARGET> |
| 1812 static const char* DropActivationsInActiveThreadImpl( | 1816 static const char* DropActivationsInActiveThreadImpl( |
| 1813 TARGET& target, bool do_drop, Zone* zone) { | 1817 TARGET& target, bool do_drop, Zone* zone) { |
| 1814 Isolate* isolate = Isolate::Current(); | 1818 Isolate* isolate = Isolate::Current(); |
| 1815 Debug* debug = isolate->debug(); | 1819 Debug* debug = isolate->debug(); |
| 1816 ZoneScope scope(zone, DELETE_ON_EXIT); | 1820 ZoneScope scope(zone, DELETE_ON_EXIT); |
| 1817 Vector<StackFrame*> frames = CreateStackMap(zone); | 1821 Vector<StackFrame*> frames = CreateStackMap(isolate, zone); |
| 1818 | 1822 |
| 1819 | 1823 |
| 1820 int top_frame_index = -1; | 1824 int top_frame_index = -1; |
| 1821 int frame_index = 0; | 1825 int frame_index = 0; |
| 1822 for (; frame_index < frames.length(); frame_index++) { | 1826 for (; frame_index < frames.length(); frame_index++) { |
| 1823 StackFrame* frame = frames[frame_index]; | 1827 StackFrame* frame = frames[frame_index]; |
| 1824 if (frame->id() == debug->break_frame_id()) { | 1828 if (frame->id() == debug->break_frame_id()) { |
| 1825 top_frame_index = frame_index; | 1829 top_frame_index = frame_index; |
| 1826 break; | 1830 break; |
| 1827 } | 1831 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2098 | 2102 |
| 2099 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2103 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 2100 return false; | 2104 return false; |
| 2101 } | 2105 } |
| 2102 | 2106 |
| 2103 #endif // ENABLE_DEBUGGER_SUPPORT | 2107 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2104 | 2108 |
| 2105 | 2109 |
| 2106 | 2110 |
| 2107 } } // namespace v8::internal | 2111 } } // namespace v8::internal |
| OLD | NEW |