| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 | 1183 |
| 1184 // Removes specified range of frames from stack. There may be 1 or more | 1184 // Removes specified range of frames from stack. There may be 1 or more |
| 1185 // frames in range. Anyway the bottom frame is restarted rather than dropped, | 1185 // frames in range. Anyway the bottom frame is restarted rather than dropped, |
| 1186 // and therefore has to be a JavaScript frame. | 1186 // and therefore has to be a JavaScript frame. |
| 1187 // Returns error message or NULL. | 1187 // Returns error message or NULL. |
| 1188 static const char* DropFrames(Vector<StackFrame*> frames, | 1188 static const char* DropFrames(Vector<StackFrame*> frames, |
| 1189 int top_frame_index, | 1189 int top_frame_index, |
| 1190 int bottom_js_frame_index, | 1190 int bottom_js_frame_index, |
| 1191 Debug::FrameDropMode* mode, | 1191 Debug::FrameDropMode* mode) { |
| 1192 Object*** restarter_frame_function_pointer) { | |
| 1193 if (Debug::kFrameDropperFrameSize < 0) { | 1192 if (Debug::kFrameDropperFrameSize < 0) { |
| 1194 return "Stack manipulations are not supported in this architecture."; | 1193 return "Stack manipulations are not supported in this architecture."; |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 StackFrame* pre_top_frame = frames[top_frame_index - 1]; | 1196 StackFrame* pre_top_frame = frames[top_frame_index - 1]; |
| 1198 StackFrame* top_frame = frames[top_frame_index]; | 1197 StackFrame* top_frame = frames[top_frame_index]; |
| 1199 StackFrame* bottom_js_frame = frames[bottom_js_frame_index]; | 1198 StackFrame* bottom_js_frame = frames[bottom_js_frame_index]; |
| 1200 | 1199 |
| 1201 ASSERT(bottom_js_frame->is_java_script()); | 1200 ASSERT(bottom_js_frame->is_java_script()); |
| 1202 | 1201 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1232 // Committing now. After this point we should return only NULL value. | 1231 // Committing now. After this point we should return only NULL value. |
| 1233 | 1232 |
| 1234 FixTryCatchHandler(pre_top_frame, bottom_js_frame); | 1233 FixTryCatchHandler(pre_top_frame, bottom_js_frame); |
| 1235 // Make sure FixTryCatchHandler is idempotent. | 1234 // Make sure FixTryCatchHandler is idempotent. |
| 1236 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); | 1235 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); |
| 1237 | 1236 |
| 1238 Handle<Code> code(Builtins::builtin(Builtins::FrameDropper_LiveEdit)); | 1237 Handle<Code> code(Builtins::builtin(Builtins::FrameDropper_LiveEdit)); |
| 1239 top_frame->set_pc(code->entry()); | 1238 top_frame->set_pc(code->entry()); |
| 1240 pre_top_frame->SetCallerFp(bottom_js_frame->fp()); | 1239 pre_top_frame->SetCallerFp(bottom_js_frame->fp()); |
| 1241 | 1240 |
| 1242 *restarter_frame_function_pointer = | 1241 Debug::SetUpFrameDropperFrame(bottom_js_frame, code); |
| 1243 Debug::SetUpFrameDropperFrame(bottom_js_frame, code); | |
| 1244 | |
| 1245 ASSERT((**restarter_frame_function_pointer)->IsJSFunction()); | |
| 1246 | 1242 |
| 1247 for (Address a = unused_stack_top; | 1243 for (Address a = unused_stack_top; |
| 1248 a < unused_stack_bottom; | 1244 a < unused_stack_bottom; |
| 1249 a += kPointerSize) { | 1245 a += kPointerSize) { |
| 1250 Memory::Object_at(a) = Smi::FromInt(0); | 1246 Memory::Object_at(a) = Smi::FromInt(0); |
| 1251 } | 1247 } |
| 1252 | 1248 |
| 1253 return NULL; | 1249 return NULL; |
| 1254 } | 1250 } |
| 1255 | 1251 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 // We are in check-only mode. | 1321 // We are in check-only mode. |
| 1326 return NULL; | 1322 return NULL; |
| 1327 } | 1323 } |
| 1328 | 1324 |
| 1329 if (!target_frame_found) { | 1325 if (!target_frame_found) { |
| 1330 // Nothing to drop. | 1326 // Nothing to drop. |
| 1331 return NULL; | 1327 return NULL; |
| 1332 } | 1328 } |
| 1333 | 1329 |
| 1334 Debug::FrameDropMode drop_mode = Debug::FRAMES_UNTOUCHED; | 1330 Debug::FrameDropMode drop_mode = Debug::FRAMES_UNTOUCHED; |
| 1335 Object** restarter_frame_function_pointer = NULL; | |
| 1336 const char* error_message = DropFrames(frames, top_frame_index, | 1331 const char* error_message = DropFrames(frames, top_frame_index, |
| 1337 bottom_js_frame_index, &drop_mode, | 1332 bottom_js_frame_index, &drop_mode); |
| 1338 &restarter_frame_function_pointer); | |
| 1339 | 1333 |
| 1340 if (error_message != NULL) { | 1334 if (error_message != NULL) { |
| 1341 return error_message; | 1335 return error_message; |
| 1342 } | 1336 } |
| 1343 | 1337 |
| 1344 // Adjust break_frame after some frames has been dropped. | 1338 // Adjust break_frame after some frames has been dropped. |
| 1345 StackFrame::Id new_id = StackFrame::NO_ID; | 1339 StackFrame::Id new_id = StackFrame::NO_ID; |
| 1346 for (int i = bottom_js_frame_index + 1; i < frames.length(); i++) { | 1340 for (int i = bottom_js_frame_index + 1; i < frames.length(); i++) { |
| 1347 if (frames[i]->type() == StackFrame::JAVA_SCRIPT) { | 1341 if (frames[i]->type() == StackFrame::JAVA_SCRIPT) { |
| 1348 new_id = frames[i]->id(); | 1342 new_id = frames[i]->id(); |
| 1349 break; | 1343 break; |
| 1350 } | 1344 } |
| 1351 } | 1345 } |
| 1352 Debug::FramesHaveBeenDropped(new_id, drop_mode, | 1346 Debug::FramesHaveBeenDropped(new_id, drop_mode); |
| 1353 restarter_frame_function_pointer); | |
| 1354 | 1347 |
| 1355 // Replace "blocked on active" with "replaced on active" status. | 1348 // Replace "blocked on active" with "replaced on active" status. |
| 1356 for (int i = 0; i < array_len; i++) { | 1349 for (int i = 0; i < array_len; i++) { |
| 1357 if (result->GetElement(i) == | 1350 if (result->GetElement(i) == |
| 1358 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { | 1351 Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { |
| 1359 result->SetElement(i, Smi::FromInt( | 1352 result->SetElement(i, Smi::FromInt( |
| 1360 LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK)); | 1353 LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK)); |
| 1361 } | 1354 } |
| 1362 } | 1355 } |
| 1363 return NULL; | 1356 return NULL; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 | 1471 |
| 1479 bool LiveEditFunctionTracker::IsActive() { | 1472 bool LiveEditFunctionTracker::IsActive() { |
| 1480 return false; | 1473 return false; |
| 1481 } | 1474 } |
| 1482 | 1475 |
| 1483 #endif // ENABLE_DEBUGGER_SUPPORT | 1476 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1484 | 1477 |
| 1485 | 1478 |
| 1486 | 1479 |
| 1487 } } // namespace v8::internal | 1480 } } // namespace v8::internal |
| OLD | NEW |