diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-25 22:45:23 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-25 23:45:02 +0100 |
commit | b15a10e7a014674ef6f71c51ad84032fb7b802e2 (patch) | |
tree | 3bb04a6cb05c7a37c385eda4521b8a9e7bcd736f /deps/v8/src/assembler.cc | |
parent | 34046084c0665c8bb2dfd84683dcf29d7ffbad2d (diff) | |
download | node-new-b15a10e7a014674ef6f71c51ad84032fb7b802e2.tar.gz |
deps: downgrade v8 to 3.14.5
V8 3.15 and newer have stability and performance issues. Roll back to
a known-good version.
Diffstat (limited to 'deps/v8/src/assembler.cc')
-rw-r--r-- | deps/v8/src/assembler.cc | 187 |
1 files changed, 2 insertions, 185 deletions
diff --git a/deps/v8/src/assembler.cc b/deps/v8/src/assembler.cc index 25157be2eb..d81d4ae614 100644 --- a/deps/v8/src/assembler.cc +++ b/deps/v8/src/assembler.cc @@ -103,78 +103,15 @@ static DoubleConstant double_constants; const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; -static bool math_exp_data_initialized = false; -static Mutex* math_exp_data_mutex = NULL; -static double* math_exp_constants_array = NULL; -static double* math_exp_log_table_array = NULL; - // ----------------------------------------------------------------------------- // Implementation of AssemblerBase -AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size) +AssemblerBase::AssemblerBase(Isolate* isolate) : isolate_(isolate), - jit_cookie_(0), - emit_debug_code_(FLAG_debug_code), - predictable_code_size_(false) { + jit_cookie_(0) { if (FLAG_mask_constants_with_cookie && isolate != NULL) { jit_cookie_ = V8::RandomPrivate(isolate); } - - if (buffer == NULL) { - // Do our own buffer management. - if (buffer_size <= kMinimalBufferSize) { - buffer_size = kMinimalBufferSize; - if (isolate->assembler_spare_buffer() != NULL) { - buffer = isolate->assembler_spare_buffer(); - isolate->set_assembler_spare_buffer(NULL); - } - } - if (buffer == NULL) buffer = NewArray<byte>(buffer_size); - own_buffer_ = true; - } else { - // Use externally provided buffer instead. - ASSERT(buffer_size > 0); - own_buffer_ = false; - } - buffer_ = static_cast<byte*>(buffer); - buffer_size_ = buffer_size; - - pc_ = buffer_; -} - - -AssemblerBase::~AssemblerBase() { - if (own_buffer_) { - if (isolate() != NULL && - isolate()->assembler_spare_buffer() == NULL && - buffer_size_ == kMinimalBufferSize) { - isolate()->set_assembler_spare_buffer(buffer_); - } else { - DeleteArray(buffer_); - } - } -} - - -// ----------------------------------------------------------------------------- -// 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_); } @@ -376,7 +313,6 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) { #ifdef DEBUG byte* begin_pos = pos_; #endif - ASSERT(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); ASSERT(rinfo->pc() - last_pc_ >= 0); ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM <= kMaxStandardNonCompactModes); @@ -634,15 +570,6 @@ void RelocIterator::next() { } } } - if (code_age_sequence_ != NULL) { - byte* old_code_age_sequence = code_age_sequence_; - code_age_sequence_ = NULL; - if (SetMode(RelocInfo::CODE_AGE_SEQUENCE)) { - rinfo_.data_ = 0; - rinfo_.pc_ = old_code_age_sequence; - return; - } - } done_ = true; } @@ -658,12 +585,6 @@ RelocIterator::RelocIterator(Code* code, int mode_mask) { mode_mask_ = mode_mask; last_id_ = 0; last_position_ = 0; - byte* sequence = code->FindCodeAgeSequence(); - if (sequence != NULL && !Code::IsYoungSequence(sequence)) { - code_age_sequence_ = sequence; - } else { - code_age_sequence_ = NULL; - } if (mode_mask_ == 0) pos_ = end_; next(); } @@ -679,7 +600,6 @@ RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { mode_mask_ = mode_mask; last_id_ = 0; last_position_ = 0; - code_age_sequence_ = NULL; if (mode_mask_ == 0) pos_ = end_; next(); } @@ -732,8 +652,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { UNREACHABLE(); #endif return "debug break slot"; - case RelocInfo::CODE_AGE_SEQUENCE: - return "code_age_sequence"; case RelocInfo::NUMBER_OF_MODES: UNREACHABLE(); return "number_of_modes"; @@ -821,9 +739,6 @@ void RelocInfo::Verify() { case NUMBER_OF_MODES: UNREACHABLE(); break; - case CODE_AGE_SEQUENCE: - ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode()); - break; } } #endif // VERIFY_HEAP @@ -841,70 +756,6 @@ void ExternalReference::SetUp() { double_constants.canonical_non_hole_nan = OS::nan_value(); double_constants.the_hole_nan = BitCast<double>(kHoleNanInt64); double_constants.negative_infinity = -V8_INFINITY; - - math_exp_data_mutex = OS::CreateMutex(); -} - - -void ExternalReference::InitializeMathExpData() { - // Early return? - if (math_exp_data_initialized) return; - - math_exp_data_mutex->Lock(); - if (!math_exp_data_initialized) { - // If this is changed, generated code must be adapted too. - const int kTableSizeBits = 11; - const int kTableSize = 1 << kTableSizeBits; - const double kTableSizeDouble = static_cast<double>(kTableSize); - - math_exp_constants_array = new double[9]; - // Input values smaller than this always return 0. - math_exp_constants_array[0] = -708.39641853226408; - // Input values larger than this always return +Infinity. - math_exp_constants_array[1] = 709.78271289338397; - math_exp_constants_array[2] = V8_INFINITY; - // The rest is black magic. Do not attempt to understand it. It is - // loosely based on the "expd" function published at: - // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html - const double constant3 = (1 << kTableSizeBits) / log(2.0); - math_exp_constants_array[3] = constant3; - math_exp_constants_array[4] = - static_cast<double>(static_cast<int64_t>(3) << 51); - math_exp_constants_array[5] = 1 / constant3; - math_exp_constants_array[6] = 3.0000000027955394; - math_exp_constants_array[7] = 0.16666666685227835; - math_exp_constants_array[8] = 1; - - math_exp_log_table_array = new double[kTableSize]; - for (int i = 0; i < kTableSize; i++) { - double value = pow(2, i / kTableSizeDouble); - - uint64_t bits = BitCast<uint64_t, double>(value); - bits &= (static_cast<uint64_t>(1) << 52) - 1; - double mantissa = BitCast<double, uint64_t>(bits); - - // <just testing> - uint64_t doublebits; - memcpy(&doublebits, &value, sizeof doublebits); - doublebits &= (static_cast<uint64_t>(1) << 52) - 1; - double mantissa2; - memcpy(&mantissa2, &doublebits, sizeof mantissa2); - CHECK_EQ(mantissa, mantissa2); - // </just testing> - - math_exp_log_table_array[i] = mantissa; - } - - math_exp_data_initialized = true; - } - math_exp_data_mutex->Unlock(); -} - - -void ExternalReference::TearDownMathExpData() { - delete[] math_exp_constants_array; - delete[] math_exp_log_table_array; - delete math_exp_data_mutex; } @@ -1023,13 +874,6 @@ ExternalReference ExternalReference::get_date_field_function( } -ExternalReference ExternalReference::get_make_code_young_function( - Isolate* isolate) { - return ExternalReference(Redirect( - isolate, FUNCTION_ADDR(Code::MakeCodeAgeSequenceYoung))); -} - - ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { return ExternalReference(isolate->date_cache()->stamp_address()); } @@ -1056,20 +900,6 @@ ExternalReference ExternalReference::compute_output_frames_function( } -ExternalReference ExternalReference::log_enter_external_function( - Isolate* isolate) { - return ExternalReference( - Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal))); -} - - -ExternalReference ExternalReference::log_leave_external_function( - Isolate* isolate) { - return ExternalReference( - Redirect(isolate, FUNCTION_ADDR(Logger::LeaveExternal))); -} - - ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate* isolate) { return ExternalReference(isolate->keyed_lookup_cache()->keys_address()); } @@ -1356,19 +1186,6 @@ ExternalReference ExternalReference::math_log_double_function( } -ExternalReference ExternalReference::math_exp_constants(int constant_index) { - ASSERT(math_exp_data_initialized); - return ExternalReference( - reinterpret_cast<void*>(math_exp_constants_array + constant_index)); -} - - -ExternalReference ExternalReference::math_exp_log_table() { - ASSERT(math_exp_data_initialized); - return ExternalReference(reinterpret_cast<void*>(math_exp_log_table_array)); -} - - ExternalReference ExternalReference::page_flags(Page* page) { return ExternalReference(reinterpret_cast<Address>(page) + MemoryChunk::kFlagsOffset); |