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

Side by Side Diff: src/liveedit.cc

Issue 235083002: Reland "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 8 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/liveedit.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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 current_parent_index_); 717 current_parent_index_);
718 current_parent_index_ = len_; 718 current_parent_index_ = len_;
719 SetElementSloppy(result_, len_, info.GetJSArray()); 719 SetElementSloppy(result_, len_, info.GetJSArray());
720 len_++; 720 len_++;
721 } 721 }
722 722
723 void FunctionDone() { 723 void FunctionDone() {
724 HandleScope scope(isolate()); 724 HandleScope scope(isolate());
725 FunctionInfoWrapper info = 725 FunctionInfoWrapper info =
726 FunctionInfoWrapper::cast( 726 FunctionInfoWrapper::cast(
727 *Object::GetElementNoExceptionThrown( 727 *Object::GetElement(
728 isolate(), result_, current_parent_index_)); 728 isolate(), result_, current_parent_index_).ToHandleChecked());
729 current_parent_index_ = info.GetParentIndex(); 729 current_parent_index_ = info.GetParentIndex();
730 } 730 }
731 731
732 // Saves only function code, because for a script function we 732 // Saves only function code, because for a script function we
733 // may never create a SharedFunctionInfo object. 733 // may never create a SharedFunctionInfo object.
734 void FunctionCode(Handle<Code> function_code) { 734 void FunctionCode(Handle<Code> function_code) {
735 FunctionInfoWrapper info = 735 FunctionInfoWrapper info =
736 FunctionInfoWrapper::cast( 736 FunctionInfoWrapper::cast(
737 *Object::GetElementNoExceptionThrown( 737 *Object::GetElement(
738 isolate(), result_, current_parent_index_)); 738 isolate(), result_, current_parent_index_).ToHandleChecked());
739 info.SetFunctionCode(function_code, 739 info.SetFunctionCode(function_code,
740 Handle<HeapObject>(isolate()->heap()->null_value())); 740 Handle<HeapObject>(isolate()->heap()->null_value()));
741 } 741 }
742 742
743 // Saves full information about a function: its code, its scope info 743 // Saves full information about a function: its code, its scope info
744 // and a SharedFunctionInfo object. 744 // and a SharedFunctionInfo object.
745 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, 745 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope,
746 Zone* zone) { 746 Zone* zone) {
747 if (!shared->IsSharedFunctionInfo()) { 747 if (!shared->IsSharedFunctionInfo()) {
748 return; 748 return;
749 } 749 }
750 FunctionInfoWrapper info = 750 FunctionInfoWrapper info =
751 FunctionInfoWrapper::cast( 751 FunctionInfoWrapper::cast(
752 *Object::GetElementNoExceptionThrown( 752 *Object::GetElement(
753 isolate(), result_, current_parent_index_)); 753 isolate(), result_, current_parent_index_).ToHandleChecked());
754 info.SetFunctionCode(Handle<Code>(shared->code()), 754 info.SetFunctionCode(Handle<Code>(shared->code()),
755 Handle<HeapObject>(shared->scope_info())); 755 Handle<HeapObject>(shared->scope_info()));
756 info.SetSharedFunctionInfo(shared); 756 info.SetSharedFunctionInfo(shared);
757 757
758 Handle<Object> scope_info_list = SerializeFunctionScope(scope, zone); 758 Handle<Object> scope_info_list = SerializeFunctionScope(scope, zone);
759 info.SetFunctionScopeInfo(scope_info_list); 759 info.SetFunctionScopeInfo(scope_info_list);
760 } 760 }
761 761
762 Handle<JSArray> GetResult() { return result_; } 762 Handle<JSArray> GetResult() { return result_; }
763 763
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 874 }
875 875
876 876
877 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { 877 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
878 Isolate* isolate = array->GetIsolate(); 878 Isolate* isolate = array->GetIsolate();
879 HandleScope scope(isolate); 879 HandleScope scope(isolate);
880 int len = GetArrayLength(array); 880 int len = GetArrayLength(array);
881 for (int i = 0; i < len; i++) { 881 for (int i = 0; i < len; i++) {
882 Handle<SharedFunctionInfo> info( 882 Handle<SharedFunctionInfo> info(
883 SharedFunctionInfo::cast( 883 SharedFunctionInfo::cast(
884 *Object::GetElementNoExceptionThrown(isolate, array, i))); 884 *Object::GetElement(isolate, array, i).ToHandleChecked()));
885 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate); 885 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate);
886 Handle<String> name_handle(String::cast(info->name())); 886 Handle<String> name_handle(String::cast(info->name()));
887 info_wrapper.SetProperties(name_handle, info->start_position(), 887 info_wrapper.SetProperties(name_handle, info->start_position(),
888 info->end_position(), info); 888 info->end_position(), info);
889 SetElementSloppy(array, i, info_wrapper.GetJSArray()); 889 SetElementSloppy(array, i, info_wrapper.GetJSArray());
890 } 890 }
891 } 891 }
892 892
893 893
894 // Visitor that finds all references to a particular code object, 894 // Visitor that finds all references to a particular code object,
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 // If a positions is inside some region that changed, result is currently 1232 // If a positions is inside some region that changed, result is currently
1233 // undefined. 1233 // undefined.
1234 static int TranslatePosition(int original_position, 1234 static int TranslatePosition(int original_position,
1235 Handle<JSArray> position_change_array) { 1235 Handle<JSArray> position_change_array) {
1236 int position_diff = 0; 1236 int position_diff = 0;
1237 int array_len = GetArrayLength(position_change_array); 1237 int array_len = GetArrayLength(position_change_array);
1238 Isolate* isolate = position_change_array->GetIsolate(); 1238 Isolate* isolate = position_change_array->GetIsolate();
1239 // TODO(635): binary search may be used here 1239 // TODO(635): binary search may be used here
1240 for (int i = 0; i < array_len; i += 3) { 1240 for (int i = 0; i < array_len; i += 3) {
1241 HandleScope scope(isolate); 1241 HandleScope scope(isolate);
1242 Handle<Object> element = Object::GetElementNoExceptionThrown( 1242 Handle<Object> element = Object::GetElement(
1243 isolate, position_change_array, i); 1243 isolate, position_change_array, i).ToHandleChecked();
1244 CHECK(element->IsSmi()); 1244 CHECK(element->IsSmi());
1245 int chunk_start = Handle<Smi>::cast(element)->value(); 1245 int chunk_start = Handle<Smi>::cast(element)->value();
1246 if (original_position < chunk_start) { 1246 if (original_position < chunk_start) {
1247 break; 1247 break;
1248 } 1248 }
1249 element = Object::GetElementNoExceptionThrown( 1249 element = Object::GetElement(
1250 isolate, position_change_array, i + 1); 1250 isolate, position_change_array, i + 1).ToHandleChecked();
1251 CHECK(element->IsSmi()); 1251 CHECK(element->IsSmi());
1252 int chunk_end = Handle<Smi>::cast(element)->value(); 1252 int chunk_end = Handle<Smi>::cast(element)->value();
1253 // Position mustn't be inside a chunk. 1253 // Position mustn't be inside a chunk.
1254 ASSERT(original_position >= chunk_end); 1254 ASSERT(original_position >= chunk_end);
1255 element = Object::GetElementNoExceptionThrown( 1255 element = Object::GetElement(
1256 isolate, position_change_array, i + 2); 1256 isolate, position_change_array, i + 2).ToHandleChecked();
1257 CHECK(element->IsSmi()); 1257 CHECK(element->IsSmi());
1258 int chunk_changed_end = Handle<Smi>::cast(element)->value(); 1258 int chunk_changed_end = Handle<Smi>::cast(element)->value();
1259 position_diff = chunk_changed_end - chunk_end; 1259 position_diff = chunk_changed_end - chunk_end;
1260 } 1260 }
1261 1261
1262 return original_position + position_diff; 1262 return original_position + position_diff;
1263 } 1263 }
1264 1264
1265 1265
1266 // Auto-growing buffer for writing relocation info code section. This buffer 1266 // Auto-growing buffer for writing relocation info code section. This buffer
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 LiveEdit::FunctionPatchabilityStatus status) { 1497 LiveEdit::FunctionPatchabilityStatus status) {
1498 if (!frame->is_java_script()) return false; 1498 if (!frame->is_java_script()) return false;
1499 1499
1500 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function()); 1500 Handle<JSFunction> function(JavaScriptFrame::cast(frame)->function());
1501 1501
1502 Isolate* isolate = shared_info_array->GetIsolate(); 1502 Isolate* isolate = shared_info_array->GetIsolate();
1503 int len = GetArrayLength(shared_info_array); 1503 int len = GetArrayLength(shared_info_array);
1504 for (int i = 0; i < len; i++) { 1504 for (int i = 0; i < len; i++) {
1505 HandleScope scope(isolate); 1505 HandleScope scope(isolate);
1506 Handle<Object> element = 1506 Handle<Object> element =
1507 Object::GetElementNoExceptionThrown(isolate, shared_info_array, i); 1507 Object::GetElement(isolate, shared_info_array, i).ToHandleChecked();
1508 Handle<JSValue> jsvalue = Handle<JSValue>::cast(element); 1508 Handle<JSValue> jsvalue = Handle<JSValue>::cast(element);
1509 Handle<SharedFunctionInfo> shared = 1509 Handle<SharedFunctionInfo> shared =
1510 UnwrapSharedFunctionInfoFromJSValue(jsvalue); 1510 UnwrapSharedFunctionInfoFromJSValue(jsvalue);
1511 1511
1512 if (function->shared() == *shared || IsInlined(*function, *shared)) { 1512 if (function->shared() == *shared || IsInlined(*function, *shared)) {
1513 SetElementSloppy(result, i, Handle<Smi>(Smi::FromInt(status), isolate)); 1513 SetElementSloppy(result, i, Handle<Smi>(Smi::FromInt(status), isolate));
1514 return true; 1514 return true;
1515 } 1515 }
1516 } 1516 }
1517 return false; 1517 return false;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 if (message) { 1814 if (message) {
1815 return message; 1815 return message;
1816 } 1816 }
1817 1817
1818 Isolate* isolate = shared_info_array->GetIsolate(); 1818 Isolate* isolate = shared_info_array->GetIsolate();
1819 int array_len = GetArrayLength(shared_info_array); 1819 int array_len = GetArrayLength(shared_info_array);
1820 1820
1821 // Replace "blocked on active" with "replaced on active" status. 1821 // Replace "blocked on active" with "replaced on active" status.
1822 for (int i = 0; i < array_len; i++) { 1822 for (int i = 0; i < array_len; i++) {
1823 Handle<Object> obj = 1823 Handle<Object> obj =
1824 Object::GetElementNoExceptionThrown(isolate, result, i); 1824 Object::GetElement(isolate, result, i).ToHandleChecked();
1825 if (*obj == Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { 1825 if (*obj == Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
1826 Handle<Object> replaced( 1826 Handle<Object> replaced(
1827 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); 1827 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate);
1828 SetElementSloppy(result, i, replaced); 1828 SetElementSloppy(result, i, replaced);
1829 } 1829 }
1830 } 1830 }
1831 return NULL; 1831 return NULL;
1832 } 1832 }
1833 1833
1834 1834
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 2001
2002 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2002 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2003 return false; 2003 return false;
2004 } 2004 }
2005 2005
2006 #endif // ENABLE_DEBUGGER_SUPPORT 2006 #endif // ENABLE_DEBUGGER_SUPPORT
2007 2007
2008 2008
2009 2009
2010 } } // namespace v8::internal 2010 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698