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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1607433005: [interpreter] Implement exception handler table building. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added moar tests. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index b93bae95cabc17788d34c8261bf46b3660625829..d0fb1d5664509ee205bb42dd89d013c10ba5ed18 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -70,6 +70,7 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone)
bytecodes_(zone),
bytecode_generated_(false),
constant_array_builder_(isolate, zone),
+ handler_table_builder_(isolate, zone),
last_block_end_(0),
last_bytecode_start_(~0),
exit_seen_in_block_(false),
@@ -152,9 +153,11 @@ Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
Factory* factory = isolate_->factory();
Handle<FixedArray> constant_pool =
constant_array_builder()->ToFixedArray(factory);
+ Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable();
Handle<BytecodeArray> output =
factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size,
parameter_count(), constant_pool);
+ output->set_handler_table(*handler_table);
bytecode_generated_ = true;
return output;
}
@@ -1010,6 +1013,28 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) {
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::MarkHandler(int handler_id,
+ bool will_catch) {
+ handler_table_builder()->SetHandlerTarget(handler_id, bytecodes()->size());
+ handler_table_builder()->SetPrediction(handler_id, will_catch);
+ return *this;
+}
+
+
+BytecodeArrayBuilder& BytecodeArrayBuilder::MarkTryBegin(int handler_id,
+ Register context) {
+ handler_table_builder()->SetTryRegionStart(handler_id, bytecodes()->size());
+ handler_table_builder()->SetContextRegister(handler_id, context);
+ return *this;
+}
+
+
+BytecodeArrayBuilder& BytecodeArrayBuilder::MarkTryEnd(int handler_id) {
+ handler_table_builder()->SetTryRegionEnd(handler_id, bytecodes()->size());
+ return *this;
+}
+
+
void BytecodeArrayBuilder::LeaveBasicBlock() {
last_block_end_ = bytecodes()->size();
exit_seen_in_block_ = false;
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698