Version 3.0.0.
Improved performance by (partially) addressing issue 957 on IA-32. Still needs more work for the other architectures.
git-svn-id: http://v8.googlecode.com/svn/trunk@5932 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/assembler.cc b/src/assembler.cc
index 7493673..d71a35a 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -35,10 +35,12 @@
#include "v8.h"
#include "arguments.h"
+#include "deoptimizer.h"
#include "execution.h"
#include "ic-inl.h"
#include "factory.h"
#include "runtime.h"
+#include "runtime-profiler.h"
#include "serialize.h"
#include "stub-cache.h"
#include "regexp-stack.h"
@@ -62,6 +64,10 @@
namespace internal {
+const double DoubleConstant::min_int = kMinInt;
+const double DoubleConstant::one_half = 0.5;
+
+
// -----------------------------------------------------------------------------
// Implementation of Label
@@ -210,7 +216,7 @@
#endif
Counters::reloc_info_count.Increment();
ASSERT(rinfo->pc() - last_pc_ >= 0);
- ASSERT(RelocInfo::NUMBER_OF_MODES < kMaxRelocModes);
+ ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes);
// Use unsigned delta-encoding for pc.
uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
RelocInfo::Mode rmode = rinfo->rmode();
@@ -350,12 +356,8 @@
Advance();
// Check if we want source positions.
if (mode_mask_ & RelocInfo::kPositionMask) {
- // Check if we want this type of source position.
- if (SetMode(DebugInfoModeFromTag(GetPositionTypeTag()))) {
- // Finally read the data before returning.
- ReadTaggedData();
- return;
- }
+ ReadTaggedData();
+ if (SetMode(DebugInfoModeFromTag(GetPositionTypeTag()))) return;
}
} else {
ASSERT(tag == kDefaultTag);
@@ -390,7 +392,7 @@
RelocIterator::RelocIterator(Code* code, int mode_mask) {
rinfo_.pc_ = code->instruction_start();
rinfo_.data_ = 0;
- // relocation info is read backwards
+ // Relocation info is read backwards.
pos_ = code->relocation_start() + code->relocation_size();
end_ = code->relocation_start();
done_ = false;
@@ -403,7 +405,7 @@
RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
rinfo_.pc_ = desc.buffer;
rinfo_.data_ = 0;
- // relocation info is read backwards
+ // Relocation info is read backwards.
pos_ = desc.buffer + desc.buffer_size;
end_ = pos_ - desc.reloc_size;
done_ = false;
@@ -435,6 +437,8 @@
return "debug break";
case RelocInfo::CODE_TARGET:
return "code target";
+ case RelocInfo::GLOBAL_PROPERTY_CELL:
+ return "global property cell";
case RelocInfo::RUNTIME_ENTRY:
return "runtime entry";
case RelocInfo::JS_RETURN:
@@ -480,6 +484,13 @@
PrintF(" (%s) (%p)", Code::Kind2String(code->kind()), target_address());
} else if (IsPosition(rmode_)) {
PrintF(" (%" V8_PTR_PREFIX "d)", data());
+ } else if (rmode_ == RelocInfo::RUNTIME_ENTRY) {
+ // Depotimization bailouts are stored as runtime entries.
+ int id = Deoptimizer::GetDeoptimizationId(
+ target_address(), Deoptimizer::EAGER);
+ if (id != Deoptimizer::kNotDeoptimizationEntry) {
+ PrintF(" (deoptimization bailout %d)", id);
+ }
}
PrintF("\n");
@@ -493,6 +504,9 @@
case EMBEDDED_OBJECT:
Object::VerifyPointer(target_object());
break;
+ case GLOBAL_PROPERTY_CELL:
+ Object::VerifyPointer(target_cell());
+ break;
case DEBUG_BREAK:
#ifndef ENABLE_DEBUGGER_SUPPORT
UNREACHABLE();
@@ -599,6 +613,23 @@
}
+ExternalReference ExternalReference::new_deoptimizer_function() {
+ return ExternalReference(
+ Redirect(FUNCTION_ADDR(Deoptimizer::New)));
+}
+
+
+ExternalReference ExternalReference::compute_output_frames_function() {
+ return ExternalReference(
+ Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
+}
+
+
+ExternalReference ExternalReference::global_contexts_list() {
+ return ExternalReference(Heap::global_contexts_list_address());
+}
+
+
ExternalReference ExternalReference::keyed_lookup_cache_keys() {
return ExternalReference(KeyedLookupCache::keys_address());
}
@@ -679,6 +710,18 @@
}
+ExternalReference ExternalReference::address_of_min_int() {
+ return ExternalReference(reinterpret_cast<void*>(
+ const_cast<double*>(&DoubleConstant::min_int)));
+}
+
+
+ExternalReference ExternalReference::address_of_one_half() {
+ return ExternalReference(reinterpret_cast<void*>(
+ const_cast<double*>(&DoubleConstant::one_half)));
+}
+
+
#ifndef V8_INTERPRETED_REGEXP
ExternalReference ExternalReference::re_check_stack_guard_state() {
@@ -805,19 +848,17 @@
#endif
-void PositionsRecorder::RecordPosition(int pos,
- PositionRecordingType recording_type) {
+void PositionsRecorder::RecordPosition(int pos) {
ASSERT(pos != RelocInfo::kNoPosition);
ASSERT(pos >= 0);
- current_position_ = pos;
- current_position_recording_type_ = recording_type;
+ state_.current_position = pos;
}
void PositionsRecorder::RecordStatementPosition(int pos) {
ASSERT(pos != RelocInfo::kNoPosition);
ASSERT(pos >= 0);
- current_statement_position_ = pos;
+ state_.current_statement_position = pos;
}
@@ -826,31 +867,26 @@
// Write the statement position if it is different from what was written last
// time.
- if (current_statement_position_ != written_statement_position_) {
+ if (state_.current_statement_position != state_.written_statement_position) {
EnsureSpace ensure_space(assembler_);
assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION,
- current_statement_position_);
- written_statement_position_ = current_statement_position_;
+ state_.current_statement_position);
+ state_.written_statement_position = state_.current_statement_position;
written = true;
}
// Write the position if it is different from what was written last time and
- // also different from the written statement position or was forced.
- if (current_position_ != written_position_ &&
- (current_position_ != current_statement_position_ || !written) &&
- (current_position_ != written_statement_position_
- || current_position_recording_type_ == FORCED_POSITION)) {
+ // also different from the written statement position.
+ if (state_.current_position != state_.written_position &&
+ state_.current_position != state_.written_statement_position) {
EnsureSpace ensure_space(assembler_);
- assembler_->RecordRelocInfo(RelocInfo::POSITION, current_position_);
- written_position_ = current_position_;
+ assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
+ state_.written_position = state_.current_position;
written = true;
}
- current_position_recording_type_ = NORMAL_POSITION;
-
// Return whether something was written.
return written;
}
-
} } // namespace v8::internal