Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/liveedit.cc

Issue 23757017: remove Isolate::Current from most files starting with 'o' through 'r' (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/json-stringifier.h ('k') | src/log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<Object>(isolate()->heap()->null_value(),
861 isolate())); 864 isolate()));
862 } 865 }
863 866
864 // Saves full information about a function: its code, its scope info 867 // Saves full information about a function: its code, its scope info
865 // and a SharedFunctionInfo object. 868 // and a SharedFunctionInfo object.
866 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, 869 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope,
867 Zone* zone) { 870 Zone* zone) {
868 if (!shared->IsSharedFunctionInfo()) { 871 if (!shared->IsSharedFunctionInfo()) {
869 return; 872 return;
870 } 873 }
871 FunctionInfoWrapper info = 874 FunctionInfoWrapper info =
872 FunctionInfoWrapper::cast( 875 FunctionInfoWrapper::cast(
873 result_->GetElementNoExceptionThrown(current_parent_index_)); 876 result_->GetElementNoExceptionThrown(
877 isolate(), current_parent_index_));
874 info.SetFunctionCode(Handle<Code>(shared->code()), 878 info.SetFunctionCode(Handle<Code>(shared->code()),
875 Handle<Object>(shared->scope_info(), isolate())); 879 Handle<Object>(shared->scope_info(), isolate()));
876 info.SetSharedFunctionInfo(shared); 880 info.SetSharedFunctionInfo(shared);
877 881
878 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone), 882 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone),
879 isolate()); 883 isolate());
880 info.SetOuterScopeInfo(scope_info_list); 884 info.SetOuterScopeInfo(scope_info_list);
881 } 885 }
882 886
883 Handle<JSArray> GetResult() { return result_; } 887 Handle<JSArray> GetResult() { return result_; }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 if (rethrow_exception.is_null()) { 998 if (rethrow_exception.is_null()) {
995 return *(listener.GetResult()); 999 return *(listener.GetResult());
996 } else { 1000 } else {
997 isolate->Throw(*rethrow_exception); 1001 isolate->Throw(*rethrow_exception);
998 return 0; 1002 return 0;
999 } 1003 }
1000 } 1004 }
1001 1005
1002 1006
1003 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { 1007 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
1004 HandleScope scope(array->GetIsolate()); 1008 Isolate* isolate = array->GetIsolate();
1009 HandleScope scope(isolate);
1005 int len = GetArrayLength(array); 1010 int len = GetArrayLength(array);
1006 for (int i = 0; i < len; i++) { 1011 for (int i = 0; i < len; i++) {
1007 Handle<SharedFunctionInfo> info( 1012 Handle<SharedFunctionInfo> info(
1008 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i))); 1013 SharedFunctionInfo::cast(
1014 array->GetElementNoExceptionThrown(array->GetIsolate(), i)));
1009 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); 1015 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create();
1010 Handle<String> name_handle(String::cast(info->name())); 1016 Handle<String> name_handle(String::cast(info->name()));
1011 info_wrapper.SetProperties(name_handle, info->start_position(), 1017 info_wrapper.SetProperties(name_handle, info->start_position(),
1012 info->end_position(), info); 1018 info->end_position(), info);
1013 SetElementNonStrict(array, i, info_wrapper.GetJSArray()); 1019 SetElementNonStrict(array, i, info_wrapper.GetJSArray());
1014 } 1020 }
1015 } 1021 }
1016 1022
1017 1023
1018 // Visitor that finds all references to a particular code object, 1024 // Visitor that finds all references to a particular code object,
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 // their contents and length. It is specified as array of groups of 3 numbers: 1359 // their contents and length. It is specified as array of groups of 3 numbers:
1354 // (change_begin, change_end, change_end_new_position). 1360 // (change_begin, change_end, change_end_new_position).
1355 // Each group describes a change in text; groups are sorted by change_begin. 1361 // 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. 1362 // Only position in text beyond any changes may be successfully translated.
1357 // If a positions is inside some region that changed, result is currently 1363 // If a positions is inside some region that changed, result is currently
1358 // undefined. 1364 // undefined.
1359 static int TranslatePosition(int original_position, 1365 static int TranslatePosition(int original_position,
1360 Handle<JSArray> position_change_array) { 1366 Handle<JSArray> position_change_array) {
1361 int position_diff = 0; 1367 int position_diff = 0;
1362 int array_len = GetArrayLength(position_change_array); 1368 int array_len = GetArrayLength(position_change_array);
1369 Isolate* isolate = position_change_array->GetIsolate();
1363 // TODO(635): binary search may be used here 1370 // TODO(635): binary search may be used here
1364 for (int i = 0; i < array_len; i += 3) { 1371 for (int i = 0; i < array_len; i += 3) {
1365 Object* element = position_change_array->GetElementNoExceptionThrown(i); 1372 Object* element =
1373 position_change_array->GetElementNoExceptionThrown(isolate, i);
1366 CHECK(element->IsSmi()); 1374 CHECK(element->IsSmi());
1367 int chunk_start = Smi::cast(element)->value(); 1375 int chunk_start = Smi::cast(element)->value();
1368 if (original_position < chunk_start) { 1376 if (original_position < chunk_start) {
1369 break; 1377 break;
1370 } 1378 }
1371 element = position_change_array->GetElementNoExceptionThrown(i + 1); 1379 element = position_change_array->GetElementNoExceptionThrown(isolate,
1380 i + 1);
1372 CHECK(element->IsSmi()); 1381 CHECK(element->IsSmi());
1373 int chunk_end = Smi::cast(element)->value(); 1382 int chunk_end = Smi::cast(element)->value();
1374 // Position mustn't be inside a chunk. 1383 // Position mustn't be inside a chunk.
1375 ASSERT(original_position >= chunk_end); 1384 ASSERT(original_position >= chunk_end);
1376 element = position_change_array->GetElementNoExceptionThrown(i + 2); 1385 element = position_change_array->GetElementNoExceptionThrown(isolate,
1386 i + 2);
1377 CHECK(element->IsSmi()); 1387 CHECK(element->IsSmi());
1378 int chunk_changed_end = Smi::cast(element)->value(); 1388 int chunk_changed_end = Smi::cast(element)->value();
1379 position_diff = chunk_changed_end - chunk_end; 1389 position_diff = chunk_changed_end - chunk_end;
1380 } 1390 }
1381 1391
1382 return original_position + position_diff; 1392 return original_position + position_diff;
1383 } 1393 }
1384 1394
1385 1395
1386 // Auto-growing buffer for writing relocation info code section. This buffer 1396 // Auto-growing buffer for writing relocation info code section. This buffer
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 Handle<JSArray> result, 1633 Handle<JSArray> result,
1624 StackFrame* frame, 1634 StackFrame* frame,
1625 LiveEdit::FunctionPatchabilityStatus status) { 1635 LiveEdit::FunctionPatchabilityStatus status) {
1626 if (!frame->is_java_script()) return false; 1636 if (!frame->is_java_script()) return false;
1627 1637
1628 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function()); 1638 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function());
1629 1639
1630 Isolate* isolate = shared_info_array->GetIsolate(); 1640 Isolate* isolate = shared_info_array->GetIsolate();
1631 int len = GetArrayLength(shared_info_array); 1641 int len = GetArrayLength(shared_info_array);
1632 for (int i = 0; i < len; i++) { 1642 for (int i = 0; i < len; i++) {
1633 Object* element = shared_info_array->GetElementNoExceptionThrown(i); 1643 Object* element =
1644 shared_info_array->GetElementNoExceptionThrown(isolate, i);
1634 CHECK(element->IsJSValue()); 1645 CHECK(element->IsJSValue());
1635 Handle<JSValue> jsvalue(JSValue::cast(element)); 1646 Handle<JSValue> jsvalue(JSValue::cast(element));
1636 Handle<SharedFunctionInfo> shared = 1647 Handle<SharedFunctionInfo> shared =
1637 UnwrapSharedFunctionInfoFromJSValue(jsvalue); 1648 UnwrapSharedFunctionInfoFromJSValue(jsvalue);
1638 1649
1639 if (function->shared() == *shared || IsInlined(*function, *shared)) { 1650 if (function->shared() == *shared || IsInlined(*function, *shared)) {
1640 SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status), 1651 SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status),
1641 isolate)); 1652 isolate));
1642 return true; 1653 return true;
1643 } 1654 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 DropActivationsInActiveThreadImpl(target, do_drop); 1953 DropActivationsInActiveThreadImpl(target, do_drop);
1943 if (message) { 1954 if (message) {
1944 return message; 1955 return message;
1945 } 1956 }
1946 1957
1947 Isolate* isolate = shared_info_array->GetIsolate(); 1958 Isolate* isolate = shared_info_array->GetIsolate();
1948 int array_len = GetArrayLength(shared_info_array); 1959 int array_len = GetArrayLength(shared_info_array);
1949 1960
1950 // Replace "blocked on active" with "replaced on active" status. 1961 // Replace "blocked on active" with "replaced on active" status.
1951 for (int i = 0; i < array_len; i++) { 1962 for (int i = 0; i < array_len; i++) {
1952 if (result->GetElement(i) == 1963 if (result->GetElement(result->GetIsolate(), i) ==
1953 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { 1964 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
1954 Handle<Object> replaced( 1965 Handle<Object> replaced(
1955 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); 1966 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate);
1956 SetElementNonStrict(result, i, replaced); 1967 SetElementNonStrict(result, i, replaced);
1957 } 1968 }
1958 } 1969 }
1959 return NULL; 1970 return NULL;
1960 } 1971 }
1961 1972
1962 1973
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 2139
2129 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2140 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2130 return false; 2141 return false;
2131 } 2142 }
2132 2143
2133 #endif // ENABLE_DEBUGGER_SUPPORT 2144 #endif // ENABLE_DEBUGGER_SUPPORT
2134 2145
2135 2146
2136 2147
2137 } } // namespace v8::internal 2148 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698