Reviewers: Mads Ager, Lasse Reichstein,

Message:
early draft...


http://codereview.chromium.org/6576024/diff/1/src/arm/ic-arm.cc
File src/arm/ic-arm.cc (right):

http://codereview.chromium.org/6576024/diff/1/src/arm/ic-arm.cc#newcode1418
src/arm/ic-arm.cc:1418:
Once I merge strict flag into PropertyAttributes this should go back to
3 for non-strict and 4 for strict.

http://codereview.chromium.org/6576024/diff/1/src/debug.cc
File src/debug.cc (right):

http://codereview.chromium.org/6576024/diff/1/src/debug.cc#newcode841
src/debug.cc:841: false);
Debugger code, I assume we don't need strict mode semantics here.

http://codereview.chromium.org/6576024/diff/1/src/ia32/full-codegen-ia32.cc
File src/ia32/full-codegen-ia32.cc (right):

http://codereview.chromium.org/6576024/diff/1/src/ia32/full-codegen-ia32.cc#newcode2114
src/ia32/full-codegen-ia32.cc:2114: __
CallRuntime(Runtime::kStoreContextSlot, 4);
function non_strict() {
  with(o) { // o has read-only "foo"
    (function()
      "use strict";
      foo = "value" // must throw.
    })();
  }
}

http://codereview.chromium.org/6576024/diff/1/src/ic.h
File src/ic.h (left):

http://codereview.chromium.org/6576024/diff/1/src/ic.h#oldcode406
src/ic.h:406:
I'd have to clone this enum for KeyedStoreIC also, and KeyedStoreIC then
passes it to StoreIC in some cases so I figured I'd use StrictModeFlag
directly and delete this enum altogether.

http://codereview.chromium.org/6576024/diff/1/src/runtime.cc
File src/runtime.cc (right):

http://codereview.chromium.org/6576024/diff/1/src/runtime.cc#newcode3805
src/runtime.cc:3805: // TODO(mmaly): SetElement strict mode.
The big todo. SetElement currently does no strict mode-ness.

http://codereview.chromium.org/6576024/diff/1/src/runtime.h
File src/runtime.h (right):

http://codereview.chromium.org/6576024/diff/1/src/runtime.h#newcode244
src/runtime.h:244: F(SetProperty, -1 /* 4 or 5 */, 1) \
Will go back to 3-4 arguments.

http://codereview.chromium.org/6576024/diff/1/src/stub-cache.cc
File src/stub-cache.cc (right):

http://codereview.chromium.org/6576024/diff/1/src/stub-cache.cc#newcode1428
src/stub-cache.cc:1428: MaybeObject* result =
recv->SetPropertyWithInterceptor(
This needs to be figured out whether we need to pass strict mode flag
here. Probably yes.

http://codereview.chromium.org/6576024/diff/1/src/stub-cache.h
File src/stub-cache.h (right):

http://codereview.chromium.org/6576024/diff/1/src/stub-cache.h#newcode185
src/stub-cache.h:185: Code::ExtraICState extra_ic_state);
I am leaning toward changing all of these to StrictModeFlag so the
purpose is clearer. Passing ExtraICState seems too cryptic.

http://codereview.chromium.org/6576024/diff/1/test/es5conform/es5conform.status
File test/es5conform/es5conform.status (right):

http://codereview.chromium.org/6576024/diff/1/test/es5conform/es5conform.status#newcode266
test/es5conform/es5conform.status:266: # in strict mode
(Global.Infinity)
Global.Infinity is currently not read-only in V8. This differs from
jsc/mozilla but making it r/o interfers with current implementation of
global const/var declaration and causes several sputnik test failures.
They may be wrong tests, haven't analyzed that yet.
I am building the change making Infinity (and others) read/only as a
separate CL.

Description:
Draft of throwing exception in strict mode when assigning to read only property.

All StoreICs and KeyedStoreICs propagate strict mode flag (previous change did it only for globals). The flag then flows into IC miss code and into runtime.

There are plenty of todos so I am mostly looking for quick feedback on the
direction:

- Handle strict mode in SetElement (this needs to be done regardless but I
believe it can be done safely after all below is handled, in another CL)

- Revert Runtime_SetProperty back to 3-4 arguments, merging the strict flag with PropertyAttributes (optional but I'd find it being cleaner - I used adding the extra argument as means to explicitly track down all places where strict flag needs to go. If I modified the enum directly they'd be hard to find). Ultimately the Strict would be similar to ABSENT flag in PropertyAttributes. Never stored
but passed around.

- figure out global variables and constants. I am unclear about the overall
design on const in V8 (it is not part of standard and V8 implements const
differently than jsc/firefox). Lots of TODOs there.

- Handle all special cases of StoreIC and KeyedStoreIC to correctly propagate
strict mode (or disable the particular specialization in strict mode)

BUG=
TEST=


Please review this at http://codereview.chromium.org/6576024/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/api.cc
  M src/arm/codegen-arm.cc
  M src/arm/full-codegen-arm.cc
  M src/arm/ic-arm.cc
  M src/arm/lithium-codegen-arm.cc
  M src/arm/stub-cache-arm.cc
  M src/arm/virtual-frame-arm.h
  M src/arm/virtual-frame-arm.cc
  M src/builtins.h
  M src/builtins.cc
  M src/debug.cc
  M src/handles.h
  M src/handles.cc
  M src/ia32/codegen-ia32.cc
  M src/ia32/full-codegen-ia32.cc
  M src/ia32/ic-ia32.cc
  M src/ia32/lithium-codegen-ia32.cc
  M src/ia32/stub-cache-ia32.cc
  M src/ia32/virtual-frame-ia32.h
  M src/ia32/virtual-frame-ia32.cc
  M src/ic.h
  M src/ic.cc
  M src/messages.js
  M src/objects-inl.h
  M src/objects.h
  M src/objects.cc
  M src/runtime.h
  M src/runtime.cc
  M src/stub-cache.h
  M src/stub-cache.cc
  M src/x64/codegen-x64.cc
  M src/x64/full-codegen-x64.cc
  M src/x64/ic-x64.cc
  M src/x64/lithium-codegen-x64.cc
  M src/x64/stub-cache-x64.cc
  M src/x64/virtual-frame-x64.h
  M src/x64/virtual-frame-x64.cc
  M test/cctest/test-api.cc
  M test/cctest/test-compiler.cc
  M test/cctest/test-debug.cc
  M test/cctest/test-heap.cc
  M test/cctest/test-mark-compact.cc
  M test/es5conform/es5conform.status
  M test/mjsunit/strict-mode.js


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to