Skip to content

Commit

Permalink
deps: update V8 to 5.1.281.75
Browse files Browse the repository at this point in the history
Pick up the latest branch-head for V8 5.1.  Introduces a semver-minor
overload of v8::Function::New() for use by v8_inspector.

Refs: #7586
PR-URL: #7615
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
bnoordhuis committed Jul 9, 2016
1 parent b9b49ee commit 245ac30
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 18 deletions.
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 5
#define V8_MINOR_VERSION 1
#define V8_BUILD_NUMBER 281
#define V8_PATCH_LEVEL 69
#define V8_PATCH_LEVEL 75

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
9 changes: 9 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,7 @@ class PropertyCallbackInfo {

typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);

enum class ConstructorBehavior { kThrow, kAllow };

/**
* A JavaScript function object (ECMA-262, 15.3).
Expand All @@ -3255,6 +3256,11 @@ class V8_EXPORT Function : public Object {
FunctionCallback callback,
Local<Value> data = Local<Value>(),
int length = 0);
static MaybeLocal<Function> New(Local<Context> context,
FunctionCallback callback,
Local<Value> data,
int length,
ConstructorBehavior behavior);
static V8_DEPRECATE_SOON(
"Use maybe version",
Local<Function> New(Isolate* isolate, FunctionCallback callback,
Expand Down Expand Up @@ -4478,6 +4484,9 @@ class V8_EXPORT FunctionTemplate : public Template {
Isolate* isolate, FunctionCallback callback = 0,
Local<Value> data = Local<Value>(),
Local<Signature> signature = Local<Signature>(), int length = 0);
static Local<FunctionTemplate> New(
Isolate* isolate, FunctionCallback callback, Local<Value> data,
Local<Signature> signature, int length, ConstructorBehavior behavior);

/**
* Creates a function template with a fast handler. If a fast handler is set,
Expand Down
30 changes: 24 additions & 6 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,26 @@ Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
v8::Local<Value> data,
v8::Local<Signature> signature,
int length) {
return New(
isolate, callback, data, signature, length, ConstructorBehavior::kAllow);
}

Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
FunctionCallback callback,
v8::Local<Value> data,
v8::Local<Signature> signature,
int length,
ConstructorBehavior behavior) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
// Changes to the environment cannot be captured in the snapshot. Expect no
// function templates when the isolate is created for serialization.
DCHECK(!i_isolate->serializer_enabled());
LOG_API(i_isolate, "FunctionTemplate::New");
ENTER_V8(i_isolate);
return FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
length, false);
auto tmpl = FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
length, false);
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
return tmpl;
}


Expand Down Expand Up @@ -4449,15 +4461,21 @@ Local<v8::Value> Object::CallAsConstructor(int argc,
MaybeLocal<Function> Function::New(Local<Context> context,
FunctionCallback callback, Local<Value> data,
int length) {
return New(context, callback, data, length, ConstructorBehavior::kAllow);
}

MaybeLocal<Function> Function::New(Local<Context> context,
FunctionCallback callback, Local<Value> data,
int length, ConstructorBehavior behavior) {
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
LOG_API(isolate, "Function::New");
ENTER_V8(isolate);
return FunctionTemplateNew(isolate, callback, nullptr, data,
Local<Signature>(), length, true)
->GetFunction(context);
auto tmpl = FunctionTemplateNew(isolate, callback, nullptr, data,
Local<Signature>(), length, true);
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
return tmpl->GetFunction(context);
}


Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback,
Local<Value> data, int length) {
return Function::New(v8_isolate->GetCurrentContext(), callback, data, length)
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/compiler/js-create-lowering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ Reduction JSCreateLowering::ReduceNewArray(Node* node, Node* length,
PretenureFlag pretenure = site->GetPretenureMode();
ElementsKind elements_kind = site->GetElementsKind();
DCHECK(IsFastElementsKind(elements_kind));
if (NodeProperties::GetType(length)->Max() > 0) {
elements_kind = GetHoleyElementsKind(elements_kind);
}
dependencies()->AssumeTenuringDecision(site);
dependencies()->AssumeTransitionStable(site);

Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/crankshaft/hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8428,6 +8428,10 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
TraceInline(target, caller, "parse failure");
return false;
}
if (target_shared->dont_crankshaft()) {
TraceInline(target, caller, "ParseAndAnalyze found incompatibility");
return false;
}

if (target_info.scope()->num_heap_slots() > 0) {
TraceInline(target, caller, "target has context-allocated variables");
Expand Down
12 changes: 2 additions & 10 deletions deps/v8/src/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ class PerfBasicLogger : public CodeEventLogger {
static const char kFilenameFormatString[];
static const int kFilenameBufferPadding;

// File buffer size of the low-level log. We don't use the default to
// minimize the associated overhead.
static const int kLogBufferSize = 2 * MB;

FILE* perf_output_handle_;
};

Expand All @@ -266,7 +262,7 @@ PerfBasicLogger::PerfBasicLogger()
perf_output_handle_ =
base::OS::FOpen(perf_dump_name.start(), base::OS::LogFileOpenMode);
CHECK_NOT_NULL(perf_output_handle_);
setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
setvbuf(perf_output_handle_, NULL, _IOLBF, 0);
}


Expand Down Expand Up @@ -332,10 +328,6 @@ class LowLevelLogger : public CodeEventLogger {
// Extension added to V8 log file name to get the low-level log name.
static const char kLogExt[];

// File buffer size of the low-level log. We don't use the default to
// minimize the associated overhead.
static const int kLogBufferSize = 2 * MB;

void LogCodeInfo();
void LogWriteBytes(const char* bytes, int size);

Expand All @@ -360,7 +352,7 @@ LowLevelLogger::LowLevelLogger(const char* name)
MemCopy(ll_name.start() + len, kLogExt, sizeof(kLogExt));
ll_output_handle_ =
base::OS::FOpen(ll_name.start(), base::OS::LogFileOpenMode);
setvbuf(ll_output_handle_, NULL, _IOFBF, kLogBufferSize);
setvbuf(ll_output_handle_, NULL, _IOLBF, 0);

LogCodeInfo();
}
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/runtime/runtime-scopes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ RUNTIME_FUNCTION(Runtime_NewRestParameter) {
{
DisallowHeapAllocation no_gc;
FixedArray* elements = FixedArray::cast(result->elements());
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (int i = 0; i < num_elements; i++) {
elements->set(i, *arguments[i + start_index], mode);
}
Expand Down
29 changes: 29 additions & 0 deletions deps/v8/test/mjsunit/compiler/regress-621147.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax --turbo-filter=test2

function test(n) {
return Array(n);
}

function test2() {
return test(2);
}

function test3(a) {
a[0] = 1;
}

test(0);

var smi_array = [1,2];
smi_array[2] = 3;
test3(smi_array);

%OptimizeFunctionOnNextCall(test2);

var broken_array = test2();
test3(broken_array);
1+broken_array[0];
8 changes: 8 additions & 0 deletions deps/v8/test/mjsunit/mjsunit.status
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,14 @@
'regress/regress-1132': [SKIP],
}], # 'arch == ppc and simulator_run == True'

['arch == ppc64', {

# stack overflow
'big-array-literal': [SKIP],
}], # 'arch == ppc64'

##############################################################################

##############################################################################
['ignition == True', {
# TODO(yangguo,4690): assertion failures in debugger tests.
Expand Down
21 changes: 21 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-5033.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax

var test = function() {
var t = Date.now(); // Just any non-constant double value.
var o = {
['p']: 1,
t
};
};

function caller() {
test();
}
caller();
caller();
%OptimizeFunctionOnNextCall(caller);
caller();

0 comments on commit 245ac30

Please sign in to comment.