Home | History | Annotate | Download | only in src

Lines Matching refs:Code

6 //     * Redistributions of source code must retain the above copyright
33 #include "code-stubs.h"
89 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) {
127 // Iterate through reloc info for code and original code stopping at each
128 // breakable code target.
155 // Check for breakable code target. Look in the original code as setting
156 // break points can cause the code targets in the running (debugged) code
157 // to be of a different kind than in the original code.
159 Code* code = Code::GetCodeFromTargetAddress(target);
160 if ((code->is_inline_cache_stub() &&
161 !code->is_binary_op_stub() &&
162 !code->is_compare_ic_stub() &&
163 !code->is_to_boolean_ic_stub()) ||
168 if (code->kind() == Code::STUB) {
174 if (Debug::IsBreakStub(code)) {
180 if (Debug::IsSourceBreakStub(code)) {
274 // Create relocation iterators for the two code objects.
278 debug_info_->code(),
298 // If there is not already a real break point here patch code with debug
334 // Patch code with debug break.
351 // Patch code removing debug break.
364 // the same code is flooded with break points twice. Flooding the same
372 // Patch the frame exit code with a break point.
375 // Patch the code in the break slot.
392 // Restore the frame exit code.
395 // Restore the code in the break slot.
411 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target));
412 if (target_code->kind() == Code::STUB) {
428 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target));
432 // called. If the executing code has a debug break at the location change
433 // the call in the original code as it is the code there that will be
435 Handle<Code> stub = ComputeCallDebugPrepareStepIn(
444 // All the following stuff is needed only for assertion checks so the code
446 Handle<Code> maybe_call_function_stub = target_code;
450 Handle<Code>(Code::GetCodeFromTargetAddress(original_target));
453 (maybe_call_function_stub->kind() == Code::STUB &&
456 // Step in through construct call requires no changes to the running code.
495 // Patch the original code with the current address as the current address
496 // might have changed by the inline caching since the code was copied.
502 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target));
504 // Patch the code to invoke the builtin debug break function matching the
506 Handle<Code> dbgbrk_code(Debug::FindDebugBreak(target_code, mode));
513 // Patch the code to the original invoke.
533 // Clear out all the debug break code. This is ONLY supposed to be used when
535 // DebugInfo even though the code is patched back to the non break point state.
610 // -- code
615 Handle<Code> code) {
624 Memory::Object_at(fp + InternalFrameConstants::kCodeOffset) = *code;
718 // Get code to handle debug break on return.
722 // Get code to handle debug break in debug break slots.
736 // original code and avoid patching the code twice later because
847 // JavaScript source code for the debugger.
854 // debugger scripts including the context creation code.
1031 // If StepNext goes deeper in code, StepOut until original frame
1066 Code* plain_return = isolate_->builtins()->builtin(
1073 Code* plain_return = isolate_->builtins()->builtin(
1081 Code* plain_return = isolate_->builtins()->builtin(
1278 it.FindBreakLocationFromAddress(debug_info->code()->entry() +
1298 // Remove all debug break code.
1444 Handle<Code> call_function_stub;
1450 Code* code = Code::GetCodeFromTargetAddress(target);
1451 if (code->is_call_stub() || code->is_keyed_call_stub()) {
1454 if (code->is_inline_cache_stub()) {
1459 // Check if target code is CallFunction stub.
1460 Code* maybe_call_function_stub = code;
1461 // If there is a breakpoint at this line look at the original code to
1466 Code::GetCodeFromTargetAddress(original_target);
1468 if (maybe_call_function_stub->kind() == Code::STUB &&
1470 // Save reference to the code as we may need it to find out arguments
1472 call_function_stub = Handle<Code>(maybe_call_function_stub);
1479 // If this is the last break code target step out is the only possibility.
1513 debug_info->code()->SourceStatementPosition(frame->pc());
1528 // from the code object.
1581 debug_info->code()->SourceStatementPosition(frame->pc());
1595 // there will be several break points in the same statement when the code is
1600 // StepNext and StepOut shouldn't bring us deeper in code, so last frame
1616 break_location_iterator->code()->SourceStatementPosition(frame->pc());
1626 // Check whether the code object at the specified address is a debug break code
1629 Code* code = Code::GetCodeFromTargetAddress(addr);
1630 return code->is_debug_stub() && code->extra_ic_state() == DEBUG_BREAK;
1634 // Check whether a code stub with the specified major key is a possible break
1636 bool Debug::IsSourceBreakStub(Code* code) {
1637 CodeStub::Major major_key = CodeStub::GetMajorKey(code);
1642 // Check whether a code stub with the specified major key is a possible break
1644 bool Debug::IsBreakStub(Code* code) {
1645 CodeStub::Major major_key = CodeStub::GetMajorKey(code);
1651 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
1656 if (code->is_inline_cache_stub()) {
1657 switch (code->kind()) {
1658 case Code::CALL_IC:
1659 case Code::KEYED_CALL_IC:
1661 code->arguments_count(), code->kind());
1663 case Code::LOAD_IC:
1666 case Code::STORE_IC:
1669 case Code::KEYED_LOAD_IC:
1672 case Code::KEYED_STORE_IC:
1675 case Code::COMPARE_NIL_IC:
1683 if (code->has_function_cache()) {
1689 if (code->kind() == Code::STUB) {
1690 ASSERT(code->major_key() == CodeStub::CallFunction);
1691 if (code->has_function_cache()) {
1699 return Handle<Code>::null();
1783 if (function->shared()->code() ==
1785 function->shared()->code() ==
1788 // function to be called and not the code for Builtins::FunctionApply or
1865 // Helper function to compile full code for debugging. This code will
1869 // the full code is compiled with the same flags as the previous version,
1870 // that is flags which can change the code generated. The current method
1871 // of mapping from already compiled full code without debug break slots
1872 // to full code with debug break slots depends on the generated code is
1875 Handle<Code> current_code) {
1883 // Use compile lazy which will end up compiling the full code in the
1890 Handle<Code> new_code(function->shared()->code());
1905 // Find all non-optimized code functions with activation frames
1908 // non-optimized code is needed for the lazy deoptimization.
1917 function->shared()->code()->set_gc_metadata(active_code_marker);
1921 ASSERT(frame->LookupCode()->kind() == Code::FUNCTION);
1923 function->shared()->code()->set_gc_metadata(active_code_marker);
1939 ASSERT(frame->LookupCode()->kind() == Code::FUNCTION);
1941 Handle<Code> frame_code(frame->LookupCode());
1944 Handle<Code> new_code(function->shared()->code());
1945 if (new_code->kind() != Code::FUNCTION ||
1950 // Iterate over the RelocInfo in the original code to compute the sum of the
1963 // Iterate over the RelocInfo for new code to find the number of bytes
1970 // Check if the pc in the new code with debug break
1988 // Compute the equivalent pc in the new code.
1993 PrintF("Replacing code %08" V8PRIxPTR " - %08" V8PRIxPTR " (%d) "
2011 // Patch the return address to return into the code with
2048 // functions as debugging does not work with optimized code.
2056 Handle<Code> lazy_compile =
2057 Handle<Code>(isolate_->builtins()->builtin(Builtins::kLazyCompile));
2063 // is used both in GC and non-GC code.
2074 // field in the Code object to mark active functions.
2100 if (shared->code()->gc_metadata() == active_code_marker) continue;
2102 Code::Kind kind = function->code()->kind();
2103 if (kind == Code::FUNCTION &&
2104 !function->code()->has_debug_break_slots()) {
2107 } else if (kind == Code::BUILTIN &&
2113 Code* shared_code = function->shared()->code();
2114 if (shared_code->kind() == Code::FUNCTION &&
2128 function->shared()->code()->set_gc_metadata(Smi::FromInt(0));
2133 // patch the return address to run in the new compiled code.
2138 if (function->code()->kind() == Code::FUNCTION &&
2139 function->code()->has_debug_break_slots()) {
2140 // Nothing to do. Function code already had debug break slots.
2147 shared->code()->kind() == Code::BUILTIN) {
2151 // Make sure that the shared full code is compiled with debug
2153 if (!shared->code()->has_debug_break_slots()) {
2154 // Try to compile the full code with debug break slots. If it
2155 // fails just keep the current code.
2156 Handle<Code> current_code(function->shared()->code());
2161 ASSERT(current_code->kind() == Code::FUNCTION);
2171 // Keep function code in sync with shared function info.
2172 function->set_code(shared->code());
2369 Handle<Code> code(debug_info->code());
2370 Handle<Code> original_code(debug_info->original_code());
2372 // Get the code which is actually executing.
2373 Handle<Code> frame_code(frame->LookupCode());
2374 ASSERT(frame_code.is_identical_to(code));
2377 // Find the call address in the running code. This address holds the call to
2378 // either a DebugBreakXXX or to the debug break return entry code if the
2386 RelocIterator it(debug_info->code());
2404 // place in the original code. If not the break point was removed during
2407 addr += original_code->instruction_start() - code->instruction_start();
2421 // so the break point is still there and the original code will hold the
2425 // Find the corresponding address in the original code.
2426 addr += original_code->instruction_start() - code->instruction_start();
2428 // Install jump to the call address in the original code. This will be the
2433 // original code as the running code will have the right address. This takes
2435 // and therefore no "original code" is available.
2461 Handle<Code> code(debug_info->code());
2463 // Get the code which is actually executing.
2464 Handle<Code> frame_code(frame->LookupCode());
2465 ASSERT(frame_code.is_identical_to(code));
2468 // Find the call address in the running code.
2472 RelocIterator it(debug_info->code());
3531 // case the exception should end up in the calling code.
3534 // cache JavaScript code.