Reviewers: Lasse Reichstein, Mads Ager,
Message:
The second part of implementation of delete behavior in strict mode
(deleting
non-configurable property).
This change builds on the previous (delete of unqualified identifier). As a
result, only "delete o.x" and delete o[x] can happen in strict mode which
explains why sometimes constant kNonStrictMode is passed to the DELETE
runtime
function.
Thank you!
Martin
http://codereview.chromium.org/6515005/diff/1/src/arm/codegen-arm.cc
File src/arm/codegen-arm.cc (right):
http://codereview.chromium.org/6515005/diff/1/src/arm/codegen-arm.cc#newcode5852
src/arm/codegen-arm.cc:5852: ASSERT(strict_mode_flag() ==
kNonStrictMode);
"delete foo" is disallowed in strict mode so we can only reach this code
in non-strict mode.
http://codereview.chromium.org/6515005/diff/1/src/arm/full-codegen-arm.cc
File src/arm/full-codegen-arm.cc (right):
http://codereview.chromium.org/6515005/diff/1/src/arm/full-codegen-arm.cc#newcode3067
src/arm/full-codegen-arm.cc:3067: __ push(r1);
Is there a preferred register to use instead?
http://codereview.chromium.org/6515005/diff/1/src/arm/lithium-codegen-arm.cc
File src/arm/lithium-codegen-arm.cc (right):
http://codereview.chromium.org/6515005/diff/1/src/arm/lithium-codegen-arm.cc#newcode3893
src/arm/lithium-codegen-arm.cc:3893: __ Push(object, key, strict);
Not sure 100% about the use of scratch0() but saw it elsewhere.
http://codereview.chromium.org/6515005/diff/1/src/objects.cc
File src/objects.cc (right):
http://codereview.chromium.org/6515005/diff/1/src/objects.cc#newcode2623
src/objects.cc:2623: Object* result = dictionary->DeleteProperty(entry,
mode);
DeleteProperty is a wrong place to report the error because it is
missing the necessary data to report good error, and it is called from
other places which don't even have the relevant information.
Checking for false_value() for strict mode delete felt cleanest.
http://codereview.chromium.org/6515005/diff/1/src/objects.h
File src/objects.h (right):
http://codereview.chromium.org/6515005/diff/1/src/objects.h#newcode1293
src/objects.h:1293: };
This enum felt like natural place to capture strict delete. I actually
originally built the code passing around additional parameter and then
consolidated back to this enum, making sure all code paths are handled.
http://codereview.chromium.org/6515005/diff/1/src/parser.cc
File src/parser.cc (right):
http://codereview.chromium.org/6515005/diff/1/src/parser.cc#newcode2522
src/parser.cc:2522: }
This is contained in the other CL...
Description:
Strict mode delete.
(includes delete of unqualified identifier)
Pass strict mode flag to Runtime_DeleteProperty and then
via STRICT_DELETION to JSObject::Delete(Property/Element).
Throw TypeError when deleting non configurable property/element.
Adding mozilla test to .gitignore.
BUG=
TEST=test/mjsunit/strict-mode.js
Please review this at http://codereview.chromium.org/6515005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M .gitignore
M src/arm/codegen-arm.cc
M src/arm/full-codegen-arm.cc
M src/arm/lithium-codegen-arm.h
M src/arm/lithium-codegen-arm.cc
M src/builtins.h
M src/ia32/codegen-ia32.cc
M src/ia32/full-codegen-ia32.cc
M src/ia32/lithium-codegen-ia32.h
M src/ia32/lithium-codegen-ia32.cc
M src/messages.js
M src/objects.h
M src/objects.cc
M src/parser.cc
M src/runtime.h
M src/runtime.cc
M src/runtime.js
M src/x64/codegen-x64.cc
M src/x64/full-codegen-x64.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