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

Side by Side Diff: src/runtime.cc

Issue 914003: LiveEdit: patch positions in function (Closed)
Patch Set: merge Created 10 years, 9 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
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-liveedit-patch-positions.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 9045 matching lines...) Expand 10 before | Expand all | Expand 10 after
9056 SharedFunctionInfo::cast(wrapper->value())); 9056 SharedFunctionInfo::cast(wrapper->value()));
9057 LiveEdit::FunctionPatchabilityStatus check_res = 9057 LiveEdit::FunctionPatchabilityStatus check_res =
9058 FindFunctionCodeOnStacks(shared); 9058 FindFunctionCodeOnStacks(shared);
9059 SetElement(result, i, Handle<Smi>(Smi::FromInt(check_res))); 9059 SetElement(result, i, Handle<Smi>(Smi::FromInt(check_res)));
9060 } 9060 }
9061 9061
9062 return *result; 9062 return *result;
9063 } 9063 }
9064 9064
9065 9065
9066 // A testing entry. Returns statement position which is the closest to
9067 // source_position.
9068 static Object* Runtime_GetFunctionCodePositionFromSource(Arguments args) {
9069 ASSERT(args.length() == 2);
9070 HandleScope scope;
9071 CONVERT_ARG_CHECKED(JSFunction, function, 0);
9072 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
9073
9074 Handle<Code> code(function->code());
9075
9076 RelocIterator it(*code, 1 << RelocInfo::STATEMENT_POSITION);
9077 int closest_pc = 0;
9078 int distance = kMaxInt;
9079 while (!it.done()) {
9080 int statement_position = static_cast<int>(it.rinfo()->data());
9081 // Check if this break point is closer that what was previously found.
9082 if (source_position <= statement_position &&
9083 statement_position - source_position < distance) {
9084 closest_pc = it.rinfo()->pc() - code->instruction_start();
9085 distance = statement_position - source_position;
9086 // Check whether we can't get any closer.
9087 if (distance == 0) break;
9088 }
9089 it.next();
9090 }
9091
9092 return Smi::FromInt(closest_pc);
9093 }
9094
9095
9066 #endif // ENABLE_DEBUGGER_SUPPORT 9096 #endif // ENABLE_DEBUGGER_SUPPORT
9067 9097
9068 #ifdef ENABLE_LOGGING_AND_PROFILING 9098 #ifdef ENABLE_LOGGING_AND_PROFILING
9069 9099
9070 static Object* Runtime_ProfilerResume(Arguments args) { 9100 static Object* Runtime_ProfilerResume(Arguments args) {
9071 NoHandleAllocation ha; 9101 NoHandleAllocation ha;
9072 ASSERT(args.length() == 2); 9102 ASSERT(args.length() == 2);
9073 9103
9074 CONVERT_CHECKED(Smi, smi_modules, args[0]); 9104 CONVERT_CHECKED(Smi, smi_modules, args[0]);
9075 CONVERT_CHECKED(Smi, smi_tag, args[1]); 9105 CONVERT_CHECKED(Smi, smi_tag, args[1]);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
9341 } else { 9371 } else {
9342 // Handle last resort GC and make sure to allow future allocations 9372 // Handle last resort GC and make sure to allow future allocations
9343 // to grow the heap without causing GCs (if possible). 9373 // to grow the heap without causing GCs (if possible).
9344 Counters::gc_last_resort_from_js.Increment(); 9374 Counters::gc_last_resort_from_js.Increment();
9345 Heap::CollectAllGarbage(false); 9375 Heap::CollectAllGarbage(false);
9346 } 9376 }
9347 } 9377 }
9348 9378
9349 9379
9350 } } // namespace v8::internal 9380 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-liveedit-patch-positions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698