Skip to content

Commit 245ac30

Browse files
committed
deps: update V8 to 5.1.281.75
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 <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent b9b49ee commit 245ac30

File tree

10 files changed

+102
-18
lines changed

10 files changed

+102
-18
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 281
14-
#define V8_PATCH_LEVEL 69
14+
#define V8_PATCH_LEVEL 75
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/include/v8.h

+9
Original file line numberDiff line numberDiff line change
@@ -3241,6 +3241,7 @@ class PropertyCallbackInfo {
32413241

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

3244+
enum class ConstructorBehavior { kThrow, kAllow };
32443245

32453246
/**
32463247
* A JavaScript function object (ECMA-262, 15.3).
@@ -3255,6 +3256,11 @@ class V8_EXPORT Function : public Object {
32553256
FunctionCallback callback,
32563257
Local<Value> data = Local<Value>(),
32573258
int length = 0);
3259+
static MaybeLocal<Function> New(Local<Context> context,
3260+
FunctionCallback callback,
3261+
Local<Value> data,
3262+
int length,
3263+
ConstructorBehavior behavior);
32583264
static V8_DEPRECATE_SOON(
32593265
"Use maybe version",
32603266
Local<Function> New(Isolate* isolate, FunctionCallback callback,
@@ -4478,6 +4484,9 @@ class V8_EXPORT FunctionTemplate : public Template {
44784484
Isolate* isolate, FunctionCallback callback = 0,
44794485
Local<Value> data = Local<Value>(),
44804486
Local<Signature> signature = Local<Signature>(), int length = 0);
4487+
static Local<FunctionTemplate> New(
4488+
Isolate* isolate, FunctionCallback callback, Local<Value> data,
4489+
Local<Signature> signature, int length, ConstructorBehavior behavior);
44814490

44824491
/**
44834492
* Creates a function template with a fast handler. If a fast handler is set,

deps/v8/src/api.cc

+24-6
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,26 @@ Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
11531153
v8::Local<Value> data,
11541154
v8::Local<Signature> signature,
11551155
int length) {
1156+
return New(
1157+
isolate, callback, data, signature, length, ConstructorBehavior::kAllow);
1158+
}
1159+
1160+
Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
1161+
FunctionCallback callback,
1162+
v8::Local<Value> data,
1163+
v8::Local<Signature> signature,
1164+
int length,
1165+
ConstructorBehavior behavior) {
11561166
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
11571167
// Changes to the environment cannot be captured in the snapshot. Expect no
11581168
// function templates when the isolate is created for serialization.
11591169
DCHECK(!i_isolate->serializer_enabled());
11601170
LOG_API(i_isolate, "FunctionTemplate::New");
11611171
ENTER_V8(i_isolate);
1162-
return FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
1163-
length, false);
1172+
auto tmpl = FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
1173+
length, false);
1174+
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
1175+
return tmpl;
11641176
}
11651177

11661178

@@ -4449,15 +4461,21 @@ Local<v8::Value> Object::CallAsConstructor(int argc,
44494461
MaybeLocal<Function> Function::New(Local<Context> context,
44504462
FunctionCallback callback, Local<Value> data,
44514463
int length) {
4464+
return New(context, callback, data, length, ConstructorBehavior::kAllow);
4465+
}
4466+
4467+
MaybeLocal<Function> Function::New(Local<Context> context,
4468+
FunctionCallback callback, Local<Value> data,
4469+
int length, ConstructorBehavior behavior) {
44524470
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
44534471
LOG_API(isolate, "Function::New");
44544472
ENTER_V8(isolate);
4455-
return FunctionTemplateNew(isolate, callback, nullptr, data,
4456-
Local<Signature>(), length, true)
4457-
->GetFunction(context);
4473+
auto tmpl = FunctionTemplateNew(isolate, callback, nullptr, data,
4474+
Local<Signature>(), length, true);
4475+
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
4476+
return tmpl->GetFunction(context);
44584477
}
44594478

4460-
44614479
Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback,
44624480
Local<Value> data, int length) {
44634481
return Function::New(v8_isolate->GetCurrentContext(), callback, data, length)

deps/v8/src/compiler/js-create-lowering.cc

+3
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ Reduction JSCreateLowering::ReduceNewArray(Node* node, Node* length,
471471
PretenureFlag pretenure = site->GetPretenureMode();
472472
ElementsKind elements_kind = site->GetElementsKind();
473473
DCHECK(IsFastElementsKind(elements_kind));
474+
if (NodeProperties::GetType(length)->Max() > 0) {
475+
elements_kind = GetHoleyElementsKind(elements_kind);
476+
}
474477
dependencies()->AssumeTenuringDecision(site);
475478
dependencies()->AssumeTransitionStable(site);
476479

deps/v8/src/crankshaft/hydrogen.cc

+4
Original file line numberDiff line numberDiff line change
@@ -8428,6 +8428,10 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
84288428
TraceInline(target, caller, "parse failure");
84298429
return false;
84308430
}
8431+
if (target_shared->dont_crankshaft()) {
8432+
TraceInline(target, caller, "ParseAndAnalyze found incompatibility");
8433+
return false;
8434+
}
84318435

84328436
if (target_info.scope()->num_heap_slots() > 0) {
84338437
TraceInline(target, caller, "target has context-allocated variables");

deps/v8/src/log.cc

+2-10
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ class PerfBasicLogger : public CodeEventLogger {
242242
static const char kFilenameFormatString[];
243243
static const int kFilenameBufferPadding;
244244

245-
// File buffer size of the low-level log. We don't use the default to
246-
// minimize the associated overhead.
247-
static const int kLogBufferSize = 2 * MB;
248-
249245
FILE* perf_output_handle_;
250246
};
251247

@@ -266,7 +262,7 @@ PerfBasicLogger::PerfBasicLogger()
266262
perf_output_handle_ =
267263
base::OS::FOpen(perf_dump_name.start(), base::OS::LogFileOpenMode);
268264
CHECK_NOT_NULL(perf_output_handle_);
269-
setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
265+
setvbuf(perf_output_handle_, NULL, _IOLBF, 0);
270266
}
271267

272268

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

335-
// File buffer size of the low-level log. We don't use the default to
336-
// minimize the associated overhead.
337-
static const int kLogBufferSize = 2 * MB;
338-
339331
void LogCodeInfo();
340332
void LogWriteBytes(const char* bytes, int size);
341333

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

365357
LogCodeInfo();
366358
}

deps/v8/src/runtime/runtime-scopes.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ RUNTIME_FUNCTION(Runtime_NewRestParameter) {
648648
{
649649
DisallowHeapAllocation no_gc;
650650
FixedArray* elements = FixedArray::cast(result->elements());
651-
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
651+
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
652652
for (int i = 0; i < num_elements; i++) {
653653
elements->set(i, *arguments[i + start_index], mode);
654654
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2014 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --turbo-filter=test2
6+
7+
function test(n) {
8+
return Array(n);
9+
}
10+
11+
function test2() {
12+
return test(2);
13+
}
14+
15+
function test3(a) {
16+
a[0] = 1;
17+
}
18+
19+
test(0);
20+
21+
var smi_array = [1,2];
22+
smi_array[2] = 3;
23+
test3(smi_array);
24+
25+
%OptimizeFunctionOnNextCall(test2);
26+
27+
var broken_array = test2();
28+
test3(broken_array);
29+
1+broken_array[0];

deps/v8/test/mjsunit/mjsunit.status

+8
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,14 @@
758758
'regress/regress-1132': [SKIP],
759759
}], # 'arch == ppc and simulator_run == True'
760760

761+
['arch == ppc64', {
762+
763+
# stack overflow
764+
'big-array-literal': [SKIP],
765+
}], # 'arch == ppc64'
766+
767+
##############################################################################
768+
761769
##############################################################################
762770
['ignition == True', {
763771
# TODO(yangguo,4690): assertion failures in debugger tests.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2016 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax
6+
7+
var test = function() {
8+
var t = Date.now(); // Just any non-constant double value.
9+
var o = {
10+
['p']: 1,
11+
t
12+
};
13+
};
14+
15+
function caller() {
16+
test();
17+
}
18+
caller();
19+
caller();
20+
%OptimizeFunctionOnNextCall(caller);
21+
caller();

0 commit comments

Comments
 (0)