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

Side by Side Diff: src/frames.cc

Issue 2619353006: Refactor FrameSummary for JS and Wasm frames (Closed)
Patch Set: Address comment Created 3 years, 11 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/frames.h ('k') | src/frames-inl.h » ('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 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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 DCHECK(functions->length() == 0); 964 DCHECK(functions->length() == 0);
965 functions->Add(function()); 965 functions->Add(function());
966 } 966 }
967 967
968 void JavaScriptFrame::Summarize(List<FrameSummary>* functions, 968 void JavaScriptFrame::Summarize(List<FrameSummary>* functions,
969 FrameSummary::Mode mode) const { 969 FrameSummary::Mode mode) const {
970 DCHECK(functions->length() == 0); 970 DCHECK(functions->length() == 0);
971 Code* code = LookupCode(); 971 Code* code = LookupCode();
972 int offset = static_cast<int>(pc() - code->instruction_start()); 972 int offset = static_cast<int>(pc() - code->instruction_start());
973 AbstractCode* abstract_code = AbstractCode::cast(code); 973 AbstractCode* abstract_code = AbstractCode::cast(code);
974 FrameSummary summary(receiver(), function(), abstract_code, offset, 974 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver(),
975 IsConstructor(), mode); 975 function(), abstract_code,
976 offset, IsConstructor(), mode);
976 functions->Add(summary); 977 functions->Add(summary);
977 } 978 }
978 979
979 JSFunction* JavaScriptFrame::function() const { 980 JSFunction* JavaScriptFrame::function() const {
980 return JSFunction::cast(function_slot_object()); 981 return JSFunction::cast(function_slot_object());
981 } 982 }
982 983
983 Object* JavaScriptFrame::receiver() const { return GetParameter(-1); } 984 Object* JavaScriptFrame::receiver() const { return GetParameter(-1); }
984 985
985 Object* JavaScriptFrame::context() const { 986 Object* JavaScriptFrame::context() const {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1123 }
1123 1124
1124 namespace { 1125 namespace {
1125 1126
1126 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) { 1127 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) {
1127 return code->is_turbofanned() && function->shared()->asm_function(); 1128 return code->is_turbofanned() && function->shared()->asm_function();
1128 } 1129 }
1129 1130
1130 } // namespace 1131 } // namespace
1131 1132
1132 FrameSummary::FrameSummary(Object* receiver, JSFunction* function, 1133 FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
1133 AbstractCode* abstract_code, int code_offset, 1134 Isolate* isolate, Object* receiver, JSFunction* function,
1134 bool is_constructor, Mode mode) 1135 AbstractCode* abstract_code, int code_offset, bool is_constructor,
1135 : receiver_(receiver, function->GetIsolate()), 1136 Mode mode)
1136 function_(function), 1137 : FrameSummaryBase(isolate, JAVA_SCRIPT),
1137 abstract_code_(abstract_code), 1138 receiver_(receiver, isolate),
1139 function_(function, isolate),
1140 abstract_code_(abstract_code, isolate),
1138 code_offset_(code_offset), 1141 code_offset_(code_offset),
1139 is_constructor_(is_constructor) { 1142 is_constructor_(is_constructor) {
1140 DCHECK(abstract_code->IsBytecodeArray() || 1143 DCHECK(abstract_code->IsBytecodeArray() ||
1141 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || 1144 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION ||
1142 CannotDeoptFromAsmCode(Code::cast(abstract_code), function) || 1145 CannotDeoptFromAsmCode(Code::cast(abstract_code), function) ||
1143 mode == kApproximateSummary); 1146 mode == kApproximateSummary);
1144 } 1147 }
1145 1148
1146 FrameSummary FrameSummary::GetFirst(StandardFrame* frame) { 1149 bool FrameSummary::JavaScriptFrameSummary::is_subject_to_debugging() const {
1150 return function()->shared()->IsSubjectToDebugging();
1151 }
1152
1153 int FrameSummary::JavaScriptFrameSummary::SourcePosition() const {
1154 return abstract_code()->SourcePosition(code_offset());
1155 }
1156
1157 int FrameSummary::JavaScriptFrameSummary::SourceStatementPosition() const {
1158 return abstract_code()->SourceStatementPosition(code_offset());
1159 }
1160
1161 Handle<Object> FrameSummary::JavaScriptFrameSummary::script() const {
1162 return handle(function_->shared()->script(), isolate());
1163 }
1164
1165 Handle<String> FrameSummary::JavaScriptFrameSummary::FunctionName() const {
1166 return JSFunction::GetDebugName(function_);
1167 }
1168
1169 Handle<Context> FrameSummary::JavaScriptFrameSummary::native_context() const {
1170 return handle(function_->context()->native_context(), isolate());
1171 }
1172
1173 FrameSummary::WasmFrameSummary::WasmFrameSummary(
1174 Isolate* isolate, FrameSummary::Kind kind,
1175 Handle<WasmInstanceObject> instance, bool at_to_number_conversion)
1176 : FrameSummaryBase(isolate, kind),
1177 wasm_instance_(instance),
1178 at_to_number_conversion_(at_to_number_conversion) {}
1179
1180 Handle<Object> FrameSummary::WasmFrameSummary::receiver() const {
1181 return wasm_instance_->GetIsolate()->global_proxy();
1182 }
1183
1184 #define WASM_SUMMARY_DISPATCH(type, name) \
1185 type FrameSummary::WasmFrameSummary::name() const { \
1186 DCHECK(kind() == Kind::WASM_COMPILED || kind() == Kind::WASM_INTERPRETED); \
1187 return kind() == Kind::WASM_COMPILED \
1188 ? static_cast<const WasmCompiledFrameSummary*>(this)->name() \
1189 : static_cast<const WasmInterpretedFrameSummary*>(this) \
1190 ->name(); \
1191 }
1192
1193 WASM_SUMMARY_DISPATCH(uint32_t, function_index)
1194 WASM_SUMMARY_DISPATCH(int, byte_offset)
1195
1196 #undef WASM_SUMMARY_DISPATCH
1197
1198 int FrameSummary::WasmFrameSummary::SourcePosition() const {
1199 int offset = byte_offset();
1200 Handle<WasmCompiledModule> compiled_module(wasm_instance()->compiled_module(),
1201 isolate());
1202 if (compiled_module->is_asm_js()) {
1203 offset = WasmCompiledModule::GetAsmJsSourcePosition(
1204 compiled_module, function_index(), offset, at_to_number_conversion());
1205 } else {
1206 offset += compiled_module->GetFunctionOffset(function_index());
1207 }
1208 return offset;
1209 }
1210
1211 Handle<Script> FrameSummary::WasmFrameSummary::script() const {
1212 return handle(wasm_instance()->compiled_module()->script());
1213 }
1214
1215 Handle<String> FrameSummary::WasmFrameSummary::FunctionName() const {
1216 Handle<WasmCompiledModule> compiled_module(
1217 wasm_instance()->compiled_module());
1218 return WasmCompiledModule::GetFunctionName(compiled_module->GetIsolate(),
1219 compiled_module, function_index());
1220 }
1221
1222 Handle<Context> FrameSummary::WasmFrameSummary::native_context() const {
1223 return wasm_instance()->compiled_module()->native_context();
1224 }
1225
1226 FrameSummary::WasmCompiledFrameSummary::WasmCompiledFrameSummary(
1227 Isolate* isolate, Handle<WasmInstanceObject> instance, Handle<Code> code,
1228 int code_offset, bool at_to_number_conversion)
1229 : WasmFrameSummary(isolate, WASM_COMPILED, instance,
1230 at_to_number_conversion),
1231 code_(code),
1232 code_offset_(code_offset) {}
1233
1234 uint32_t FrameSummary::WasmCompiledFrameSummary::function_index() const {
1235 FixedArray* deopt_data = code()->deoptimization_data();
1236 DCHECK_EQ(2, deopt_data->length());
1237 DCHECK(deopt_data->get(1)->IsSmi());
1238 int val = Smi::cast(deopt_data->get(1))->value();
1239 DCHECK_LE(0, val);
1240 return static_cast<uint32_t>(val);
1241 }
1242
1243 int FrameSummary::WasmCompiledFrameSummary::byte_offset() const {
1244 return AbstractCode::cast(*code())->SourcePosition(code_offset());
1245 }
1246
1247 FrameSummary::WasmInterpretedFrameSummary::WasmInterpretedFrameSummary(
1248 Isolate* isolate, Handle<WasmInstanceObject> instance,
1249 uint32_t function_index, int byte_offset)
1250 : WasmFrameSummary(isolate, WASM_INTERPRETED, instance, false),
1251 function_index_(function_index),
1252 byte_offset_(byte_offset) {}
1253
1254 FrameSummary::~FrameSummary() {
1255 #define FRAME_SUMMARY_DESTR(kind, type, field, desc) \
1256 case kind: \
1257 field.~type(); \
1258 break;
1259 switch (base_.kind()) {
1260 FRAME_SUMMARY_VARIANTS(FRAME_SUMMARY_DESTR)
1261 default:
1262 UNREACHABLE();
1263 }
1264 #undef FRAME_SUMMARY_DESTR
1265 }
1266
1267 FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) {
1268 DCHECK_LE(0, index);
1147 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); 1269 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
1148 frame->Summarize(&frames); 1270 frame->Summarize(&frames);
1271 DCHECK_GT(frames.length(), index);
1272 return frames[index];
1273 }
1274
1275 FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) {
1276 List<FrameSummary> frames(1);
1277 frame->Summarize(&frames);
1278 DCHECK_EQ(1, frames.length());
1149 return frames.first(); 1279 return frames.first();
1150 } 1280 }
1151 1281
1152 void FrameSummary::Print() { 1282 #define FRAME_SUMMARY_DISPATCH(ret, name) \
1153 PrintF("receiver: "); 1283 ret FrameSummary::name() const { \
1154 receiver_->ShortPrint(); 1284 switch (base_.kind()) { \
1155 PrintF("\nfunction: "); 1285 case JAVA_SCRIPT: \
1156 function_->shared()->DebugName()->ShortPrint(); 1286 return java_script_summary_.name(); \
1157 PrintF("\ncode: "); 1287 case WASM_COMPILED: \
1158 abstract_code_->ShortPrint(); 1288 return wasm_compiled_summary_.name(); \
1159 if (abstract_code_->IsCode()) { 1289 case WASM_INTERPRETED: \
1160 Code* code = abstract_code_->GetCode(); 1290 return wasm_interpreted_summary_.name(); \
1161 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); 1291 default: \
1162 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 1292 UNREACHABLE(); \
1163 if (function()->shared()->asm_function()) { 1293 return ret{}; \
1164 DCHECK(CannotDeoptFromAsmCode(code, *function())); 1294 } \
1165 PrintF(" ASM ");
1166 } else {
1167 PrintF(" OPT (approximate)");
1168 }
1169 }
1170 } else {
1171 PrintF(" BYTECODE ");
1172 } 1295 }
1173 PrintF("\npc: %d\n", code_offset_); 1296
1174 } 1297 FRAME_SUMMARY_DISPATCH(Handle<Object>, receiver)
1298 FRAME_SUMMARY_DISPATCH(int, code_offset)
1299 FRAME_SUMMARY_DISPATCH(bool, is_constructor)
1300 FRAME_SUMMARY_DISPATCH(bool, is_subject_to_debugging)
1301 FRAME_SUMMARY_DISPATCH(Handle<Object>, script)
1302 FRAME_SUMMARY_DISPATCH(int, SourcePosition)
1303 FRAME_SUMMARY_DISPATCH(int, SourceStatementPosition)
1304 FRAME_SUMMARY_DISPATCH(Handle<String>, FunctionName)
1305 FRAME_SUMMARY_DISPATCH(Handle<Context>, native_context)
1306
1307 #undef FRAME_SUMMARY_DISPATCH
1175 1308
1176 void OptimizedFrame::Summarize(List<FrameSummary>* frames, 1309 void OptimizedFrame::Summarize(List<FrameSummary>* frames,
1177 FrameSummary::Mode mode) const { 1310 FrameSummary::Mode mode) const {
1178 DCHECK(frames->length() == 0); 1311 DCHECK(frames->length() == 0);
1179 DCHECK(is_optimized()); 1312 DCHECK(is_optimized());
1180 1313
1181 // Delegate to JS frame in absence of turbofan deoptimization. 1314 // Delegate to JS frame in absence of turbofan deoptimization.
1182 // TODO(turbofan): Revisit once we support deoptimization across the board. 1315 // TODO(turbofan): Revisit once we support deoptimization across the board.
1183 Code* code = LookupCode(); 1316 Code* code = LookupCode();
1184 if (code->kind() == Code::BUILTIN || 1317 if (code->kind() == Code::BUILTIN ||
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 DeoptimizationOutputData::cast(code->deoptimization_data()); 1395 DeoptimizationOutputData::cast(code->deoptimization_data());
1263 unsigned const entry = 1396 unsigned const entry =
1264 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info); 1397 Deoptimizer::GetOutputInfo(output_data, bailout_id, shared_info);
1265 code_offset = FullCodeGenerator::PcField::decode(entry); 1398 code_offset = FullCodeGenerator::PcField::decode(entry);
1266 abstract_code = AbstractCode::cast(code); 1399 abstract_code = AbstractCode::cast(code);
1267 } else { 1400 } else {
1268 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME); 1401 DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME);
1269 code_offset = bailout_id.ToInt(); // Points to current bytecode. 1402 code_offset = bailout_id.ToInt(); // Points to current bytecode.
1270 abstract_code = AbstractCode::cast(shared_info->bytecode_array()); 1403 abstract_code = AbstractCode::cast(shared_info->bytecode_array());
1271 } 1404 }
1272 FrameSummary summary(receiver, function, abstract_code, code_offset, 1405 FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver,
1273 is_constructor); 1406 function, abstract_code,
1407 code_offset, is_constructor);
1274 frames->Add(summary); 1408 frames->Add(summary);
1275 is_constructor = false; 1409 is_constructor = false;
1276 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) { 1410 } else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) {
1277 // The next encountered JS_FRAME will be marked as a constructor call. 1411 // The next encountered JS_FRAME will be marked as a constructor call.
1278 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); 1412 it.Skip(Translation::NumberOfOperandsFor(frame_opcode));
1279 DCHECK(!is_constructor); 1413 DCHECK(!is_constructor);
1280 is_constructor = true; 1414 is_constructor = true;
1281 } else { 1415 } else {
1282 // Skip over operands to advance to the next opcode. 1416 // Skip over operands to advance to the next opcode.
1283 it.Skip(Translation::NumberOfOperandsFor(frame_opcode)); 1417 it.Skip(Translation::NumberOfOperandsFor(frame_opcode));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 InterpreterFrameConstants::kRegisterFileFromFp, 1611 InterpreterFrameConstants::kRegisterFileFromFp,
1478 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize); 1612 InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
1479 return SetExpression(index + register_index, value); 1613 return SetExpression(index + register_index, value);
1480 } 1614 }
1481 1615
1482 void InterpretedFrame::Summarize(List<FrameSummary>* functions, 1616 void InterpretedFrame::Summarize(List<FrameSummary>* functions,
1483 FrameSummary::Mode mode) const { 1617 FrameSummary::Mode mode) const {
1484 DCHECK(functions->length() == 0); 1618 DCHECK(functions->length() == 0);
1485 AbstractCode* abstract_code = 1619 AbstractCode* abstract_code =
1486 AbstractCode::cast(function()->shared()->bytecode_array()); 1620 AbstractCode::cast(function()->shared()->bytecode_array());
1487 FrameSummary summary(receiver(), function(), abstract_code, 1621 FrameSummary::JavaScriptFrameSummary summary(
1488 GetBytecodeOffset(), IsConstructor()); 1622 isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(),
1623 IsConstructor());
1489 functions->Add(summary); 1624 functions->Add(summary);
1490 } 1625 }
1491 1626
1492 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { 1627 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
1493 return Smi::cast(GetExpression(0))->value(); 1628 return Smi::cast(GetExpression(0))->value();
1494 } 1629 }
1495 1630
1496 int ArgumentsAdaptorFrame::GetLength(Address fp) { 1631 int ArgumentsAdaptorFrame::GetLength(Address fp) {
1497 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset; 1632 const int offset = ArgumentsAdaptorFrameConstants::kLengthOffset;
1498 return Smi::cast(Memory::Object_at(fp + offset))->value(); 1633 return Smi::cast(Memory::Object_at(fp + offset))->value();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 } 1700 }
1566 1701
1567 WasmInstanceObject* WasmCompiledFrame::wasm_instance() const { 1702 WasmInstanceObject* WasmCompiledFrame::wasm_instance() const {
1568 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode()); 1703 WasmInstanceObject* obj = wasm::GetOwningWasmInstance(LookupCode());
1569 // This is a live stack frame; it must have a live instance. 1704 // This is a live stack frame; it must have a live instance.
1570 DCHECK_NOT_NULL(obj); 1705 DCHECK_NOT_NULL(obj);
1571 return obj; 1706 return obj;
1572 } 1707 }
1573 1708
1574 uint32_t WasmCompiledFrame::function_index() const { 1709 uint32_t WasmCompiledFrame::function_index() const {
1575 FixedArray* deopt_data = LookupCode()->deoptimization_data(); 1710 return FrameSummary::GetSingle(this).AsWasmCompiled().function_index();
1576 DCHECK(deopt_data->length() == 2);
1577 return Smi::cast(deopt_data->get(1))->value();
1578 } 1711 }
1579 1712
1580 Script* WasmCompiledFrame::script() const { 1713 Script* WasmCompiledFrame::script() const {
1581 return wasm_instance()->compiled_module()->script(); 1714 return wasm_instance()->compiled_module()->script();
1582 } 1715 }
1583 1716
1584 int WasmCompiledFrame::position() const { 1717 int WasmCompiledFrame::position() const {
1585 int position = StandardFrame::position(); 1718 return FrameSummary::GetSingle(this).SourcePosition();
1586 if (wasm_instance()->compiled_module()->is_asm_js()) {
1587 Handle<WasmCompiledModule> compiled_module(
1588 WasmInstanceObject::cast(wasm_instance())->compiled_module(),
1589 isolate());
1590 DCHECK_LE(0, position);
1591 position = WasmCompiledModule::GetAsmJsSourcePosition(
1592 compiled_module, function_index(), static_cast<uint32_t>(position),
1593 at_to_number_conversion());
1594 }
1595 return position;
1596 } 1719 }
1597 1720
1598 void WasmCompiledFrame::Summarize(List<FrameSummary>* functions, 1721 void WasmCompiledFrame::Summarize(List<FrameSummary>* functions,
1599 FrameSummary::Mode mode) const { 1722 FrameSummary::Mode mode) const {
1600 // TODO(clemensh): Implement. 1723 DCHECK_EQ(0, functions->length());
1724 Handle<Code> code(LookupCode(), isolate());
1725 int offset = static_cast<int>(pc() - code->instruction_start());
1726 Handle<WasmInstanceObject> instance(wasm_instance(), isolate());
1727 FrameSummary::WasmCompiledFrameSummary summary(
1728 isolate(), instance, code, offset, at_to_number_conversion());
1729 functions->Add(summary);
1601 } 1730 }
1602 1731
1603 bool WasmCompiledFrame::at_to_number_conversion() const { 1732 bool WasmCompiledFrame::at_to_number_conversion() const {
1604 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the 1733 // Check whether our callee is a WASM_TO_JS frame, and this frame is at the
1605 // ToNumber conversion call. 1734 // ToNumber conversion call.
1606 Address callee_pc = reinterpret_cast<Address>(this->callee_pc()); 1735 Address callee_pc = reinterpret_cast<Address>(this->callee_pc());
1607 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr; 1736 Code* code = callee_pc ? isolate()->FindCodeObject(callee_pc) : nullptr;
1608 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false; 1737 if (!code || code->kind() != Code::WASM_TO_JS_FUNCTION) return false;
1609 int offset = static_cast<int>(callee_pc - code->instruction_start()); 1738 int offset = static_cast<int>(callee_pc - code->instruction_start());
1610 int pos = AbstractCode::cast(code)->SourcePosition(offset); 1739 int pos = AbstractCode::cast(code)->SourcePosition(offset);
(...skipping 21 matching lines...) Expand all
1632 accumulator->Add("WASM TO INTERPRETER ["); 1761 accumulator->Add("WASM TO INTERPRETER [");
1633 Script* script = this->script(); 1762 Script* script = this->script();
1634 accumulator->PrintName(script->name()); 1763 accumulator->PrintName(script->name());
1635 accumulator->Add("]"); 1764 accumulator->Add("]");
1636 if (mode != OVERVIEW) accumulator->Add("\n"); 1765 if (mode != OVERVIEW) accumulator->Add("\n");
1637 } 1766 }
1638 1767
1639 void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions, 1768 void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions,
1640 FrameSummary::Mode mode) const { 1769 FrameSummary::Mode mode) const {
1641 // TODO(clemensh): Implement this. 1770 // TODO(clemensh): Implement this.
1771 UNIMPLEMENTED();
1642 } 1772 }
1643 1773
1644 Code* WasmInterpreterEntryFrame::unchecked_code() const { 1774 Code* WasmInterpreterEntryFrame::unchecked_code() const {
1645 return isolate()->FindCodeObject(pc()); 1775 return isolate()->FindCodeObject(pc());
1646 } 1776 }
1647 1777
1648 WasmInstanceObject* WasmInterpreterEntryFrame::wasm_instance() const { 1778 WasmInstanceObject* WasmInterpreterEntryFrame::wasm_instance() const {
1649 WasmInstanceObject* ret = wasm::GetOwningWasmInstance(LookupCode()); 1779 WasmInstanceObject* ret = wasm::GetOwningWasmInstance(LookupCode());
1650 // This is a live stack frame, there must be a live wasm instance available. 1780 // This is a live stack frame, there must be a live wasm instance available.
1651 DCHECK_NOT_NULL(ret); 1781 DCHECK_NOT_NULL(ret);
1652 return ret; 1782 return ret;
1653 } 1783 }
1654 1784
1655 Script* WasmInterpreterEntryFrame::script() const { 1785 Script* WasmInterpreterEntryFrame::script() const {
1656 return wasm_instance()->compiled_module()->script(); 1786 return wasm_instance()->compiled_module()->script();
1657 } 1787 }
1658 1788
1659 int WasmInterpreterEntryFrame::position() const { 1789 int WasmInterpreterEntryFrame::position() const {
1660 // TODO(clemensh): Implement this. 1790 return FrameSummary::GetFirst(this).AsWasmInterpreted().SourcePosition();
1661 return 0;
1662 } 1791 }
1663 1792
1664 Address WasmInterpreterEntryFrame::GetCallerStackPointer() const { 1793 Address WasmInterpreterEntryFrame::GetCallerStackPointer() const {
1665 return fp() + ExitFrameConstants::kCallerSPOffset; 1794 return fp() + ExitFrameConstants::kCallerSPOffset;
1666 } 1795 }
1667 1796
1668 namespace { 1797 namespace {
1669 1798
1670 1799
1671 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, 1800 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 2225 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
2097 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 2226 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
2098 list.Add(frame, zone); 2227 list.Add(frame, zone);
2099 } 2228 }
2100 return list.ToVector(); 2229 return list.ToVector();
2101 } 2230 }
2102 2231
2103 2232
2104 } // namespace internal 2233 } // namespace internal
2105 } // namespace v8 2234 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698