Skip to content

Commit

Permalink
deps: upgrade V8 to 4.5.103.30
Browse files Browse the repository at this point in the history
Pick up v8/v8@f9a0a16
Commit log at https://chromium.googlesource.com/v8/v8.git/+log/branch-heads/4.5

PR-URL: nodejs#2632
Reviewed-By: targos - Michaël Zasso <[email protected]>
Reviewed-By: rvagg - Rod Vagg <[email protected]>
  • Loading branch information
ofrobots authored and rvagg committed Sep 4, 2015
1 parent 7df8e62 commit c39ab6d
Show file tree
Hide file tree
Showing 25 changed files with 210 additions and 147 deletions.
4 changes: 2 additions & 2 deletions deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ source_set("v8_base") {
"src/splay-tree.h",
"src/splay-tree-inl.h",
"src/snapshot/snapshot.h",
"src/startup-data-util.h",
"src/startup-data-util.cc",
"src/string-builder.cc",
"src/string-builder.h",
"src/string-search.cc",
Expand Down Expand Up @@ -1678,8 +1680,6 @@ if ((current_toolchain == host_toolchain && v8_toolset_for_d8 == "host") ||
sources = [
"src/d8.cc",
"src/d8.h",
"src/startup-data-util.h",
"src/startup-data-util.cc",
]

configs -= [ "//build/config/compiler:chromium_code" ]
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 103
#define V8_PATCH_LEVEL 24
#define V8_PATCH_LEVEL 30

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
19 changes: 19 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -6247,6 +6247,25 @@ class V8_EXPORT V8 {
*/
static bool InitializeICU(const char* icu_data_file = NULL);

/**
* Initialize the external startup data. The embedder only needs to
* invoke this method when external startup data was enabled in a build.
*
* If V8 was compiled with the startup data in an external file, then
* V8 needs to be given those external files during startup. There are
* three ways to do this:
* - InitializeExternalStartupData(const char*)
* This will look in the given directory for files "natives_blob.bin"
* and "snapshot_blob.bin" - which is what the default build calls them.
* - InitializeExternalStartupData(const char*, const char*)
* As above, but will directly use the two given file names.
* - Call SetNativesDataBlob, SetNativesDataBlob.
* This will read the blobs from the given data structures and will
* not perform any file IO.
*/
static void InitializeExternalStartupData(const char* directory_path);
static void InitializeExternalStartupData(const char* natives_blob,
const char* snapshot_blob);
/**
* Sets the v8::Platform to use. This should be invoked before V8 is
* initialized.
Expand Down
1 change: 1 addition & 0 deletions deps/v8/samples/hello-world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
int main(int argc, char* argv[]) {
// Initialize V8.
V8::InitializeICU();
V8::InitializeExternalStartupData(argv[0]);
Platform* platform = platform::CreateDefaultPlatform();
V8::InitializePlatform(platform);
V8::Initialize();
Expand Down
1 change: 1 addition & 0 deletions deps/v8/samples/process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ void PrintMap(map<string, string>* m) {

int main(int argc, char* argv[]) {
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData(argv[0]);
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
Expand Down
1 change: 1 addition & 0 deletions deps/v8/samples/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {

int main(int argc, char* argv[]) {
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData(argv[0]);
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/arm/assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/arm64/assembler-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/base/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 6 additions & 8 deletions deps/v8/src/d8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions deps/v8/src/d8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
'sources': [
'd8.h',
'd8.cc',
'startup-data-util.h',
'startup-data-util.cc'
],
'conditions': [
[ 'want_separate_host_toolset==1', {
Expand Down
13 changes: 0 additions & 13 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.

Expand Down
25 changes: 1 addition & 24 deletions deps/v8/src/heap/memory-reducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions deps/v8/src/preparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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))) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -3523,6 +3534,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation(
switch (peek()) {
case Token::LBRACK: {
BindingPatternUnexpectedToken(classifier);
ArrowFormalParametersUnexpectedToken(classifier);

Consume(Token::LBRACK);
int pos = position();
Expand All @@ -3536,6 +3548,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation(
}
case Token::PERIOD: {
BindingPatternUnexpectedToken(classifier);
ArrowFormalParametersUnexpectedToken(classifier);

Consume(Token::PERIOD);
int pos = position();
Expand All @@ -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();
Expand Down
Loading

0 comments on commit c39ab6d

Please sign in to comment.