diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/JavaScriptCore/parser | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/JavaScriptCore/parser')
-rw-r--r-- | Source/JavaScriptCore/parser/ASTBuilder.h | 6 | ||||
-rw-r--r-- | Source/JavaScriptCore/parser/Keywords.table | 11 | ||||
-rw-r--r-- | Source/JavaScriptCore/parser/Lexer.cpp | 7 | ||||
-rw-r--r-- | Source/JavaScriptCore/parser/Nodes.h | 19 | ||||
-rw-r--r-- | Source/JavaScriptCore/parser/Parser.cpp | 3 | ||||
-rw-r--r-- | Source/JavaScriptCore/parser/Parser.h | 13 |
6 files changed, 29 insertions, 30 deletions
diff --git a/Source/JavaScriptCore/parser/ASTBuilder.h b/Source/JavaScriptCore/parser/ASTBuilder.h index b6ea004b5..b8718709b 100644 --- a/Source/JavaScriptCore/parser/ASTBuilder.h +++ b/Source/JavaScriptCore/parser/ASTBuilder.h @@ -265,7 +265,6 @@ public: FunctionBodyNode* createFunctionBody(int lineNumber, bool inStrictContext) { - usesClosures(); return FunctionBodyNode::create(m_globalData, lineNumber, inStrictContext); } @@ -624,9 +623,7 @@ private: void incConstants() { m_scope.m_numConstants++; } void usesThis() { m_scope.m_features |= ThisFeature; } void usesCatch() { m_scope.m_features |= CatchFeature; } - void usesClosures() { m_scope.m_features |= ClosureFeature; } void usesArguments() { m_scope.m_features |= ArgumentsFeature; } - void usesAssignment() { m_scope.m_features |= AssignFeature; } void usesWith() { m_scope.m_features |= WithFeature; } void usesEval() { @@ -904,7 +901,6 @@ ExpressionNode* ASTBuilder::makeBinaryNode(int lineNumber, int token, pair<Expre ExpressionNode* ASTBuilder::makeAssignNode(int lineNumber, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) { - usesAssignment(); if (!loc->isLocation()) return new (m_globalData) AssignErrorNode(lineNumber, loc, op, expr, divot, divot - start, end - divot); @@ -942,7 +938,6 @@ ExpressionNode* ASTBuilder::makeAssignNode(int lineNumber, ExpressionNode* loc, ExpressionNode* ASTBuilder::makePrefixNode(int lineNumber, ExpressionNode* expr, Operator op, int start, int divot, int end) { - usesAssignment(); if (!expr->isLocation()) return new (m_globalData) PrefixErrorNode(lineNumber, expr, op, divot, divot - start, end - divot); @@ -965,7 +960,6 @@ ExpressionNode* ASTBuilder::makePrefixNode(int lineNumber, ExpressionNode* expr, ExpressionNode* ASTBuilder::makePostfixNode(int lineNumber, ExpressionNode* expr, Operator op, int start, int divot, int end) { - usesAssignment(); if (!expr->isLocation()) return new (m_globalData) PostfixErrorNode(lineNumber, expr, op, divot, divot - start, end - divot); diff --git a/Source/JavaScriptCore/parser/Keywords.table b/Source/JavaScriptCore/parser/Keywords.table index 333b4762d..27c4e53a2 100644 --- a/Source/JavaScriptCore/parser/Keywords.table +++ b/Source/JavaScriptCore/parser/Keywords.table @@ -1,12 +1,12 @@ -# main keywords +# Main keywords. @begin mainTable 47 -# types +# Types. null NULLTOKEN true TRUETOKEN false FALSETOKEN -# keywords +# Keywords. break BREAK case CASE catch CATCH @@ -35,7 +35,7 @@ typeof TYPEOF with WITH debugger DEBUGGER -# reserved for future use +# Reserved for future use. class RESERVED enum RESERVED export RESERVED @@ -46,7 +46,7 @@ super RESERVED # technically RESERVED_IF_STRICT in ES5, but may be reserved in ES6. let RESERVED -# reserved for future use in strict code +# Reserved for future use in strict code. implements RESERVED_IF_STRICT interface RESERVED_IF_STRICT package RESERVED_IF_STRICT @@ -57,4 +57,3 @@ static RESERVED_IF_STRICT yield RESERVED_IF_STRICT @end - diff --git a/Source/JavaScriptCore/parser/Lexer.cpp b/Source/JavaScriptCore/parser/Lexer.cpp index e38b52480..015c1509d 100644 --- a/Source/JavaScriptCore/parser/Lexer.cpp +++ b/Source/JavaScriptCore/parser/Lexer.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved. * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) * Copyright (C) 2010 Zoltan Herczeg (zherczeg@inf.u-szeged.hu) + * Copyright (C) 2012 Mathias Bynens (mathias@qiwi.be) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -379,8 +380,8 @@ static inline bool isIdentStart(int c) static NEVER_INLINE bool isNonASCIIIdentPart(int c) { - return category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other - | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector); + return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other + | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector)) || c == 0x200C || c == 0x200D; } static ALWAYS_INLINE bool isIdentPart(int c) @@ -1328,7 +1329,7 @@ inNumberAfterDecimalPoint: } // Null-terminate string for strtod. m_buffer8.append('\0'); - tokenData->doubleValue = WTF::strtod(reinterpret_cast<const char*>(m_buffer8.data()), 0); + tokenData->doubleValue = WTF::strtod<WTF::AllowTrailingJunk>(reinterpret_cast<const char*>(m_buffer8.data()), 0); } token = NUMBER; } diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h index 278d17ef4..0373766b5 100644 --- a/Source/JavaScriptCore/parser/Nodes.h +++ b/Source/JavaScriptCore/parser/Nodes.h @@ -51,17 +51,14 @@ namespace JSC { const CodeFeatures NoFeatures = 0; const CodeFeatures EvalFeature = 1 << 0; - const CodeFeatures ClosureFeature = 1 << 1; - const CodeFeatures AssignFeature = 1 << 2; - const CodeFeatures ArgumentsFeature = 1 << 3; - const CodeFeatures WithFeature = 1 << 4; - const CodeFeatures CatchFeature = 1 << 5; - const CodeFeatures ThisFeature = 1 << 6; - const CodeFeatures StrictModeFeature = 1 << 7; - const CodeFeatures ShadowsArgumentsFeature = 1 << 8; + const CodeFeatures ArgumentsFeature = 1 << 1; + const CodeFeatures WithFeature = 1 << 2; + const CodeFeatures CatchFeature = 1 << 3; + const CodeFeatures ThisFeature = 1 << 4; + const CodeFeatures StrictModeFeature = 1 << 5; + const CodeFeatures ShadowsArgumentsFeature = 1 << 6; - - const CodeFeatures AllFeatures = EvalFeature | ClosureFeature | AssignFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature; + const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature; enum Operator { OpEqual, @@ -1493,7 +1490,7 @@ namespace JSC { void finishParsing(PassRefPtr<FunctionParameters>, const Identifier&); const Identifier& ident() { return m_ident; } - void setInferredName(const Identifier& inferredName) { m_inferredName = inferredName; } + void setInferredName(const Identifier& inferredName) { ASSERT(!inferredName.isNull()); m_inferredName = inferredName; } const Identifier& inferredName() { return m_inferredName.isEmpty() ? m_ident : m_inferredName; } static const bool scopeIsFunction = true; diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index 25ada5606..939d2696c 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -774,7 +774,6 @@ template <FunctionRequirements requirements, bool nameIsInContainingScope, class functionScope->setIsFunction(); if (match(IDENT)) { name = m_token.m_data.ident; - failIfTrueWithMessage(*name == m_globalData->propertyNames->underscoreProto, "Cannot name a function __proto__"); next(); if (!nameIsInContainingScope) failIfFalseIfStrict(functionScope->declareVariable(name)); diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h index f3d96ff3e..9b76242d4 100644 --- a/Source/JavaScriptCore/parser/Parser.h +++ b/Source/JavaScriptCore/parser/Parser.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -37,6 +37,15 @@ #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> +namespace JSC { +struct Scope; +} + +namespace WTF { +template <> struct VectorTraits<JSC::Scope> : SimpleClassVectorTraits { + static const bool canInitializeWithMemset = false; // Not all Scope data members initialize to 0. +}; +} namespace JSC { @@ -1016,7 +1025,7 @@ PassRefPtr<ParsedNode> Parser<LexerType>::parse(JSGlobalObject* lexicalGlobalObj else if (isEvalNode<ParsedNode>()) *exception = createSyntaxError(lexicalGlobalObject, errMsg); else - *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, *m_source); + *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, *m_source, Vector<StackFrame>()); } if (debugger && !ParsedNode::scopeIsFunction) |