Changeset 257907 in webkit
- Timestamp:
- Mar 4, 2020, 11:57:21 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r257784 r257907 1 2020-03-04 Mark Lam <mark.lam@apple.com> 2 3 Handle an out of memory error while constructing the BytecodeGenerator. 4 https://bugs.webkit.org/show_bug.cgi?id=208622 5 <rdar://problem/59341136> 6 7 Reviewed by Saam Barati. 8 9 * stress/out-of-memory-while-constructing-BytecodeGenerator.js: Added. 10 1 11 2020-03-03 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r257856 r257907 1 2020-03-04 Mark Lam <mark.lam@apple.com> 2 3 Handle an out of memory error while constructing the BytecodeGenerator. 4 https://bugs.webkit.org/show_bug.cgi?id=208622 5 <rdar://problem/59341136> 6 7 Reviewed by Saam Barati. 8 9 Added the ability to handle out of memory errors encountered during the 10 construction of the BytecodeGenerator. Currently, we only use this for the 11 case where we fail to instantiate a ScopedArgumentsTable. 12 13 * bytecompiler/BytecodeGenerator.cpp: 14 (JSC::BytecodeGenerator::generate): 15 (JSC::BytecodeGenerator::BytecodeGenerator): 16 * bytecompiler/BytecodeGeneratorBase.h: 17 * runtime/ScopedArgumentsTable.cpp: 18 (JSC::ScopedArgumentsTable::tryCreate): 19 * runtime/ScopedArgumentsTable.h: 20 * runtime/SymbolTable.h: 21 1 22 2020-03-04 Paulo Matos <pmatos@igalia.com> 2 23 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r256846 r257907 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca> 4 4 * Copyright (C) 2012 Igalia, S.L. … … 158 158 ParserError BytecodeGenerator::generate() 159 159 { 160 if (UNLIKELY(m_outOfMemoryDuringConstruction)) 161 return ParserError(ParserError::OutOfMemory); 162 160 163 m_codeBlock->setThisRegister(m_thisRegister.virtualRegister()); 161 164 … … 491 494 492 495 if (capturesAnyArgumentByName) { 493 functionSymbolTable->setArgumentsLength(vm, parameters.size()); 494 496 bool success = functionSymbolTable->trySetArgumentsLength(vm, parameters.size()); 497 if (UNLIKELY(!success)) { 498 m_outOfMemoryDuringConstruction = true; 499 return; 500 } 501 495 502 // For each parameter, we have two possibilities: 496 503 // Either it's a binding node with no function overlap, in which case it gets a name -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGeneratorBase.h
r252306 r257907 1 1 /* 2 * Copyright (C) 2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 81 81 typename Traits::CodeBlock m_codeBlock; 82 82 83 bool m_outOfMemoryDuringConstruction { false }; 83 84 typename Traits::OpcodeID m_lastOpcodeID = Traits::opcodeForDisablingOptimizations; 84 85 InstructionStream::MutableRef m_lastInstruction { m_writer.ref() }; -
trunk/Source/JavaScriptCore/runtime/ScopedArgumentsTable.cpp
r246368 r257907 1 1 /* 2 * Copyright (C) 2015-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 65 65 } 66 66 67 ScopedArgumentsTable* ScopedArgumentsTable::tryCreate(VM& vm, uint32_t length) 68 { 69 void* buffer = tryAllocateCell<ScopedArgumentsTable>(vm.heap); 70 if (UNLIKELY(!buffer)) 71 return nullptr; 72 ScopedArgumentsTable* result = new (NotNull, buffer) ScopedArgumentsTable(vm); 73 result->finishCreation(vm); 74 75 result->m_length = length; 76 result->m_arguments = ArgumentsPtr::tryCreate(length); 77 if (UNLIKELY(!result->m_arguments)) 78 return nullptr; 79 return result; 80 } 81 67 82 ScopedArgumentsTable* ScopedArgumentsTable::clone(VM& vm) 68 83 { -
trunk/Source/JavaScriptCore/runtime/ScopedArgumentsTable.h
r253538 r257907 1 1 /* 2 * Copyright (C) 2015-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 61 61 static ScopedArgumentsTable* create(VM&); 62 62 static ScopedArgumentsTable* create(VM&, uint32_t length); 63 63 static ScopedArgumentsTable* tryCreate(VM&, uint32_t length); 64 64 65 static void destroy(JSCell*); 65 66 -
trunk/Source/JavaScriptCore/runtime/SymbolTable.h
r253987 r257907 1 1 /* 2 * Copyright (C) 2007-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2007-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 636 636 } 637 637 638 void setArgumentsLength(VM& vm, uint32_t length) 639 { 640 if (UNLIKELY(!m_arguments)) 641 m_arguments.set(vm, this, ScopedArgumentsTable::create(vm, length)); 642 else 638 bool trySetArgumentsLength(VM& vm, uint32_t length) 639 { 640 if (UNLIKELY(!m_arguments)) { 641 ScopedArgumentsTable* table = ScopedArgumentsTable::tryCreate(vm, length); 642 if (UNLIKELY(!table)) 643 return false; 644 m_arguments.set(vm, this, table); 645 } else 643 646 m_arguments.set(vm, this, m_arguments->setLength(vm, length)); 644 } 645 647 return true; 648 } 649 646 650 ScopeOffset argumentOffset(uint32_t i) const 647 651 { -
trunk/Source/WTF/ChangeLog
r257900 r257907 1 2020-03-04 Mark Lam <mark.lam@apple.com> 2 3 Handle an out of memory error while constructing the BytecodeGenerator. 4 https://bugs.webkit.org/show_bug.cgi?id=208622 5 <rdar://problem/59341136> 6 7 Reviewed by Saam Barati. 8 9 * wtf/CagedUniquePtr.h: 10 (WTF::CagedUniquePtr::tryCreate): 11 1 12 2020-03-04 Brady Eidson <beidson@apple.com> 2 13 -
trunk/Source/WTF/wtf/CagedUniquePtr.h
r246368 r257907 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 return CagedUniquePtr(result, length); 56 56 } 57 57 58 template<typename... Arguments> 59 static CagedUniquePtr tryCreate(unsigned length, Arguments&&... arguments) 60 { 61 T* result = static_cast<T*>(Gigacage::tryMalloc(kind, sizeof(T) * length)); 62 if (!result) 63 return { }; 64 while (length--) 65 new (result + length) T(arguments...); 66 return CagedUniquePtr(result, length); 67 } 68 58 69 CagedUniquePtr& operator=(CagedUniquePtr&& ptr) 59 70 {
Note:
See TracChangeset
for help on using the changeset viewer.