From c5173657c0269ef4b28df29233b80e87c2e542ea Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Thu, 28 Dec 2017 04:56:50 +0100 Subject: [PATCH] no-sse2 patch: More V8 x87 fixes (2) --- ...engine-everywhere-src-5.10.0-no-sse2.patch | 237 ++---------------- 1 file changed, 16 insertions(+), 221 deletions(-) diff --git a/qtwebengine-everywhere-src-5.10.0-no-sse2.patch b/qtwebengine-everywhere-src-5.10.0-no-sse2.patch index c26313e..d65895b 100644 --- a/qtwebengine-everywhere-src-5.10.0-no-sse2.patch +++ b/qtwebengine-everywhere-src-5.10.0-no-sse2.patch @@ -14256,7 +14256,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/regexp/ +chunyang.dai@intel.com diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/regexp/x87/regexp-macro-assembler-x87.cc qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/regexp/x87/regexp-macro-assembler-x87.cc --- qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/regexp/x87/regexp-macro-assembler-x87.cc 1970-01-01 01:00:00.000000000 +0100 -+++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/regexp/x87/regexp-macro-assembler-x87.cc 2017-12-25 17:42:57.217465617 +0100 ++++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/regexp/x87/regexp-macro-assembler-x87.cc 2017-12-28 04:38:12.986938239 +0100 @@ -0,0 +1,1273 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be @@ -15191,7 +15191,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/regexp/ + } + + CodeDesc code_desc; -+ masm_->GetCode(&code_desc); ++ masm_->GetCode(masm_->isolate(), &code_desc); + Handle code = + isolate()->factory()->NewCode(code_desc, + Code::ComputeFlags(Code::REGEXP), @@ -15880,7 +15880,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/v8.gyp 'mips/assembler-mips.cc', diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/assembler-x87.cc qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/assembler-x87.cc --- qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/assembler-x87.cc 1970-01-01 01:00:00.000000000 +0100 -+++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/assembler-x87.cc 2017-12-28 04:12:06.797019766 +0100 ++++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/assembler-x87.cc 2017-12-28 04:40:51.665451092 +0100 @@ -0,0 +1,2258 @@ +// Copyright (c) 1994-2006 Sun Microsystems Inc. +// All Rights Reserved. @@ -18132,7 +18132,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/ass + !serializer_enabled() && !emit_debug_code()) { + return; + } -+ RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); ++ RelocInfo rinfo(pc_, rmode, data, NULL); + reloc_info_writer.Write(&rinfo); +} + @@ -19818,7 +19818,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/ass +#endif // V8_X87_ASSEMBLER_X87_INL_H_ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/codegen-x87.cc qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/codegen-x87.cc --- qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/codegen-x87.cc 1970-01-01 01:00:00.000000000 +0100 -+++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/codegen-x87.cc 2017-12-27 22:01:35.070961553 +0100 ++++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/codegen-x87.cc 2017-12-28 04:52:57.450203610 +0100 @@ -0,0 +1,381 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be @@ -20017,7 +20017,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/cod + MemMoveEmitPopAndReturn(&masm); + + CodeDesc desc; -+ masm.GetCode(&desc); ++ masm.GetCode(isolate, &desc); + DCHECK(!RelocInfo::RequiresRelocation(isolate, desc)); + Assembler::FlushICache(isolate, buffer, actual_size); + base::OS::ProtectCode(buffer, actual_size); @@ -20240,8 +20240,8 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/cod +#endif // V8_X87_CODEGEN_X87_H_ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/code-stubs-x87.cc qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/code-stubs-x87.cc --- qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/code-stubs-x87.cc 1970-01-01 01:00:00.000000000 +0100 -+++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/code-stubs-x87.cc 2017-12-28 03:38:01.563307104 +0100 -@@ -0,0 +1,2873 @@ ++++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/code-stubs-x87.cc 2017-12-28 04:50:57.144052671 +0100 +@@ -0,0 +1,2668 @@ +// Copyright 2012 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. @@ -20993,204 +20993,6 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/cod + __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); +} + -+static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, -+ Register slot) { -+ __ add(FieldOperand(feedback_vector, slot, times_half_pointer_size, -+ FixedArray::kHeaderSize + kPointerSize), -+ Immediate(Smi::FromInt(1))); -+} -+ -+void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { -+ // eax - number of arguments -+ // edi - function -+ // edx - slot id -+ // ebx - vector -+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); -+ __ cmp(edi, ecx); -+ __ j(not_equal, miss); -+ -+ // Reload ecx. -+ __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, -+ FixedArray::kHeaderSize)); -+ -+ // Increment the call count for monomorphic function calls. -+ IncrementCallCount(masm, ebx, edx); -+ -+ __ mov(ebx, ecx); -+ __ mov(edx, edi); -+ ArrayConstructorStub stub(masm->isolate()); -+ __ TailCallStub(&stub); -+ -+ // Unreachable. -+} -+ -+ -+void CallICStub::Generate(MacroAssembler* masm) { -+ // edi - number of arguments -+ // edi - function -+ // edx - slot id -+ // ebx - vector -+ Isolate* isolate = masm->isolate(); -+ Label extra_checks_or_miss, call, call_function, call_count_incremented; -+ -+ // The checks. First, does edi match the recorded monomorphic target? -+ __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, -+ FixedArray::kHeaderSize)); -+ -+ // We don't know that we have a weak cell. We might have a private symbol -+ // or an AllocationSite, but the memory is safe to examine. -+ // AllocationSite::kTransitionInfoOrBoilerplateOffset - contains a Smi or -+ // pointer to FixedArray. WeakCell::kValueOffset - contains a JSFunction or -+ // Smi(0) Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not -+ // computed, meaning that it can't appear to be a pointer. If the low bit is -+ // 0, then hash is computed, but the 0 bit prevents the field from appearing -+ // to be a pointer. -+ STATIC_ASSERT(WeakCell::kSize >= kPointerSize); -+ STATIC_ASSERT(AllocationSite::kTransitionInfoOrBoilerplateOffset == -+ WeakCell::kValueOffset && -+ WeakCell::kValueOffset == Symbol::kHashFieldSlot); -+ -+ __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); -+ __ j(not_equal, &extra_checks_or_miss); -+ -+ // The compare above could have been a SMI/SMI comparison. Guard against this -+ // convincing us that we have a monomorphic JSFunction. -+ __ JumpIfSmi(edi, &extra_checks_or_miss); -+ -+ __ bind(&call_function); -+ -+ // Increment the call count for monomorphic function calls. -+ IncrementCallCount(masm, ebx, edx); -+ -+ __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), -+ tail_call_mode()), -+ RelocInfo::CODE_TARGET); -+ -+ __ bind(&extra_checks_or_miss); -+ Label uninitialized, miss, not_allocation_site; -+ -+ __ cmp(ecx, Immediate(FeedbackVector::MegamorphicSentinel(isolate))); -+ __ j(equal, &call); -+ -+ // Check if we have an allocation site. -+ __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), -+ Heap::kAllocationSiteMapRootIndex); -+ __ j(not_equal, ¬_allocation_site); -+ -+ // We have an allocation site. -+ HandleArrayCase(masm, &miss); -+ -+ __ bind(¬_allocation_site); -+ -+ // The following cases attempt to handle MISS cases without going to the -+ // runtime. -+ if (FLAG_trace_ic) { -+ __ jmp(&miss); -+ } -+ -+ __ cmp(ecx, Immediate(FeedbackVector::UninitializedSentinel(isolate))); -+ __ j(equal, &uninitialized); -+ -+ // We are going megamorphic. If the feedback is a JSFunction, it is fine -+ // to handle it here. More complex cases are dealt with in the runtime. -+ __ AssertNotSmi(ecx); -+ __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); -+ __ j(not_equal, &miss); -+ __ mov( -+ FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), -+ Immediate(FeedbackVector::MegamorphicSentinel(isolate))); -+ -+ __ bind(&call); -+ -+ // Increment the call count for megamorphic function calls. -+ IncrementCallCount(masm, ebx, edx); -+ -+ __ bind(&call_count_incremented); -+ -+ __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), -+ RelocInfo::CODE_TARGET); -+ -+ __ bind(&uninitialized); -+ -+ // We are going monomorphic, provided we actually have a JSFunction. -+ __ JumpIfSmi(edi, &miss); -+ -+ // Goto miss case if we do not have a function. -+ __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); -+ __ j(not_equal, &miss); -+ -+ // Make sure the function is not the Array() function, which requires special -+ // behavior on MISS. -+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); -+ __ cmp(edi, ecx); -+ __ j(equal, &miss); -+ -+ // Make sure the function belongs to the same native context. -+ __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); -+ __ mov(ecx, ContextOperand(ecx, Context::NATIVE_CONTEXT_INDEX)); -+ __ cmp(ecx, NativeContextOperand()); -+ __ j(not_equal, &miss); -+ -+ // Store the function. Use a stub since we need a frame for allocation. -+ // eax - number of arguments -+ // ebx - vector -+ // edx - slot -+ // edi - function -+ { -+ FrameScope scope(masm, StackFrame::INTERNAL); -+ CreateWeakCellStub create_stub(isolate); -+ __ SmiTag(eax); -+ __ push(eax); -+ __ push(ebx); -+ __ push(edx); -+ __ push(edi); -+ __ push(esi); -+ __ CallStub(&create_stub); -+ __ pop(esi); -+ __ pop(edi); -+ __ pop(edx); -+ __ pop(ebx); -+ __ pop(eax); -+ __ SmiUntag(eax); -+ } -+ -+ __ jmp(&call_function); -+ -+ // We are here because tracing is on or we encountered a MISS case we can't -+ // handle here. -+ __ bind(&miss); -+ GenerateMiss(masm); -+ -+ __ jmp(&call_count_incremented); -+ -+ // Unreachable -+ __ int3(); -+} -+ -+ -+void CallICStub::GenerateMiss(MacroAssembler* masm) { -+ FrameScope scope(masm, StackFrame::INTERNAL); -+ -+ // Preserve the number of arguments. -+ __ SmiTag(eax); -+ __ push(eax); -+ -+ // Push the function and feedback info. -+ __ push(edi); -+ __ push(ebx); -+ __ push(edx); -+ -+ // Call the entry. -+ __ CallRuntime(Runtime::kCallIC_Miss); -+ -+ // Move result to edi and exit the internal frame. -+ __ mov(edi, eax); -+ -+ // Restore number of arguments. -+ __ pop(eax); -+ __ SmiUntag(eax); -+} -+ + +bool CEntryStub::NeedsImmovableCode() { + return false; @@ -22962,23 +22764,16 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/cod + // call data + __ push(call_data); + -+ Register scratch = call_data; -+ if (!call_data_undefined()) { -+ // return value -+ __ push(Immediate(masm->isolate()->factory()->undefined_value())); -+ // return value default -+ __ push(Immediate(masm->isolate()->factory()->undefined_value())); -+ } else { -+ // return value -+ __ push(scratch); -+ // return value default -+ __ push(scratch); -+ } ++ // return value ++ __ push(Immediate(masm->isolate()->factory()->undefined_value())); ++ // return value default ++ __ push(Immediate(masm->isolate()->factory()->undefined_value())); + // isolate + __ push(Immediate(reinterpret_cast(masm->isolate()))); + // holder + __ push(holder); + ++ Register scratch = call_data; + __ mov(scratch, esp); + + // push return address @@ -23519,7 +23314,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/cpu +#endif // V8_TARGET_ARCH_X87 diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/deoptimizer-x87.cc qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/deoptimizer-x87.cc --- qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/deoptimizer-x87.cc 1970-01-01 01:00:00.000000000 +0100 -+++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/deoptimizer-x87.cc 2017-12-25 17:42:57.222465544 +0100 ++++ qtwebengine-everywhere-src-5.10.0-no-sse2/src/3rdparty/chromium/v8/src/x87/deoptimizer-x87.cc 2017-12-28 04:55:52.791508679 +0100 @@ -0,0 +1,412 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be @@ -23599,7 +23394,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/deo + new_reloc->GetDataStartAddress() + padding, 0); + intptr_t comment_string + = reinterpret_cast(RelocInfo::kFillerCommentString); -+ RelocInfo rinfo(isolate, 0, RelocInfo::COMMENT, comment_string, NULL); ++ RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); + for (int i = 0; i < additional_comments; ++i) { +#ifdef DEBUG + byte* pos_before = reloc_info_writer.pos(); @@ -23663,7 +23458,7 @@ diff -Nur qtwebengine-everywhere-src-5.10.0/src/3rdparty/chromium/v8/src/x87/deo + Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); + patcher.masm()->call(deopt_entry, RelocInfo::NONE32); + // We use RUNTIME_ENTRY for deoptimization bailouts. -+ RelocInfo rinfo(isolate, call_address + 1, // 1 after the call opcode. ++ RelocInfo rinfo(call_address + 1, // 1 after the call opcode. + RelocInfo::RUNTIME_ENTRY, + reinterpret_cast(deopt_entry), NULL); + reloc_info_writer.Write(&rinfo);