diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2015-08-31 17:10:53 -0700 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-09-06 21:38:06 +1000 |
commit | 4e3d767f4c33ac8e6d05f6fedc0dd65814c0b6e3 (patch) | |
tree | cf36eab49a0bed7830b364b87b9dc98fc1eaafc4 /deps/v8/src | |
parent | 439c1dde15c80b5eac4a02701ed30dfec324d3cf (diff) | |
download | node-new-4e3d767f4c33ac8e6d05f6fedc0dd65814c0b6e3.tar.gz |
deps: upgrade V8 to 4.5.103.30
Pick up https://github.com/v8/v8-git-mirror/commit/f9a0a1636a4623a5522c33674e110b346d085340
Commit log at https://chromium.googlesource.com/v8/v8.git/+log/branch-heads/4.5
PR-URL: https://github.com/nodejs/node/pull/2632
Reviewed-By: targos - Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: rvagg - Rod Vagg <rod@vagg.org>
Diffstat (limited to 'deps/v8/src')
-rw-r--r-- | deps/v8/src/api.cc | 13 | ||||
-rw-r--r-- | deps/v8/src/arm/assembler-arm.cc | 3 | ||||
-rw-r--r-- | deps/v8/src/arm64/assembler-arm64.cc | 3 | ||||
-rw-r--r-- | deps/v8/src/base/cpu.h | 3 | ||||
-rw-r--r-- | deps/v8/src/d8.cc | 14 | ||||
-rw-r--r-- | deps/v8/src/d8.gyp | 2 | ||||
-rw-r--r-- | deps/v8/src/heap/heap.cc | 13 | ||||
-rw-r--r-- | deps/v8/src/heap/heap.h | 4 | ||||
-rw-r--r-- | deps/v8/src/heap/memory-reducer.cc | 25 | ||||
-rw-r--r-- | deps/v8/src/preparser.h | 14 | ||||
-rw-r--r-- | deps/v8/src/startup-data-util.cc | 110 | ||||
-rw-r--r-- | deps/v8/src/startup-data-util.h | 40 |
12 files changed, 118 insertions, 126 deletions
diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 5ff8ccbae5..593aea641b 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -49,6 +49,7 @@ #include "src/simulator.h" #include "src/snapshot/natives.h" #include "src/snapshot/snapshot.h" +#include "src/startup-data-util.h" #include "src/unicode-inl.h" #include "src/v8threads.h" #include "src/version.h" @@ -5398,11 +5399,23 @@ HeapObjectStatistics::HeapObjectStatistics() object_count_(0), object_size_(0) {} + bool v8::V8::InitializeICU(const char* icu_data_file) { return i::InitializeICU(icu_data_file); } +void v8::V8::InitializeExternalStartupData(const char* directory_path) { + i::InitializeExternalStartupData(directory_path); +} + + +void v8::V8::InitializeExternalStartupData(const char* natives_blob, + const char* snapshot_blob) { + i::InitializeExternalStartupData(natives_blob, snapshot_blob); +} + + const char* v8::V8::GetVersion() { return i::Version::GetVersion(); } diff --git a/deps/v8/src/arm/assembler-arm.cc b/deps/v8/src/arm/assembler-arm.cc index 96bdf79fac..481a3b5ced 100644 --- a/deps/v8/src/arm/assembler-arm.cc +++ b/deps/v8/src/arm/assembler-arm.cc @@ -128,7 +128,8 @@ void CpuFeatures::ProbeImpl(bool cross_compile) { if (FLAG_enable_32dregs && cpu.has_vfp3_d32()) supported_ |= 1u << VFP32DREGS; if (cpu.implementer() == base::CPU::NVIDIA && - cpu.variant() == base::CPU::NVIDIA_DENVER) { + cpu.variant() == base::CPU::NVIDIA_DENVER && + cpu.part() <= base::CPU::NVIDIA_DENVER_V10) { supported_ |= 1u << COHERENT_CACHE; } #endif diff --git a/deps/v8/src/arm64/assembler-arm64.cc b/deps/v8/src/arm64/assembler-arm64.cc index 5445fe1a1b..f27d3b97b0 100644 --- a/deps/v8/src/arm64/assembler-arm64.cc +++ b/deps/v8/src/arm64/assembler-arm64.cc @@ -53,7 +53,8 @@ void CpuFeatures::ProbeImpl(bool cross_compile) { // Probe for runtime features base::CPU cpu; if (cpu.implementer() == base::CPU::NVIDIA && - cpu.variant() == base::CPU::NVIDIA_DENVER) { + cpu.variant() == base::CPU::NVIDIA_DENVER && + cpu.part() <= base::CPU::NVIDIA_DENVER_V10) { supported_ |= 1u << COHERENT_CACHE; } } diff --git a/deps/v8/src/base/cpu.h b/deps/v8/src/base/cpu.h index f6c5a8506a..1dc0a91f65 100644 --- a/deps/v8/src/base/cpu.h +++ b/deps/v8/src/base/cpu.h @@ -59,6 +59,9 @@ class CPU final { static const int ARM_CORTEX_A12 = 0xc0c; static const int ARM_CORTEX_A15 = 0xc0f; + // Denver-specific part code + static const int NVIDIA_DENVER_V10 = 0x002; + // PPC-specific part codes enum { PPC_POWER5, diff --git a/deps/v8/src/d8.cc b/deps/v8/src/d8.cc index 7db6f3ed9e..45bf33167f 100644 --- a/deps/v8/src/d8.cc +++ b/deps/v8/src/d8.cc @@ -50,10 +50,6 @@ #include "src/v8.h" #endif // !V8_SHARED -#ifdef V8_USE_EXTERNAL_STARTUP_DATA -#include "src/startup-data-util.h" -#endif // V8_USE_EXTERNAL_STARTUP_DATA - #if !defined(_WIN32) && !defined(_WIN64) #include <unistd.h> // NOLINT #else @@ -2316,10 +2312,12 @@ int Shell::Main(int argc, char* argv[]) { g_platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(g_platform); v8::V8::Initialize(); -#ifdef V8_USE_EXTERNAL_STARTUP_DATA - v8::StartupDataHandler startup_data(argv[0], options.natives_blob, - options.snapshot_blob); -#endif + if (options.natives_blob || options.snapshot_blob) { + v8::V8::InitializeExternalStartupData(options.natives_blob, + options.snapshot_blob); + } else { + v8::V8::InitializeExternalStartupData(argv[0]); + } SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg"); SetFlagsFromString("--redirect-code-traces-to=code.asm"); diff --git a/deps/v8/src/d8.gyp b/deps/v8/src/d8.gyp index 548459a790..e92a321990 100644 --- a/deps/v8/src/d8.gyp +++ b/deps/v8/src/d8.gyp @@ -50,8 +50,6 @@ 'sources': [ 'd8.h', 'd8.cc', - 'startup-data-util.h', - 'startup-data-util.cc' ], 'conditions': [ [ 'want_separate_host_toolset==1', { diff --git a/deps/v8/src/heap/heap.cc b/deps/v8/src/heap/heap.cc index 47717c162b..3d95373001 100644 --- a/deps/v8/src/heap/heap.cc +++ b/deps/v8/src/heap/heap.cc @@ -4867,19 +4867,6 @@ void Heap::ReduceNewSpaceSize() { } -void Heap::FinalizeIncrementalMarkingIfComplete(const char* comment) { - if (FLAG_overapproximate_weak_closure && - (incremental_marking()->IsReadyToOverApproximateWeakClosure() || - (!incremental_marking()->weak_closure_was_overapproximated() && - mark_compact_collector_.marking_deque()->IsEmpty()))) { - OverApproximateWeakClosure(comment); - } else if (incremental_marking()->IsComplete() || - (mark_compact_collector_.marking_deque()->IsEmpty())) { - CollectAllGarbage(kNoGCFlags, comment); - } -} - - bool Heap::TryFinalizeIdleIncrementalMarking( double idle_time_in_ms, size_t size_of_objects, size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { diff --git a/deps/v8/src/heap/heap.h b/deps/v8/src/heap/heap.h index 38166439ea..4c9e3ad144 100644 --- a/deps/v8/src/heap/heap.h +++ b/deps/v8/src/heap/heap.h @@ -852,8 +852,6 @@ class Heap { intptr_t step_size_in_bytes, double deadline_in_ms, IncrementalMarking::StepActions step_actions); - void FinalizeIncrementalMarkingIfComplete(const char* comment); - inline void increment_scan_on_scavenge_pages() { scan_on_scavenge_pages_++; if (FLAG_gc_verbose) { @@ -1644,8 +1642,6 @@ class Heap { bool HasHighFragmentation(); bool HasHighFragmentation(intptr_t used, intptr_t committed); - bool ShouldOptimizeForMemoryUsage() { return optimize_for_memory_usage_; } - protected: // Methods made available to tests. diff --git a/deps/v8/src/heap/memory-reducer.cc b/deps/v8/src/heap/memory-reducer.cc index e226f09a04..df827bae29 100644 --- a/deps/v8/src/heap/memory-reducer.cc +++ b/deps/v8/src/heap/memory-reducer.cc @@ -44,35 +44,12 @@ void MemoryReducer::NotifyTimer(const Event& event) { if (state_.action == kRun) { DCHECK(heap()->incremental_marking()->IsStopped()); DCHECK(FLAG_incremental_marking); + heap()->StartIdleIncrementalMarking(); if (FLAG_trace_gc_verbose) { PrintIsolate(heap()->isolate(), "Memory reducer: started GC #%d\n", state_.started_gcs); } - if (heap()->ShouldOptimizeForMemoryUsage()) { - // Do full GC if memory usage has higher priority than latency. This is - // important for background tabs that do not send idle notifications. - heap()->CollectAllGarbage(Heap::kReduceMemoryFootprintMask, - "memory reducer"); - } else { - heap()->StartIdleIncrementalMarking(); - } } else if (state_.action == kWait) { - if (!heap()->incremental_marking()->IsStopped() && - heap()->ShouldOptimizeForMemoryUsage()) { - // Make progress with pending incremental marking if memory usage has - // higher priority than latency. This is important for background tabs - // that do not send idle notifications. - const int kIncrementalMarkingDelayMs = 500; - double deadline = heap()->MonotonicallyIncreasingTimeInMs() + - kIncrementalMarkingDelayMs; - heap()->AdvanceIncrementalMarking( - 0, deadline, i::IncrementalMarking::StepActions( - i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, - i::IncrementalMarking::FORCE_MARKING, - i::IncrementalMarking::FORCE_COMPLETION)); - heap()->FinalizeIncrementalMarkingIfComplete( - "Memory reducer: finalize incremental marking"); - } // Re-schedule the timer. ScheduleTimer(state_.next_gc_start_ms - event.time_ms); if (FLAG_trace_gc_verbose) { diff --git a/deps/v8/src/preparser.h b/deps/v8/src/preparser.h index 9ebc132d92..d9ef1ea31e 100644 --- a/deps/v8/src/preparser.h +++ b/deps/v8/src/preparser.h @@ -2939,6 +2939,7 @@ ParserBase<Traits>::ParseConditionalExpression(bool accept_IN, ExpressionT expression = this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); if (peek() != Token::CONDITIONAL) return expression; + ArrowFormalParametersUnexpectedToken(classifier); BindingPatternUnexpectedToken(classifier); Consume(Token::CONDITIONAL); // In parsing the first assignment expression in conditional @@ -2964,6 +2965,7 @@ ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, // prec1 >= 4 while (Precedence(peek(), accept_IN) == prec1) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Token::Value op = Next(); Scanner::Location op_location = scanner()->location(); int pos = position(); @@ -3026,6 +3028,7 @@ ParserBase<Traits>::ParseUnaryExpression(ExpressionClassifier* classifier, Token::Value op = peek(); if (Token::IsUnaryOp(op)) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); op = Next(); int pos = position(); @@ -3048,6 +3051,7 @@ ParserBase<Traits>::ParseUnaryExpression(ExpressionClassifier* classifier, return this->BuildUnaryExpression(expression, op, pos, factory()); } else if (Token::IsCountOp(op)) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); op = Next(); Scanner::Location lhs_location = scanner()->peek_location(); ExpressionT expression = this->ParseUnaryExpression(classifier, CHECK_OK); @@ -3080,6 +3084,7 @@ ParserBase<Traits>::ParsePostfixExpression(ExpressionClassifier* classifier, if (!scanner()->HasAnyLineTerminatorBeforeNext() && Token::IsCountOp(peek())) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); expression = this->CheckAndRewriteReferenceExpression( expression, lhs_location, MessageTemplate::kInvalidLhsInPostfixOp, @@ -3111,6 +3116,7 @@ ParserBase<Traits>::ParseLeftHandSideExpression( switch (peek()) { case Token::LBRACK: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::LBRACK); int pos = position(); ExpressionT index = ParseExpression(true, classifier, CHECK_OK); @@ -3121,6 +3127,7 @@ ParserBase<Traits>::ParseLeftHandSideExpression( case Token::LPAREN: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); if (is_strong(language_mode()) && this->IsIdentifier(result) && this->IsEval(this->AsIdentifier(result))) { @@ -3172,6 +3179,7 @@ ParserBase<Traits>::ParseLeftHandSideExpression( case Token::PERIOD: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::PERIOD); int pos = position(); IdentifierT name = ParseIdentifierName(CHECK_OK); @@ -3184,6 +3192,7 @@ ParserBase<Traits>::ParseLeftHandSideExpression( case Token::TEMPLATE_SPAN: case Token::TEMPLATE_TAIL: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); break; } @@ -3221,6 +3230,7 @@ ParserBase<Traits>::ParseMemberWithNewPrefixesExpression( if (peek() == Token::NEW) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::NEW); int new_pos = position(); ExpressionT result = this->EmptyExpression(); @@ -3274,6 +3284,7 @@ ParserBase<Traits>::ParseMemberExpression(ExpressionClassifier* classifier, ExpressionT result = this->EmptyExpression(); if (peek() == Token::FUNCTION) { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::FUNCTION); int function_token_position = position(); @@ -3523,6 +3534,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation( switch (peek()) { case Token::LBRACK: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::LBRACK); int pos = position(); @@ -3536,6 +3548,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation( } case Token::PERIOD: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); Consume(Token::PERIOD); int pos = position(); @@ -3550,6 +3563,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation( case Token::TEMPLATE_SPAN: case Token::TEMPLATE_TAIL: { BindingPatternUnexpectedToken(classifier); + ArrowFormalParametersUnexpectedToken(classifier); int pos; if (scanner()->current_token() == Token::IDENTIFIER) { pos = position(); diff --git a/deps/v8/src/startup-data-util.cc b/deps/v8/src/startup-data-util.cc index 1b2f7ed7e9..92c4b5b3e9 100644 --- a/deps/v8/src/startup-data-util.cc +++ b/deps/v8/src/startup-data-util.cc @@ -8,66 +8,41 @@ #include <string.h> #include "src/base/logging.h" +#include "src/base/platform/platform.h" namespace v8 { +namespace internal { #ifdef V8_USE_EXTERNAL_STARTUP_DATA -StartupDataHandler::StartupDataHandler(const char* exec_path, - const char* natives_blob, - const char* snapshot_blob) { - // If we have (at least one) explicitly given blob, use those. - // If not, use the default blob locations next to the d8 binary. - if (natives_blob || snapshot_blob) { - LoadFromFiles(natives_blob, snapshot_blob); - } else { - char* natives; - char* snapshot; - LoadFromFiles(RelativePath(&natives, exec_path, "natives_blob.bin"), - RelativePath(&snapshot, exec_path, "snapshot_blob.bin")); +namespace { - free(natives); - free(snapshot); - } -} +v8::StartupData g_natives; +v8::StartupData g_snapshot; -StartupDataHandler::~StartupDataHandler() { - delete[] natives_.data; - delete[] snapshot_.data; +void ClearStartupData(v8::StartupData* data) { + data->data = nullptr; + data->raw_size = 0; } -char* StartupDataHandler::RelativePath(char** buffer, const char* exec_path, - const char* name) { - DCHECK(exec_path); - const char* last_slash = strrchr(exec_path, '/'); - if (last_slash) { - int after_slash = static_cast<int>(last_slash - exec_path + 1); - int name_length = static_cast<int>(strlen(name)); - *buffer = reinterpret_cast<char*>(calloc(after_slash + name_length + 1, 1)); - strncpy(*buffer, exec_path, after_slash); - strncat(*buffer, name, name_length); - } else { - *buffer = strdup(name); - } - return *buffer; +void DeleteStartupData(v8::StartupData* data) { + delete[] data->data; + ClearStartupData(data); } -void StartupDataHandler::LoadFromFiles(const char* natives_blob, - const char* snapshot_blob) { - Load(natives_blob, &natives_, v8::V8::SetNativesDataBlob); - Load(snapshot_blob, &snapshot_, v8::V8::SetSnapshotDataBlob); +void FreeStartupData() { + DeleteStartupData(&g_natives); + DeleteStartupData(&g_snapshot); } -void StartupDataHandler::Load(const char* blob_file, - v8::StartupData* startup_data, - void (*setter_fn)(v8::StartupData*)) { - startup_data->data = NULL; - startup_data->raw_size = 0; +void Load(const char* blob_file, v8::StartupData* startup_data, + void (*setter_fn)(v8::StartupData*)) { + ClearStartupData(startup_data); if (!blob_file) return; @@ -86,6 +61,57 @@ void StartupDataHandler::Load(const char* blob_file, if (startup_data->raw_size == read_size) (*setter_fn)(startup_data); } + +void LoadFromFiles(const char* natives_blob, const char* snapshot_blob) { + Load(natives_blob, &g_natives, v8::V8::SetNativesDataBlob); + Load(snapshot_blob, &g_snapshot, v8::V8::SetSnapshotDataBlob); + + atexit(&FreeStartupData); +} + + +char* RelativePath(char** buffer, const char* exec_path, const char* name) { + DCHECK(exec_path); + int path_separator = static_cast<int>(strlen(exec_path)) - 1; + while (path_separator >= 0 && + !base::OS::isDirectorySeparator(exec_path[path_separator])) { + path_separator--; + } + if (path_separator >= 0) { + int name_length = static_cast<int>(strlen(name)); + *buffer = + reinterpret_cast<char*>(calloc(path_separator + name_length + 2, 1)); + *buffer[0] = '\0'; + strncat(*buffer, exec_path, path_separator + 1); + strncat(*buffer, name, name_length); + } else { + *buffer = strdup(name); + } + return *buffer; +} + +} // namespace #endif // V8_USE_EXTERNAL_STARTUP_DATA + +void InitializeExternalStartupData(const char* directory_path) { +#ifdef V8_USE_EXTERNAL_STARTUP_DATA + char* natives; + char* snapshot; + LoadFromFiles(RelativePath(&natives, directory_path, "natives_blob.bin"), + RelativePath(&snapshot, directory_path, "snapshot_blob.bin")); + free(natives); + free(snapshot); +#endif // V8_USE_EXTERNAL_STARTUP_DATA +} + + +void InitializeExternalStartupData(const char* natives_blob, + const char* snapshot_blob) { +#ifdef V8_USE_EXTERNAL_STARTUP_DATA + LoadFromFiles(natives_blob, snapshot_blob); +#endif // V8_USE_EXTERNAL_STARTUP_DATA +} + +} // namespace internal } // namespace v8 diff --git a/deps/v8/src/startup-data-util.h b/deps/v8/src/startup-data-util.h index 79b4171343..7cb51e362a 100644 --- a/deps/v8/src/startup-data-util.h +++ b/deps/v8/src/startup-data-util.h @@ -9,43 +9,21 @@ #include "include/v8.h" namespace v8 { +namespace internal { -#ifdef V8_USE_EXTERNAL_STARTUP_DATA -// Helper class to load the startup data files from disk. +// Helper functions to load external startup data. // // This is meant as a convenience for stand-alone binaries like d8, cctest, // unittest. A V8 embedder would likely either handle startup data on their // own or just disable the feature if they don't want to handle it at all, -// while tools like cctest need to work in either configuration. Hence this is -// not meant for inclusion in the general v8 library. -class StartupDataHandler { - public: - // Load startup data, and call the v8::V8::Set*DataBlob API functions. - // - // natives_blob and snapshot_blob will be loaded realitive to exec_path, - // which would usually be the equivalent of argv[0]. - StartupDataHandler(const char* exec_path, const char* natives_blob, - const char* snapshot_blob); - ~StartupDataHandler(); - - private: - static char* RelativePath(char** buffer, const char* exec_path, - const char* name); - - void LoadFromFiles(const char* natives_blob, const char* snapshot_blob); - - void Load(const char* blob_file, v8::StartupData* startup_data, - void (*setter_fn)(v8::StartupData*)); - - v8::StartupData natives_; - v8::StartupData snapshot_; - - // Disallow copy & assign. - StartupDataHandler(const StartupDataHandler& other); - void operator=(const StartupDataHandler& other); -}; -#endif // V8_USE_EXTERNAL_STARTUP_DATA +// while tools like cctest need to work in either configuration. +void InitializeExternalStartupData(const char* directory_path); + +void InitializeExternalStartupData(const char* natives_blob, + const char* snapshot_blob); + +} // namespace internal } // namespace v8 #endif // V8_STARTUP_DATA_UTIL_H_ |