Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index bdf9a6c0f301a91f8abde905d738e49d2dba7ac7..312815f5eab4c6b8c4c759f39bd404610fd9e49f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -14282,6 +14282,15 @@ void Code::ClearInlineCaches(Code::Kind* kind) { |
} |
+int AbstractCode::SourcePosition(int offset) { |
+ if (IsBytecodeArray()) return GetBytecodeArray()->SourcePosition(offset); |
+ DCHECK(IsCode()); |
+ Code* code = GetCode(); |
+ Address pc = code->instruction_start() + offset; |
+ return code->SourcePosition(pc); |
rmcilroy
2016/01/22 19:16:34
Nit, could you make SourcePosition take the offset
Yang
2016/01/28 09:09:53
Done.
|
+} |
+ |
+ |
void SharedFunctionInfo::ClearTypeFeedbackInfo() { |
feedback_vector()->ClearSlots(this); |
} |
@@ -14974,6 +14983,12 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT |
#endif // ENABLE_DISASSEMBLER |
+int BytecodeArray::SourcePosition(int offset) { |
+ // TODO(yangguo): implement this. |
+ return 0; |
+} |
+ |
+ |
void BytecodeArray::Disassemble(std::ostream& os) { |
os << "Parameter count " << parameter_count() << "\n"; |
os << "Frame size " << frame_size() << "\n"; |
@@ -19026,22 +19041,22 @@ bool JSWeakCollection::Delete(Handle<JSWeakCollection> weak_collection, |
} |
-// Check if there is a break point at this code position. |
-bool DebugInfo::HasBreakPoint(int code_position) { |
- // Get the break point info object for this code position. |
- Object* break_point_info = GetBreakPointInfo(code_position); |
+// Check if there is a break point at this code offset. |
+bool DebugInfo::HasBreakPoint(int code_offset) { |
+ // Get the break point info object for this code offset. |
+ Object* break_point_info = GetBreakPointInfo(code_offset); |
// If there is no break point info object or no break points in the break |
- // point info object there is no break point at this code position. |
+ // point info object there is no break point at this code offset. |
if (break_point_info->IsUndefined()) return false; |
return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0; |
} |
-// Get the break point info object for this code position. |
-Object* DebugInfo::GetBreakPointInfo(int code_position) { |
- // Find the index of the break point info object for this code position. |
- int index = GetBreakPointInfoIndex(code_position); |
+// Get the break point info object for this code offset. |
+Object* DebugInfo::GetBreakPointInfo(int code_offset) { |
+ // Find the index of the break point info object for this code offset. |
+ int index = GetBreakPointInfoIndex(code_offset); |
// Return the break point info object if any. |
if (index == kNoBreakPointInfo) return GetHeap()->undefined_value(); |
@@ -19049,11 +19064,10 @@ Object* DebugInfo::GetBreakPointInfo(int code_position) { |
} |
-// Clear a break point at the specified code position. |
-void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info, |
- int code_position, |
+// Clear a break point at the specified code offset. |
+void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info, int code_offset, |
Handle<Object> break_point_object) { |
- Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), |
+ Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_offset), |
debug_info->GetIsolate()); |
if (break_point_info->IsUndefined()) return; |
BreakPointInfo::ClearBreakPoint( |
@@ -19062,13 +19076,11 @@ void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info, |
} |
-void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, |
- int code_position, |
- int source_position, |
- int statement_position, |
+void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, int code_offset, |
+ int source_position, int statement_position, |
Handle<Object> break_point_object) { |
Isolate* isolate = debug_info->GetIsolate(); |
- Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), |
+ Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_offset), |
isolate); |
if (!break_point_info->IsUndefined()) { |
BreakPointInfo::SetBreakPoint( |
@@ -19077,7 +19089,7 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, |
return; |
} |
- // Adding a new break point for a code position which did not have any |
+ // Adding a new break point for a code offset which did not have any |
// break points before. Try to find a free slot. |
int index = kNoBreakPointInfo; |
for (int i = 0; i < debug_info->break_points()->length(); i++) { |
@@ -19106,7 +19118,7 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, |
// Allocate new BreakPointInfo object and set the break point. |
Handle<BreakPointInfo> new_break_point_info = Handle<BreakPointInfo>::cast( |
isolate->factory()->NewStruct(BREAK_POINT_INFO_TYPE)); |
- new_break_point_info->set_code_position(code_position); |
+ new_break_point_info->set_code_offset(code_offset); |
new_break_point_info->set_source_position(source_position); |
new_break_point_info->set_statement_position(statement_position); |
new_break_point_info->set_break_point_objects( |
@@ -19116,9 +19128,9 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, |
} |
-// Get the break point objects for a code position. |
-Handle<Object> DebugInfo::GetBreakPointObjects(int code_position) { |
- Object* break_point_info = GetBreakPointInfo(code_position); |
+// Get the break point objects for a code offset. |
+Handle<Object> DebugInfo::GetBreakPointObjects(int code_offset) { |
+ Object* break_point_info = GetBreakPointInfo(code_offset); |
if (break_point_info->IsUndefined()) { |
return GetIsolate()->factory()->undefined_value(); |
} |
@@ -19164,13 +19176,13 @@ Handle<Object> DebugInfo::FindBreakPointInfo( |
// Find the index of the break point info object for the specified code |
// position. |
-int DebugInfo::GetBreakPointInfoIndex(int code_position) { |
+int DebugInfo::GetBreakPointInfoIndex(int code_offset) { |
if (break_points()->IsUndefined()) return kNoBreakPointInfo; |
for (int i = 0; i < break_points()->length(); i++) { |
if (!break_points()->get(i)->IsUndefined()) { |
BreakPointInfo* break_point_info = |
BreakPointInfo::cast(break_points()->get(i)); |
- if (break_point_info->code_position() == code_position) { |
+ if (break_point_info->code_offset() == code_offset) { |
return i; |
} |
} |