| 1 | /* |
| 2 | * Copyright (C) 1999-2002 Harri Porten ([email protected]) |
| 3 | * Copyright (C) 2001 Peter Kelly ([email protected]) |
| 4 | * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 5 | * Copyright (C) 2007 Cameron Zwarich ([email protected]) |
| 6 | * Copyright (C) 2007 Maks Orlovich |
| 7 | * Copyright (C) 2007 Eric Seidel <[email protected]> |
| 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Library General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Library General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Library General Public License |
| 20 | * along with this library; see the file COPYING.LIB. If not, write to |
| 21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 | * Boston, MA 02110-1301, USA. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 27 | #include "Nodes.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.h`/ |
| 28 | #include "NodeConstructors.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/NodeConstructors.h`/ |
| 29 | |
| 30 | #include "BytecodeGenerator.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h`/ |
| 31 | #include "CallFrame.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h`/ |
| 32 | #include "Debugger.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h`/ |
| 33 | #include "JIT.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h`/ |
| 34 | #include "JSFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h`/ |
| 35 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 36 | #include "JSStaticScopeObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSStaticScopeObject.h`/ |
| 37 | #include "LabelScope.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/LabelScope.h`/ |
| 38 | #include "Lexer.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.h`/ |
| 39 | #include "Operations.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h`/ |
| 40 | #include "Parser.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.h`/ |
| 41 | #include "PropertyNameArray.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.h`/ |
| 42 | #include "RegExpObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.h`/ |
| 43 | #include "SamplingTool.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h`/ |
| 44 | #include <wtf/Assertions.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 45 | #include <wtf/RefCountedLeakCounter.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCountedLeakCounter.h`/ |
| 46 | #include <wtf/Threading.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h`/ |
| 47 | |
| 48 | using namespace WTFcxx . . $ `<built-in>:467:9`!; |
| 49 | |
| 50 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 51 | |
| 52 | |
| 53 | // ------------------------------ StatementNode -------------------------------- |
| 54 | |
| 55 | void StatementNodecxx . . $ QTJSC/StatementNode#::setLoccxx . . $ QTJSC/StatementNode#setLoc(3e454b8ccf442868).(int firstLine, int lastLine) |
| 56 | { |
| 57 | m_linecxx . . $ QTJSC/Node#m_line. = firstLine; |
| 58 | m_lastLinecxx . . $ QTJSC/StatementNode#m_lastLine. = lastLine; |
| 59 | } |
| 60 | |
| 61 | // ------------------------------ SourceElements -------------------------------- |
| 62 | |
| 63 | void SourceElementscxx . . $ QTJSC/SourceElements#::appendcxx . . $ QTJSC/SourceElements#append(491b7eba12686c70).(StatementNodecxx . . $ QTJSC/StatementNode#* statement) |
| 64 | { |
| 65 | if (statement->isEmptyStatementcxx . . $ QTJSC/StatementNode#isEmptyStatement(50ce9a9e25b4a850).()) |
| 66 | return; |
| 67 | m_statements.append(statement); |
| 68 | } |
| 69 | |
| 70 | inline StatementNodecxx . . $ QTJSC/StatementNode#* SourceElementscxx . . $ QTJSC/SourceElements#::singleStatementcxx . . $ QTJSC/SourceElements#singleStatement(55f45246288fc866).() const |
| 71 | { |
| 72 | size_t size = m_statements.size(); |
| 73 | return size == 1 ? m_statements[0] : 0; |
| 74 | } |
| 75 | |
| 76 | // -----------------------------ScopeNodeData --------------------------- |
| 77 | |
| 78 | ScopeNodeDatacxx . . $ QTJSC/ScopeNodeData#::ScopeNodeDatacxx . . $ QTJSC/ScopeNodeData#ScopeNodeData(989ad13599074b22).(ParserArenacxx . . $ QTJSC/ParserArena#& arena, SourceElementscxx . . $ QTJSC/SourceElements#* statements, VarStackcxx . . $ QTJSC/ScopeNodeData#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNodeData#FunctionStack#* funcStack, int numConstants) |
| 79 | : m_numConstantscxx . . $ QTJSC/ScopeNodeData#m_numConstants.(numConstants) |
| 80 | , m_statementscxx . . $ QTJSC/ScopeNodeData#m_statements.(statements) |
| 81 | { |
| 82 | m_arena.swap(arena); |
| 83 | if (varStack) |
| 84 | m_varStackcxx . . $ QTJSC/ScopeNodeData#m_varStack..swap(*varStack); |
| 85 | if (funcStack) |
| 86 | m_functionStackcxx . . $ QTJSC/ScopeNodeData#m_functionStack..swap(*funcStack); |
| 87 | } |
| 88 | |
| 89 | // ------------------------------ ScopeNode ----------------------------- |
| 90 | |
| 91 | ScopeNodecxx . . $ QTJSC/ScopeNode#::ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(71c44650a83bfd83).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 92 | : StatementNodecxx . . $ QTJSC/StatementNode#(globalData) |
| 93 | , ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#ParserArenaRefCounted(71c44650a83bfd83).(globalData) |
| 94 | , m_featurescxx . . $ QTJSC/ScopeNode#m_features.(NoFeaturescxx . . $ QTJSC/NoFeatures.) |
| 95 | { |
| 96 | } |
| 97 | |
| 98 | ScopeNodecxx . . $ QTJSC/ScopeNode#::ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(186d512b6f3f7b56).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, const SourceCodecxx . . $ QTJSC/SourceCode#& source, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 99 | : StatementNodecxx . . $ QTJSC/StatementNode#(globalData) |
| 100 | , ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#ParserArenaRefCounted(71c44650a83bfd83).(globalData) |
| 101 | , m_data(new ScopeNodeData(globalData->parser->arena(), children, varStack, funcStack, numConstants)) |
| 102 | , m_featurescxx . . $ QTJSC/ScopeNode#m_features.(features) |
| 103 | , m_source(source) |
| 104 | { |
| 105 | } |
| 106 | |
| 107 | StatementNodecxx . . $ QTJSC/StatementNode#* ScopeNodecxx . . $ QTJSC/ScopeNode#::singleStatementcxx . . $ QTJSC/ScopeNode#singleStatement(55f45246288fc866).() const |
| 108 | { |
| 109 | return m_data->m_statements ? m_data->m_statements->singleStatement() : 0; |
| 110 | } |
| 111 | |
| 112 | // ------------------------------ ProgramNode ----------------------------- |
| 113 | |
| 114 | inline ProgramNodecxx . . $ QTJSC/ProgramNode#::ProgramNodecxx . . $ QTJSC/ProgramNode#ProgramNode(9bfe5b4026e08e04).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& source, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 115 | : ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(186d512b6f3f7b56).(globalData, source, children, varStack, funcStack, features, numConstants) |
| 116 | { |
| 117 | } |
| 118 | |
| 119 | PassRefPtrcxx . . $ PassRefPtr#<ProgramNodecxx . . $ QTJSC/ProgramNode#> ProgramNodecxx . . $ QTJSC/ProgramNode#::createcxx . . $ QTJSC/ProgramNode#create(874280460cf4990f).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& source, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 120 | { |
| 121 | RefPtrcxx . . $ RefPtr#<ProgramNodecxx . . $ QTJSC/ProgramNode#> node = new ProgramNode(globalData, children, varStack, funcStack, source, features, numConstants); |
| 122 | |
| 123 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(node->data()->m_arena.last() == node); |
| 124 | node->data()->m_arena.removeLast(); |
| 125 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!node->data()->m_arena.contains(node.get())); |
| 126 | |
| 127 | return node.release(); |
| 128 | } |
| 129 | |
| 130 | // ------------------------------ EvalNode ----------------------------- |
| 131 | |
| 132 | inline EvalNodecxx . . $ QTJSC/EvalNode#::EvalNodecxx . . $ QTJSC/EvalNode#EvalNode(9bfe5b4026e08e04).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& source, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 133 | : ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(186d512b6f3f7b56).(globalData, source, children, varStack, funcStack, features, numConstants) |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | PassRefPtrcxx . . $ PassRefPtr#<EvalNodecxx . . $ QTJSC/EvalNode#> EvalNodecxx . . $ QTJSC/EvalNode#::createcxx . . $ QTJSC/EvalNode#create(42cfa9ff7e536be4).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& source, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 138 | { |
| 139 | RefPtrcxx . . $ RefPtr#<EvalNodecxx . . $ QTJSC/EvalNode#> node = new EvalNode(globalData, children, varStack, funcStack, source, features, numConstants); |
| 140 | |
| 141 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(node->data()->m_arena.last() == node); |
| 142 | node->data()->m_arena.removeLast(); |
| 143 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!node->data()->m_arena.contains(node.get())); |
| 144 | |
| 145 | return node.release(); |
| 146 | } |
| 147 | |
| 148 | // ------------------------------ FunctionBodyNode ----------------------------- |
| 149 | |
| 150 | FunctionParameterscxx . . $ QTJSC/FunctionParameters#::FunctionParameterscxx . . $ QTJSC/FunctionParameters#FunctionParameters(c2cce7cab50d9bc).(ParameterNodecxx . . $ QTJSC/ParameterNode#* firstParameter) |
| 151 | { |
| 152 | for (ParameterNodecxx . . $ QTJSC/ParameterNode#* parameter = firstParameter; parameter; parameter = parameter->nextParamcxx . . $ QTJSC/ParameterNode#nextParam(91137ae232b6b139).()) |
| 153 | append(parameter->identcxx . . $ QTJSC/ParameterNode#ident(3761681fe9205dc2).()); |
| 154 | } |
| 155 | |
| 156 | inline FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#FunctionBodyNode(71c44650a83bfd83).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 157 | : ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(71c44650a83bfd83).(globalData) |
| 158 | { |
| 159 | } |
| 160 | |
| 161 | inline FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#FunctionBodyNode(9bfe5b4026e08e04).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& sourceCode, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 162 | : ScopeNodecxx . . $ QTJSC/ScopeNode#ScopeNode(186d512b6f3f7b56).(globalData, sourceCode, children, varStack, funcStack, features, numConstants) |
| 163 | { |
| 164 | } |
| 165 | |
| 166 | void FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::finishParsingcxx . . $ QTJSC/FunctionBodyNode#finishParsing(27239a7c2fc0be55).(const SourceCodecxx . . $ QTJSC/SourceCode#& source, ParameterNodecxx . . $ QTJSC/ParameterNode#* firstParameter, const Identifiercxx . . $ QTJSC/Identifier#& ident) |
| 167 | { |
| 168 | setSourcecxx . . $ QTJSC/ScopeNode#setSource(404bb59514a28443).(source); |
| 169 | finishParsingcxx . . $ QTJSC/FunctionBodyNode#finishParsing(27239a7c2fc0be55).(FunctionParameters::create(firstParameter), ident); |
| 170 | } |
| 171 | |
| 172 | void FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::finishParsingcxx . . $ QTJSC/FunctionBodyNode#finishParsing(135c125571b51cf5).(PassRefPtrcxx . . $ PassRefPtr#<FunctionParameterscxx . . $ QTJSC/FunctionParameters#> parameters, const Identifiercxx . . $ QTJSC/Identifier#& ident) |
| 173 | { |
| 174 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!source().isNull()); |
| 175 | m_parameters = parameters; |
| 176 | m_ident = ident; |
| 177 | } |
| 178 | |
| 179 | FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#* FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::createcxx . . $ QTJSC/FunctionBodyNode#create(45f8a2cf3a5a776c).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 180 | { |
| 181 | return new FunctionBodyNode(globalData); |
| 182 | } |
| 183 | |
| 184 | PassRefPtrcxx . . $ PassRefPtr#<FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#> FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#::createcxx . . $ QTJSC/FunctionBodyNode#create(5ef1d9fc1254b050).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, SourceElementscxx . . $ QTJSC/SourceElements#* children, VarStackcxx . . $ QTJSC/ScopeNode#VarStack#* varStack, FunctionStackcxx . . $ QTJSC/ScopeNode#FunctionStack#* funcStack, const SourceCodecxx . . $ QTJSC/SourceCode#& sourceCode, CodeFeaturescxx . . $ QTJSC/CodeFeatures# features, int numConstants) |
| 185 | { |
| 186 | RefPtrcxx . . $ RefPtr#<FunctionBodyNodecxx . . $ QTJSC/FunctionBodyNode#> node = new FunctionBodyNode(globalData, children, varStack, funcStack, sourceCode, features, numConstants); |
| 187 | |
| 188 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(node->data()->m_arena.last() == node); |
| 189 | node->data()->m_arena.removeLast(); |
| 190 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!node->data()->m_arena.contains(node.get())); |
| 191 | |
| 192 | return node.release(); |
| 193 | } |
| 194 | |
| 195 | } // namespace JSC |