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

Unified Diff: src/objects.cc

Issue 1010883002: Switch full-codegen from StackHandlers to handler table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-isolate-dead-code
Patch Set: Fix debugger-pause-on-promise-rejection. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index f7d0fd5b65fc5fa923c7dfbccf9cda42128a6795..a1586e40701ac7928a9b876f16588fd2279ad9a8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8458,6 +8458,36 @@ Handle<DeoptimizationOutputData> DeoptimizationOutputData::New(
}
+int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out) {
+ int innermost_handler = -1, innermost_start = -1;
+ for (int i = 0; i < length(); i += kRangeEntrySize) {
+ int start_offset = Smi::cast(get(i + kRangeStartIndex))->value();
+ int end_offset = Smi::cast(get(i + kRangeEndIndex))->value();
+ int handler_offset = Smi::cast(get(i + kRangeHandlerIndex))->value();
+ int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value();
+ if (pc_offset > start_offset && pc_offset <= end_offset) {
+ DCHECK_NE(start_offset, innermost_start);
+ if (start_offset < innermost_start) continue;
+ innermost_handler = handler_offset;
+ innermost_start = start_offset;
+ *stack_depth_out = stack_depth;
+ }
+ }
+ return innermost_handler;
+}
+
+
+// TODO(turbofan): Make sure table is sorted and use binary search.
+int HandlerTable::LookupReturn(int pc_offset) {
+ for (int i = 0; i < length(); i += kReturnEntrySize) {
+ int return_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
+ int handler_offset = Smi::cast(get(i + kReturnHandlerIndex))->value();
+ if (pc_offset == return_offset) return handler_offset;
+ }
+ return -1;
+}
+
+
#ifdef DEBUG
bool DescriptorArray::IsEqualTo(DescriptorArray* other) {
if (IsEmpty()) return other->IsEmpty();
@@ -11484,6 +11514,30 @@ void DeoptimizationOutputData::DeoptimizationOutputDataPrint(
}
+void HandlerTable::HandlerTableRangePrint(std::ostream& os) {
+ os << " from to hdlr\n";
+ for (int i = 0; i < length(); i += kRangeEntrySize) {
+ int pc_start = Smi::cast(get(i + kRangeStartIndex))->value();
+ int pc_end = Smi::cast(get(i + kRangeEndIndex))->value();
+ int handler = Smi::cast(get(i + kRangeHandlerIndex))->value();
+ int depth = Smi::cast(get(i + kRangeDepthIndex))->value();
+ os << " (" << std::setw(4) << pc_start << "," << std::setw(4) << pc_end
+ << ") -> " << std::setw(4) << handler << " (depth=" << depth << ")\n";
+ }
+}
+
+
+void HandlerTable::HandlerTableReturnPrint(std::ostream& os) {
+ os << " off hdlr\n";
+ for (int i = 0; i < length(); i += kReturnEntrySize) {
+ int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value();
+ int handler = Smi::cast(get(i + kReturnHandlerIndex))->value();
+ os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4)
+ << handler << "\n";
+ }
+}
+
+
const char* Code::ICState2String(InlineCacheState state) {
switch (state) {
case UNINITIALIZED: return "UNINITIALIZED";
@@ -11630,13 +11684,12 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
#endif
}
- if (handler_table()->length() > 0 && is_turbofanned()) {
+ if (handler_table()->length() > 0) {
os << "Handler Table (size = " << handler_table()->Size() << ")\n";
- for (int i = 0; i < handler_table()->length(); i += 2) {
- int pc_offset = Smi::cast(handler_table()->get(i))->value();
- int handler = Smi::cast(handler_table()->get(i + 1))->value();
- os << static_cast<const void*>(instruction_start() + pc_offset) << " "
- << std::setw(4) << pc_offset << " " << std::setw(4) << handler << "\n";
+ if (kind() == FUNCTION) {
+ HandlerTable::cast(handler_table())->HandlerTableRangePrint(os);
+ } else if (kind() == OPTIMIZED_FUNCTION) {
+ HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os);
}
os << "\n";
}
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698