| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 buffer_size_ == kMinimalBufferSize) { | 145 buffer_size_ == kMinimalBufferSize) { |
| 146 isolate()->set_assembler_spare_buffer(buffer_); | 146 isolate()->set_assembler_spare_buffer(buffer_); |
| 147 } else { | 147 } else { |
| 148 DeleteArray(buffer_); | 148 DeleteArray(buffer_); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 // ----------------------------------------------------------------------------- | 154 // ----------------------------------------------------------------------------- |
| 155 // Implementation of PredictableCodeSizeScope |
| 156 |
| 157 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler, |
| 158 int expected_size) |
| 159 : assembler_(assembler), |
| 160 expected_size_(expected_size), |
| 161 start_offset_(assembler->pc_offset()), |
| 162 old_value_(assembler->predictable_code_size()) { |
| 163 assembler_->set_predictable_code_size(true); |
| 164 } |
| 165 |
| 166 |
| 167 PredictableCodeSizeScope::~PredictableCodeSizeScope() { |
| 168 // TODO(svenpanne) Remove the 'if' when everything works. |
| 169 if (expected_size_ >= 0) { |
| 170 CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_); |
| 171 } |
| 172 assembler_->set_predictable_code_size(old_value_); |
| 173 } |
| 174 |
| 175 |
| 176 // ----------------------------------------------------------------------------- |
| 155 // Implementation of Label | 177 // Implementation of Label |
| 156 | 178 |
| 157 int Label::pos() const { | 179 int Label::pos() const { |
| 158 if (pos_ < 0) return -pos_ - 1; | 180 if (pos_ < 0) return -pos_ - 1; |
| 159 if (pos_ > 0) return pos_ - 1; | 181 if (pos_ > 0) return pos_ - 1; |
| 160 UNREACHABLE(); | 182 UNREACHABLE(); |
| 161 return 0; | 183 return 0; |
| 162 } | 184 } |
| 163 | 185 |
| 164 | 186 |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1453 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1432 state_.written_position = state_.current_position; | 1454 state_.written_position = state_.current_position; |
| 1433 written = true; | 1455 written = true; |
| 1434 } | 1456 } |
| 1435 | 1457 |
| 1436 // Return whether something was written. | 1458 // Return whether something was written. |
| 1437 return written; | 1459 return written; |
| 1438 } | 1460 } |
| 1439 | 1461 |
| 1440 } } // namespace v8::internal | 1462 } } // namespace v8::internal |
| OLD | NEW |