| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/frames.h" | 5 #include "src/frames.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 void StackFrame::SetReturnAddressLocationResolver( | 398 void StackFrame::SetReturnAddressLocationResolver( |
| 399 ReturnAddressLocationResolver resolver) { | 399 ReturnAddressLocationResolver resolver) { |
| 400 DCHECK(return_address_location_resolver_ == NULL); | 400 DCHECK(return_address_location_resolver_ == NULL); |
| 401 return_address_location_resolver_ = resolver; | 401 return_address_location_resolver_ = resolver; |
| 402 } | 402 } |
| 403 | 403 |
| 404 static bool IsInterpreterFramePc(Isolate* isolate, Address pc) { | 404 static bool IsInterpreterFramePc(Isolate* isolate, Address pc) { |
| 405 Code* interpreter_entry_trampoline = | 405 Code* interpreter_entry_trampoline = |
| 406 isolate->builtins()->builtin(Builtins::kInterpreterEntryTrampoline); | 406 isolate->builtins()->builtin(Builtins::kInterpreterEntryTrampoline); |
| 407 Code* interpreter_bytecode_advance = |
| 408 isolate->builtins()->builtin(Builtins::kInterpreterEnterBytecodeAdvance); |
| 407 Code* interpreter_bytecode_dispatch = | 409 Code* interpreter_bytecode_dispatch = |
| 408 isolate->builtins()->builtin(Builtins::kInterpreterEnterBytecodeDispatch); | 410 isolate->builtins()->builtin(Builtins::kInterpreterEnterBytecodeDispatch); |
| 409 | 411 |
| 410 return (pc >= interpreter_entry_trampoline->instruction_start() && | 412 return (pc >= interpreter_entry_trampoline->instruction_start() && |
| 411 pc < interpreter_entry_trampoline->instruction_end()) || | 413 pc < interpreter_entry_trampoline->instruction_end()) || |
| 414 (pc >= interpreter_bytecode_advance->instruction_start() && |
| 415 pc < interpreter_bytecode_advance->instruction_end()) || |
| 412 (pc >= interpreter_bytecode_dispatch->instruction_start() && | 416 (pc >= interpreter_bytecode_dispatch->instruction_start() && |
| 413 pc < interpreter_bytecode_dispatch->instruction_end()); | 417 pc < interpreter_bytecode_dispatch->instruction_end()); |
| 414 } | 418 } |
| 415 | 419 |
| 416 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, | 420 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, |
| 417 State* state) { | 421 State* state) { |
| 418 DCHECK(state->fp != NULL); | 422 DCHECK(state->fp != NULL); |
| 419 | 423 |
| 420 MSAN_MEMORY_IS_INITIALIZED( | 424 MSAN_MEMORY_IS_INITIALIZED( |
| 421 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset, | 425 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset, |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 if (frame_opcode == Translation::JS_FRAME) { | 1216 if (frame_opcode == Translation::JS_FRAME) { |
| 1213 Code* code = shared_info->code(); | 1217 Code* code = shared_info->code(); |
| 1214 DeoptimizationOutputData* const output_data = | 1218 DeoptimizationOutputData* const output_data = |
| 1215 DeoptimizationOutputData::cast(code->deoptimization_data()); | 1219 DeoptimizationOutputData::cast(code->deoptimization_data()); |
| 1216 unsigned const entry = | 1220 unsigned const entry = |
| 1217 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); | 1221 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); |
| 1218 code_offset = FullCodeGenerator::PcField::decode(entry); | 1222 code_offset = FullCodeGenerator::PcField::decode(entry); |
| 1219 abstract_code = AbstractCode::cast(code); | 1223 abstract_code = AbstractCode::cast(code); |
| 1220 } else { | 1224 } else { |
| 1221 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); | 1225 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); |
| 1222 // BailoutId points to the next bytecode in the bytecode aray. Subtract | 1226 code_offset = bailout_id.ToInt(); // Points to current bytecode. |
| 1223 // 1 to get the end of current bytecode. | |
| 1224 code_offset = bailout_id.ToInt() - 1; | |
| 1225 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); | 1227 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); |
| 1226 } | 1228 } |
| 1227 FrameSummary summary(receiver, function, abstract_code, code_offset, | 1229 FrameSummary summary(receiver, function, abstract_code, code_offset, |
| 1228 is_constructor); | 1230 is_constructor); |
| 1229 frames->Add(summary); | 1231 frames->Add(summary); |
| 1230 is_constructor = false; | 1232 is_constructor = false; |
| 1231 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { | 1233 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { |
| 1232 // The next encountered JS_FRAME will be marked as a constructor call. | 1234 // The next encountered JS_FRAME will be marked as a constructor call. |
| 1233 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); | 1235 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); |
| 1234 DCHECK(!is_constructor); | 1236 DCHECK(!is_constructor); |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1974 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1973 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1975 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1974 list.Add(frame, zone); | 1976 list.Add(frame, zone); |
| 1975 } | 1977 } |
| 1976 return list.ToVector(); | 1978 return list.ToVector(); |
| 1977 } | 1979 } |
| 1978 | 1980 |
| 1979 | 1981 |
| 1980 } // namespace internal | 1982 } // namespace internal |
| 1981 } // namespace v8 | 1983 } // namespace v8 |
| OLD | NEW |