Changeset 202664 in webkit


Ignore:
Timestamp:
Jun 29, 2016 8:55:34 PM (8 years ago)
Author:
sbarati@apple.com
Message:

JSGlobalLexicalEnvironment needs a toThis implementation
https://bugs.webkit.org/show_bug.cgi?id=159285

Reviewed by Mark Lam.

This was a huge oversight of my original implementation. It gave users
of the language direct access to the JSGlobalLexicalEnvironment object.

  • runtime/JSGlobalLexicalEnvironment.cpp:

(JSC::JSGlobalLexicalEnvironment::isConstVariable):
(JSC::JSGlobalLexicalEnvironment::toThis):

  • runtime/JSGlobalLexicalEnvironment.h:

(JSC::JSGlobalLexicalEnvironment::isEmpty):

  • tests/stress/global-lexical-environment-to-this.js: Added.

(assert):
(let.f):
(let.fStrict):

Location:
trunk/Source/JavaScriptCore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r202659 r202664  
     12016-06-29  Saam barati  <sbarati@apple.com>
     2
     3        JSGlobalLexicalEnvironment needs a toThis implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=159285
     5
     6        Reviewed by Mark Lam.
     7
     8        This was a huge oversight of my original implementation. It gave users
     9        of the language direct access to the JSGlobalLexicalEnvironment object.
     10
     11        * runtime/JSGlobalLexicalEnvironment.cpp:
     12        (JSC::JSGlobalLexicalEnvironment::isConstVariable):
     13        (JSC::JSGlobalLexicalEnvironment::toThis):
     14        * runtime/JSGlobalLexicalEnvironment.h:
     15        (JSC::JSGlobalLexicalEnvironment::isEmpty):
     16        * tests/stress/global-lexical-environment-to-this.js: Added.
     17        (assert):
     18        (let.f):
     19        (let.fStrict):
     20
    1212016-06-29  Joseph Pecoraro  <pecoraro@apple.com>
    222
  • trunk/Source/JavaScriptCore/runtime/JSGlobalLexicalEnvironment.cpp

    r201494 r202664  
    6262}
    6363
     64JSValue JSGlobalLexicalEnvironment::toThis(JSCell*, ExecState* exec, ECMAMode ecmaMode)
     65{
     66    if (ecmaMode == StrictMode)
     67        return jsUndefined();
     68    return exec->globalThisValue();
     69}
     70
    6471} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSGlobalLexicalEnvironment.h

    r201494 r202664  
    3636    typedef JSSegmentedVariableObject Base;
    3737
    38     static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;
     38    static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesToThis;
    3939
    4040    static JSGlobalLexicalEnvironment* create(VM& vm, Structure* structure, JSScope* parentScope)
     
    5757    bool isEmpty() const { return !symbolTable()->size(); }
    5858    bool isConstVariable(UniquedStringImpl*);
     59
     60    static JSValue toThis(JSCell*, ExecState*, ECMAMode);
    5961   
    6062    DECLARE_INFO;
Note: See TracChangeset for help on using the changeset viewer.