Chromium Code Reviews

Unified Diff: src/assembler.cc

Issue 11348195: PredictableCodeSizeScope checks the expected size now. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index ec2deffd7ce0953430272008de277fadeb236382..9cec04a087175c9932f1c69c1857b40740898c73 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -152,6 +152,28 @@ AssemblerBase::~AssemblerBase() {
// -----------------------------------------------------------------------------
+// Implementation of PredictableCodeSizeScope
+
+PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler,
+ int expected_size)
+ : assembler_(assembler),
+ expected_size_(expected_size),
+ start_offset_(assembler->pc_offset()),
+ old_value_(assembler->predictable_code_size()) {
+ assembler_->set_predictable_code_size(true);
+}
+
+
+PredictableCodeSizeScope::~PredictableCodeSizeScope() {
+ // TODO(svenpanne) Remove the 'if' when everything works.
+ if (expected_size_ >= 0) {
+ CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_);
+ }
+ assembler_->set_predictable_code_size(old_value_);
+}
+
+
+// -----------------------------------------------------------------------------
// Implementation of Label
int Label::pos() const {
« no previous file with comments | « src/assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine