Skip to content
This repository was archived by the owner on Jun 24, 2021. It is now read-only.

Commit ebde48f

Browse files
author
arajkumar
committed
8209049: Cherry pick GTK WebKit 2.20.4 changes
Reviewed-by: kcr, mbilla
1 parent ac23330 commit ebde48f

File tree

73 files changed

+906
-451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+906
-451
lines changed

modules/javafx.web/src/main/java/com/sun/javafx/webkit/prism/WCMediaPlayerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.net.URI;
2929
import java.util.List;
3030

31+
import com.sun.javafx.logging.PlatformLogger;
3132
import com.sun.javafx.media.PrismMediaFrameHandler;
3233
import com.sun.media.jfxmedia.Media;
3334
import com.sun.media.jfxmedia.MediaManager;
@@ -125,7 +126,9 @@ public void run() {
125126
p = MediaManager.getPlayer(locator);
126127
} catch (Exception ex) {
127128
log.warning("CreateThread ERROR: {0}", ex.toString());
128-
ex.printStackTrace(System.out);
129+
if (log.isLoggable(PlatformLogger.Level.FINE)) {
130+
ex.printStackTrace(System.out);
131+
}
129132
onError(this, 0, ex.getMessage());
130133
return;
131134
}

modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ add_executable(LLIntOffsetsExtractor
247247
${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/BytecodeStructs.h
248248
)
249249
target_link_libraries(LLIntOffsetsExtractor WTF)
250+
add_dependencies(LLIntOffsetsExtractor JavaScriptCoreForwardingHeaders)
250251

251252
# The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
252253
# LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization

modules/javafx.web/src/main/native/Source/JavaScriptCore/builtins/BuiltinNames.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ namespace JSC {
8383
macro(typedArrayGetOriginalConstructor) \
8484
macro(typedArraySubarrayCreate) \
8585
macro(BuiltinLog) \
86+
macro(BuiltinDescribe) \
8687
macro(homeObject) \
8788
macro(templateRegistryKey) \
8889
macro(enqueueJob) \

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/CodeBlock.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,9 +1241,7 @@ void CodeBlock::finalizeLLIntInlineCaches()
12411241
for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) {
12421242
Instruction* curInstruction = &instructions()[propertyAccessInstructions[i]];
12431243
switch (Interpreter::getOpcodeID(curInstruction[0])) {
1244-
case op_get_by_id:
1245-
case op_get_by_id_proto_load:
1246-
case op_get_by_id_unset: {
1244+
case op_get_by_id: {
12471245
StructureID oldStructureID = curInstruction[4].u.structureID;
12481246
if (!oldStructureID || Heap::isMarked(vm.heap.structureIDTable().get(oldStructureID)))
12491247
break;
@@ -1282,6 +1280,8 @@ void CodeBlock::finalizeLLIntInlineCaches()
12821280
// We need to add optimizations for op_resolve_scope_for_hoisting_func_decl_in_eval to do link time scope resolution.
12831281
case op_resolve_scope_for_hoisting_func_decl_in_eval:
12841282
break;
1283+
case op_get_by_id_proto_load:
1284+
case op_get_by_id_unset:
12851285
case op_get_array_length:
12861286
break;
12871287
case op_to_this:
@@ -1339,8 +1339,27 @@ void CodeBlock::finalizeLLIntInlineCaches()
13391339

13401340
// We can't just remove all the sets when we clear the caches since we might have created a watchpoint set
13411341
// then cleared the cache without GCing in between.
1342-
m_llintGetByIdWatchpointMap.removeIf([](const StructureWatchpointMap::KeyValuePairType& pair) -> bool {
1343-
return !Heap::isMarked(pair.key);
1342+
m_llintGetByIdWatchpointMap.removeIf([&] (const StructureWatchpointMap::KeyValuePairType& pair) -> bool {
1343+
auto clear = [&] () {
1344+
Instruction* instruction = std::get<1>(pair.key);
1345+
OpcodeID opcode = Interpreter::getOpcodeID(*instruction);
1346+
if (opcode == op_get_by_id_proto_load || opcode == op_get_by_id_unset) {
1347+
if (Options::verboseOSR())
1348+
dataLogF("Clearing LLInt property access.\n");
1349+
clearLLIntGetByIdCache(instruction);
1350+
}
1351+
return true;
1352+
};
1353+
1354+
if (!Heap::isMarked(std::get<0>(pair.key)))
1355+
return clear();
1356+
1357+
for (const LLIntPrototypeLoadAdaptiveStructureWatchpoint* watchpoint : pair.value) {
1358+
if (!watchpoint->key().isStillLive())
1359+
return clear();
1360+
}
1361+
1362+
return false;
13441363
});
13451364

13461365
for (unsigned i = 0; i < m_llintCallLinkInfos.size(); ++i) {

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/CodeBlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class CodeBlock : public JSCell {
625625
return m_llintExecuteCounter;
626626
}
627627

628-
typedef HashMap<Structure*, Bag<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> StructureWatchpointMap;
628+
typedef HashMap<std::tuple<Structure*, Instruction*>, Bag<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> StructureWatchpointMap;
629629
StructureWatchpointMap& llintGetByIdWatchpointMap() { return m_llintGetByIdWatchpointMap; }
630630

631631
// Functions for controlling when tiered compilation kicks in. This

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,19 @@ namespace JSC {
3333

3434
class LLIntPrototypeLoadAdaptiveStructureWatchpoint : public Watchpoint {
3535
public:
36+
LLIntPrototypeLoadAdaptiveStructureWatchpoint() = default;
3637
LLIntPrototypeLoadAdaptiveStructureWatchpoint(const ObjectPropertyCondition&, Instruction*);
3738

3839
void install();
3940

41+
const ObjectPropertyCondition& key() const { return m_key; }
42+
4043
protected:
4144
void fireInternal(const FireDetail&) override;
4245

4346
private:
4447
ObjectPropertyCondition m_key;
45-
Instruction* m_getByIdInstruction;
48+
Instruction* m_getByIdInstruction { nullptr };
4649
};
4750

4851
} // namespace JSC

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/ObjectPropertyConditionSet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ObjectPropertyConditionSet {
6868

6969
bool isValidAndWatchable() const;
7070

71+
size_t size() const { return m_data ? m_data->vector.size() : 0; }
7172
bool isEmpty() const
7273
{
7374
return !m_data;

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/Watchpoint.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ void WatchpointSet::fireAllSlow(VM& vm, const FireDetail& detail)
9292
WTF::storeStoreFence();
9393
}
9494

95+
void WatchpointSet::fireAllSlow(VM&, DeferredWatchpointFire* deferredWatchpoints)
96+
{
97+
ASSERT(state() == IsWatched);
98+
99+
WTF::storeStoreFence();
100+
deferredWatchpoints->takeWatchpointsToFire(this);
101+
m_state = IsInvalidated; // Do after moving watchpoints to deferredWatchpoints so deferredWatchpoints gets our current state.
102+
WTF::storeStoreFence();
103+
}
104+
95105
void WatchpointSet::fireAllSlow(VM& vm, const char* reason)
96106
{
97107
fireAllSlow(vm, StringFireDetail(reason));
@@ -133,6 +143,15 @@ void WatchpointSet::fireAllWatchpoints(VM& vm, const FireDetail& detail)
133143
}
134144
}
135145

146+
void WatchpointSet::take(WatchpointSet* other)
147+
{
148+
ASSERT(state() == ClearWatchpoint);
149+
m_set.takeFrom(other->m_set);
150+
m_setIsNotEmpty = other->m_setIsNotEmpty;
151+
m_state = other->m_state;
152+
other->m_setIsNotEmpty = false;
153+
}
154+
136155
void InlineWatchpointSet::add(Watchpoint* watchpoint)
137156
{
138157
inflate()->add(watchpoint);
@@ -159,5 +178,28 @@ void InlineWatchpointSet::freeFat()
159178
fat()->deref();
160179
}
161180

181+
DeferredWatchpointFire::DeferredWatchpointFire(VM& vm)
182+
: m_vm(vm)
183+
, m_watchpointsToFire(ClearWatchpoint)
184+
{
185+
}
186+
187+
DeferredWatchpointFire::~DeferredWatchpointFire()
188+
{
189+
}
190+
191+
void DeferredWatchpointFire::fireAll()
192+
{
193+
if (m_watchpointsToFire.state() == IsWatched)
194+
m_watchpointsToFire.fireAll(m_vm, *this);
195+
}
196+
197+
void DeferredWatchpointFire::takeWatchpointsToFire(WatchpointSet* watchpointsToFire)
198+
{
199+
ASSERT(m_watchpointsToFire.state() == ClearWatchpoint);
200+
ASSERT(watchpointsToFire->state() == IsWatched);
201+
m_watchpointsToFire.take(watchpointsToFire);
202+
}
203+
162204
} // namespace JSC
163205

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecode/Watchpoint.h

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ class Watchpoint : public BasicRawSentinelNode<Watchpoint> {
6868
WTF_MAKE_NONCOPYABLE(Watchpoint);
6969
WTF_MAKE_FAST_ALLOCATED;
7070
public:
71-
Watchpoint()
72-
{
73-
}
71+
Watchpoint() = default;
7472

7573
virtual ~Watchpoint();
7674

@@ -89,10 +87,12 @@ enum WatchpointState {
8987
};
9088

9189
class InlineWatchpointSet;
90+
class DeferredWatchpointFire;
9291
class VM;
9392

9493
class WatchpointSet : public ThreadSafeRefCounted<WatchpointSet> {
9594
friend class LLIntOffsetsExtractor;
95+
friend class DeferredWatchpointFire;
9696
public:
9797
JS_EXPORT_PRIVATE WatchpointSet(WatchpointState);
9898

@@ -159,6 +159,13 @@ class WatchpointSet : public ThreadSafeRefCounted<WatchpointSet> {
159159
fireAllSlow(vm, detail);
160160
}
161161

162+
void fireAll(VM& vm, DeferredWatchpointFire* deferredWatchpoints)
163+
{
164+
if (LIKELY(m_state != IsWatched))
165+
return;
166+
fireAllSlow(vm, deferredWatchpoints);
167+
}
168+
162169
void fireAll(VM& vm, const char* reason)
163170
{
164171
if (LIKELY(m_state != IsWatched))
@@ -201,10 +208,12 @@ class WatchpointSet : public ThreadSafeRefCounted<WatchpointSet> {
201208
int8_t* addressOfSetIsNotEmpty() { return &m_setIsNotEmpty; }
202209

203210
JS_EXPORT_PRIVATE void fireAllSlow(VM&, const FireDetail&); // Call only if you've checked isWatched.
211+
JS_EXPORT_PRIVATE void fireAllSlow(VM&, DeferredWatchpointFire* deferredWatchpoints);
204212
JS_EXPORT_PRIVATE void fireAllSlow(VM&, const char* reason); // Ditto.
205213

206214
private:
207215
void fireAllWatchpoints(VM&, const FireDetail&);
216+
void take(WatchpointSet* other);
208217

209218
friend class InlineWatchpointSet;
210219

@@ -308,6 +317,18 @@ class InlineWatchpointSet {
308317
WTF::storeStoreFence();
309318
}
310319

320+
void fireAll(VM& vm, DeferredWatchpointFire* deferred)
321+
{
322+
if (isFat()) {
323+
fat()->fireAll(vm, deferred);
324+
return;
325+
}
326+
if (decodeState(m_data) == ClearWatchpoint)
327+
return;
328+
m_data = encodeState(IsInvalidated);
329+
WTF::storeStoreFence();
330+
}
331+
311332
void invalidate(VM& vm, const FireDetail& detail)
312333
{
313334
if (isFat())
@@ -435,4 +456,19 @@ class InlineWatchpointSet {
435456
uintptr_t m_data;
436457
};
437458

459+
class DeferredWatchpointFire : public FireDetail {
460+
WTF_MAKE_NONCOPYABLE(DeferredWatchpointFire);
461+
public:
462+
JS_EXPORT_PRIVATE DeferredWatchpointFire(VM&);
463+
JS_EXPORT_PRIVATE ~DeferredWatchpointFire();
464+
465+
JS_EXPORT_PRIVATE void takeWatchpointsToFire(WatchpointSet*);
466+
JS_EXPORT_PRIVATE void fireAll();
467+
468+
void dump(PrintStream& out) const override = 0;
469+
private:
470+
VM& m_vm;
471+
WatchpointSet m_watchpointsToFire;
472+
};
473+
438474
} // namespace JSC

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2008-2017 Apple Inc. All rights reserved.
2+
* Copyright (C) 2008-2018 Apple Inc. All rights reserved.
33
* Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
44
* Copyright (C) 2012 Igalia, S.L.
55
*
@@ -3114,6 +3114,16 @@ void BytecodeGenerator::getVariablesUnderTDZ(VariableEnvironment& result)
31143114
}
31153115
}
31163116

3117+
void BytecodeGenerator::preserveTDZStack(BytecodeGenerator::PreservedTDZStack& preservedStack)
3118+
{
3119+
preservedStack.m_preservedTDZStack = m_TDZStack;
3120+
}
3121+
3122+
void BytecodeGenerator::restoreTDZStack(const BytecodeGenerator::PreservedTDZStack& preservedStack)
3123+
{
3124+
m_TDZStack = preservedStack.m_preservedTDZStack;
3125+
}
3126+
31173127
RegisterID* BytecodeGenerator::emitNewObject(RegisterID* dst)
31183128
{
31193129
size_t begin = instructions().size();

0 commit comments

Comments
 (0)