Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: V8: cherry-pick ac0fe8ec from upstream #17695

Merged
merged 1 commit into from
Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.4',
'v8_embedder_string': '-node.5',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/arm/builtins-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -782,22 +782,15 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ cmp(
optimized_code_entry,
Operand(Smi::FromEnum(OptimizationMarker::kInOptimizationQueue)));
__ Assert(eq, kExpectedOptimizationSentinel);
}
// Checking whether the queued function is ready for install is
// optional, since we come across interrupts and stack checks elsewhere.
// However, not checking may delay installing ready functions, and
// always checking would be quite expensive. A good compromise is to
// first check against stack limit as a cue for an interrupt signal.
__ LoadRoot(scratch2, Heap::kStackLimitRootIndex);
__ cmp(sp, Operand(scratch2));
__ b(hs, &fallthrough);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ jmp(&fallthrough);
}
}

Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/arm64/builtins-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,22 +788,15 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ Cmp(
optimized_code_entry,
Operand(Smi::FromEnum(OptimizationMarker::kInOptimizationQueue)));
__ Assert(eq, kExpectedOptimizationSentinel);
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex);
__ B(hs, &fallthrough);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ B(&fallthrough);
}
}

Expand Down
15 changes: 3 additions & 12 deletions deps/v8/src/builtins/ia32/builtins-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,24 +698,15 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ cmp(
optimized_code_entry,
Immediate(Smi::FromEnum(OptimizationMarker::kInOptimizationQueue)));
__ Assert(equal, kExpectedOptimizationSentinel);
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
ExternalReference stack_limit =
ExternalReference::address_of_stack_limit(masm->isolate());
__ cmp(esp, Operand::StaticVariable(stack_limit));
__ j(above_equal, &fallthrough);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ jmp(&fallthrough);
}
}

Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/mips/builtins-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,21 +760,14 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ Assert(
eq, kExpectedOptimizationSentinel, optimized_code_entry,
Operand(Smi::FromEnum(OptimizationMarker::kInOptimizationQueue)));
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ LoadRoot(at, Heap::kStackLimitRootIndex);
__ Branch(&fallthrough, hs, sp, Operand(at));
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ jmp(&fallthrough);
}
}

Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/mips64/builtins-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,21 +760,14 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ Assert(
eq, kExpectedOptimizationSentinel, optimized_code_entry,
Operand(Smi::FromEnum(OptimizationMarker::kInOptimizationQueue)));
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ LoadRoot(t0, Heap::kStackLimitRootIndex);
__ Branch(&fallthrough, hs, sp, Operand(t0));
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ jmp(&fallthrough);
}
}

Expand Down
14 changes: 3 additions & 11 deletions deps/v8/src/builtins/ppc/builtins-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -780,23 +780,15 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ CmpSmiLiteral(
optimized_code_entry,
Smi::FromEnum(OptimizationMarker::kInOptimizationQueue), r0);
__ Assert(eq, kExpectedOptimizationSentinel);
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ LoadRoot(ip, Heap::kStackLimitRootIndex);
__ cmpl(sp, ip);
__ bge(&fallthrough);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ b(&fallthrough);
}
}

Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/s390/builtins-s390.cc
Original file line number Diff line number Diff line change
Expand Up @@ -783,22 +783,15 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ CmpSmiLiteral(
optimized_code_entry,
Smi::FromEnum(OptimizationMarker::kInOptimizationQueue), r0);
__ Assert(eq, kExpectedOptimizationSentinel);
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ CmpLogicalP(sp, RootMemOperand(Heap::kStackLimitRootIndex));
__ bge(&fallthrough, Label::kNear);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ b(&fallthrough, Label::kNear);
}
}

Expand Down
13 changes: 3 additions & 10 deletions deps/v8/src/builtins/x64/builtins-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -781,21 +781,14 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
Runtime::kCompileOptimized_Concurrent);

{
// Otherwise, the marker is InOptimizationQueue.
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
if (FLAG_debug_code) {
__ SmiCompare(optimized_code_entry,
Smi::FromEnum(OptimizationMarker::kInOptimizationQueue));
__ Assert(equal, kExpectedOptimizationSentinel);
}

// Checking whether the queued function is ready for install is optional,
// since we come across interrupts and stack checks elsewhere. However,
// not checking may delay installing ready functions, and always checking
// would be quite expensive. A good compromise is to first check against
// stack limit as a cue for an interrupt signal.
__ CompareRoot(rsp, Heap::kStackLimitRootIndex);
__ j(above_equal, &fallthrough);
GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode);
__ jmp(&fallthrough);
}
}

Expand Down
21 changes: 0 additions & 21 deletions deps/v8/src/runtime/runtime-compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,27 +302,6 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
return NULL;
}


RUNTIME_FUNCTION(Runtime_TryInstallOptimizedCode) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);

// First check if this is a real stack overflow.
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
return isolate->StackOverflow();
}

// Only try to install optimized functions if the interrupt was InstallCode.
if (isolate->stack_guard()->CheckAndClearInstallCode()) {
isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
}

return (function->IsOptimized()) ? function->code()
: function->shared()->code();
}

static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
Handle<SharedFunctionInfo> outer_info,
LanguageMode language_mode,
Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ namespace internal {
F(NotifyStubFailure, 0, 1) \
F(NotifyDeoptimized, 0, 1) \
F(CompileForOnStackReplacement, 1, 1) \
F(TryInstallOptimizedCode, 1, 1) \
F(ResolvePossiblyDirectEval, 6, 1) \
F(InstantiateAsmJs, 4, 1)

Expand Down