Commit Graph

206 Commits

Author SHA1 Message Date
yangguo@chromium.org
8ef4b0ca83 Cosmetic: Add macros for NaN, undefined and Infinity to native js code.
Nobody should need to use $NaN, 0/0, 1/0 and void 0.

R=mvstanton@chromium.org
BUG=

Review URL: https://codereview.chromium.org/27491002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17252 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-10-17 10:02:45 +00:00
yangguo@chromium.org
8fb95efdda Improve internal stringifcation for custom Error objects.
If an developer attempts to "subclass" Error by running
`MyError.prototype = new Error();`, then the internal v8::Message object
that's produced and handed off to `window.onerror` handlers is poorly
stringified as "[object Object]".

This patch adjusts the stringification process for these objects to
include not only native Error objects, but also objects that have Error
in their prototype chain, and haven't overwritten Error.toString with
some custom variant.

BUG=2822
R=mstarzinger@chromium.org, yangguo@chromium.org

Review URL: https://codereview.chromium.org/21761002

Patch from Mike West <mkwst@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16075 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-08-06 13:58:21 +00:00
mstarzinger@chromium.org
0627d433b0 Add new Harmony methods to String.prototype object.
String.prototype.repeat
String.prototype.startsWith
String.prototype.endsWith
String.prototype.contains

http://people.mozilla.org/~jorendorff/es6-draft.html

BUG=v8:2796,v8:2797,v8:2798,v8:2799
TEST=mjsunit/string-repeat,mjsunit/string-startswith,mjsunit/string-endswith,mjsunit/string-contains
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/21014007

Patch from Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15960 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-30 16:33:08 +00:00
yangguo@chromium.org
372763897d Lazy call to custom stack trace formatting using Error.prepareStackTrace.
This enables custom stack trace formatting for stack overflow.
A consequence is that stack trace formatting is now easily observable,
but we already established that the default stack trace formatting can
be observed anyways. It is only triggered by the .stack getter, and
it has to be explicitly called, (e.g. not implicitly after GC).

R=mstarzinger@chromium.org
BUG=v8:2559

Review URL: https://codereview.chromium.org/20692002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15902 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-26 11:28:08 +00:00
yangguo@chromium.org
eaedafad4b Restore test and behavior prior to deferred stack trace formatting.
R=mstarzinger@chromium.org
TEST=stack-traces-overflow.js

Review URL: https://codereview.chromium.org/19805003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15856 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-24 12:16:02 +00:00
mstarzinger@chromium.org
ce81b0d3a8 ES6: Implement WeakSet
WeakSets work similar to ordinary Sets but the value (which must be an
object) is held weakly.

This is available under --harmony-collections

BUG=v8:2785
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/19678023

Patch from Erik Arvidsson <arv@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15792 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-22 08:32:24 +00:00
dslomov@chromium.org
cfa91762ac Allow parameterless typed array constructors.
ES6 spec tacitly allows them, and they are allowed in Firefox and in
WebKit/Blink.

R=bmeurer@chromium.org,rossberg@chromium.org

Review URL: https://codereview.chromium.org/18769005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15579 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-09 19:34:21 +00:00
rossberg@chromium.org
929e193fc2 Tweak error message
R=yangguo@chromium.org
BUG=v8:2758

Review URL: https://codereview.chromium.org/18759002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15503 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-07-05 08:34:31 +00:00
dslomov@chromium.org
ef189ecd82 Do not allow invocation of ArrayBuffer and array buffer views' constructors as functions.
ES6 bug 695 (https://bugs.ecmascript.org/show_bug.cgi?id=695).
This never worked in WebKit, so no compatibility issues.

R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/17904007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15346 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-06-27 07:42:08 +00:00
dslomov@chromium.org
e6e0ee0708 Update typed arrays behavior to match ES6 rev 15. Remove TO_POSITIVE_INTEGER and throw on negative length arguments.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/17572009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15298 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-06-24 13:58:52 +00:00
dslomov@chromium.org
91eb5f8d25 DataView implementation.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/17153011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15269 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-06-21 13:02:38 +00:00
yurys@chromium.org
09959efe41 Add support for //# sourceURL similar to deprecated //@ sourceURL one.
BUG=v8:2702
R=yangguo@chromium.org, yurys@chromium.org

Review URL: https://codereview.chromium.org/15859010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14883 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-29 12:40:21 +00:00
yangguo@chromium.org
7c2a1346d6 Fix edge case in stack trace formatting.
Bug description: in strict mode, null as receiver is not implicitly converted
to the global object, so that when formatting the stack trace, the receiver of
the stack frame is null. The IS_OBJECT check returns true for null, but
%GetDataProperty expected a JSObject, which results in a failed RUNTIME_ASSERT.

R=mvstanton@chromium.org
BUG=237617

Review URL: https://chromiumcodereview.appspot.com/15670003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14797 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-24 11:33:46 +00:00
adamk@chromium.org
0ed681905c Re-land Notifier.prototype.performChange + tests
Fixes the debug check failure on sorting an object with an array __proto__.

Original Issue: https://codereview.chromium.org/14779011/

TBR=adamk@chromium.org

Review URL: https://codereview.chromium.org/14977015

Patch from Rafael Weinstein <rafaelw@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-15 22:09:40 +00:00
adamk@chromium.org
91daa127c9 Revert "Implement Object.getNotifier(obj).performChange()" (r14696)
Reverts r14696 because it caused debug assertion failures when running
test/mjsunit/harmony/object-observe.js

TBR=rossberg

Review URL: https://codereview.chromium.org/15203002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14697 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-15 18:47:48 +00:00
adamk@chromium.org
07a54cd06d Implement Object.getNotifier(obj).performChange()
R=rossberg,adamk,arv
BUG=

Review URL: https://codereview.chromium.org/14779011
Patch from Rafael Weinstein <rafaelw@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14696 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-15 17:44:45 +00:00
dslomov@chromium.org
b15bbfbe39 Implement TypedArray.set function.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/14581005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14576 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-07 14:42:17 +00:00
dslomov@chromium.org
02889cafb8 Add type checks to typed array property getters.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/14650014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14538 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-03 09:59:50 +00:00
dslomov@chromium.org
2751eeb361 More typed array constructors.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/14845012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14518 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-05-02 12:27:03 +00:00
mvstanton@chromium.org
d5e485a3cc Change 'Parse error' to three more informative messages.
Replace the 'unable_to_parse' key used in three places with three difference keys.
Provide three more informative and less ambiguous error messages in place of 'Parse error'.

Add three test/message cases to cover the new messages.

BUG=2636

Review URL: https://codereview.chromium.org/14161007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14462 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-04-26 14:26:54 +00:00
mstarzinger@chromium.org
23f39546b9 Generators can resume
The generator object methods "next", "send", and "throw" now
include some inline assembly to set up a resumed stack frame.  In some
common cases, we can just jump back into the frame to resume it.
Otherwise the resume code calls out to a runtime to fill in the operand
stack, rewind the handlers, and possibly to throw an exception.

BUG=v8:2355
TESTS=mjsunit/harmony/generators-iteration

Review URL: https://codereview.chromium.org/14066016

Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14415 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-04-24 13:00:16 +00:00
dslomov@chromium.org
c1a19275d3 First cut at impementing ES6 TypedArrays in V8.
BUG=

Review URL: https://codereview.chromium.org/13975012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14285 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-04-16 14:16:30 +00:00
mstarzinger@chromium.org
9e757a604c Make __proto__ a real JavaScript accessor property.
This turns the __proto__ callback from a foreign callback into a real
JavaScript accessor. It makes the accessor behavior of this property
explicit.

R=rossberg@chromium.org
BUG=v8:1949,v8:2606
TEST=mjsunit/regress/regress-2606

Review URL: https://codereview.chromium.org/13533004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14139 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-04-04 12:10:23 +00:00
dslomov@chromium.org
944c577c7b First steps towards implementing ArrayBuffer &co in V8
BUG=

Review URL: https://codereview.chromium.org/13064003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14091 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-03-28 12:50:18 +00:00
yangguo@chromium.org
9155d20282 Stack trace API: poison stack frames below the first strict mode frame.
Function and receiver objects are not accessible for poisoned frames.

R=rossberg@chromium.org
BUG=v8:2564

Review URL: https://chromiumcodereview.appspot.com/13150003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14085 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-03-28 10:40:07 +00:00
rossberg@chromium.org
83d4a41dec ES6 symbols: turn symbols into a proper primitive type
(qua last week's TC39)

Specifically:
- Install Symbol constructor function on the global object.
- Adjust code generation for typeof.
- Remove IsSymbol built-in, IS_SYMBOL macro now defined using typeof.
- Remove hack that allowed symbols as constructor results, and some other special cases.
- Remove symbol_delegate and GetDelegate function.
- Extend ToBoolean stub to handle symbols.
- Extend ToNumber to return NaN on symbols.
- Poison symbol's toString function, and thereby ToString on symbols.

R=mstarzinger@chromium.org
BUG=v8:2158

Review URL: https://codereview.chromium.org/12957004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-03-22 16:33:50 +00:00
mstarzinger@chromium.org
0ca02ee48d Make sure builtin functions don't rely on __proto__.
This makes sure that none of the builtin functions rely on the __proto__
accessor which can now be monkey-patched by applications. Instead use a
separate %SetPrototype() intrinsic or object literals to do the job.

R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/12385082

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13815 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-03-04 16:05:12 +00:00
yangguo@chromium.org
358311e8ec Limit EatAtLeast recursion by a budget.
BUG=178790

Review URL: https://chromiumcodereview.appspot.com/12380026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13788 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-03-01 14:50:14 +00:00
yangguo@chromium.org
215ba8cfc9 Combine %_SubString and %_StringCharAt.
R=ulan@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12217071

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13700 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-02-20 14:29:40 +00:00
yangguo@chromium.org
d7999dc42e Remove wrong uses of InternalPackedArray.
R=jkummerow@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12284002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13679 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-02-15 16:21:03 +00:00
yangguo@chromium.org
01f4cb0951 Introduce InternalPackedArray.
R=jkummerow@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12255049

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13678 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-02-15 15:20:05 +00:00
yangguo@chromium.org
eadcc1c10c Reland r13188, r13194, r13256 (Deferred formatting of error stack trace during GC).
BUG=

Review URL: https://chromiumcodereview.appspot.com/11880018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13371 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-01-14 13:19:27 +00:00
yangguo@chromium.org
2f821f1ed9 Revert r13188, r13194, r13256 (Deferred formatting of error stack trace during GC).
R=ulan@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11678006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13279 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-27 13:12:27 +00:00
yangguo@chromium.org
a3f16f8e65 Fix several bugs in error stack trace formatting.
GetScriptWrapper can be called recursively:
GetScriptWrapper -> GC -> DeferredFormatStackTrace -> GetScriptWrapper

GC-unsafe code in ErrorObjectList::DeferredFormatStackTrace

Enable overwriting Error.prepareStackTrace by itself while not
causing infinity recursion when it triggers an exception.

R=ulan@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11649037

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13256 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-20 16:25:26 +00:00
yangguo@chromium.org
6e953d51af Make sure error message formatting does not have side effects.
R=vegorov@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11598011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13228 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-17 14:00:50 +00:00
yangguo@chromium.org
da3e153e63 Avoid object layout changes during GC.
R=mstarzinger@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11530011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13194 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-11 14:55:23 +00:00
yangguo@chromium.org
72dfb27909 Fire 'stack' getter of error objects after GC.
BUG=v8:2340

Review URL: https://chromiumcodereview.appspot.com/11377158

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13188 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-12-11 10:14:01 +00:00
yangguo@chromium.org
4783d3c31b Remove 'type' and 'arguments' properties from Error object.
R=svenpanne@chromium.org
BUG=v8:2397

Review URL: https://chromiumcodereview.appspot.com/11358214

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12956 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-14 09:14:47 +00:00
yangguo@chromium.org
578a2c74bd Fix details in message formatting.
BUG=

Review URL: https://chromiumcodereview.appspot.com/11360220

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12940 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-13 09:01:43 +00:00
yangguo@chromium.org
4c27298d27 Collect stack trace on stack overflow.
BUG=v8:2394

Review URL: https://chromiumcodereview.appspot.com/11275186

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12933 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-12 14:54:29 +00:00
yangguo@chromium.org
4cca6c6081 Make formatting error message side-effect-free.
BUG=v8:2398

Review URL: https://chromiumcodereview.appspot.com/11359130

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12926 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-12 10:33:20 +00:00
rossberg@chromium.org
0e7306cc92 Implement Object.getNotifier() and remove Object.notify()
Updated all tests to use getNotifier or actual object mutation instead of notify, and added tests for new behavior of getNotifier.

Review URL: https://codereview.chromium.org/11369154
Patch from Adam Klein <adamk@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12923 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-09 16:14:42 +00:00
yangguo@chromium.org
64da47559c Turn message property of the error object into a data property.
R=svenpanne@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11368142

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12908 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-09 08:22:02 +00:00
rossberg@chromium.org
cd9029a502 Initial JS stub implementation of Object.observe. Adds support for .object/.unobserve/.notify/.deliverChangeRecords. No delivery mechanism is implemented for end-of-microtask.
Review URL: https://codereview.chromium.org/11225058
Patch from Rafael Weinstein <rafaelw@google.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12819 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-10-25 14:53:26 +00:00
rossberg@chromium.org
00132da734 Bump variable limit further to 2^17.
R=jkummerow@chromium.org
BUG=151625

Review URL: https://codereview.chromium.org/11099063

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-10-11 11:40:10 +00:00
rossberg@chromium.org
20b1c426cf Bump number of allowed variables per scope to 65535, to address GWT.
R=jkummerow@chromium.org
BUG=151625

Review URL: https://codereview.chromium.org/10965063

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12600 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-24 16:22:17 +00:00
yurys@chromium.org
26721b7dc0 This issue is for landing patch by vsevik: http://codereview.chromium.org/10966011/
SourceURL comments for scripts having a name. 

sourceURL comment is now preferred script name for all scripts except 
for those with non zero start position (e.g. inline scripts in HTML). 


BUG=v8:2342
Review URL: https://codereview.chromium.org/10959038

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12576 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-21 08:09:34 +00:00
ulan@chromium.org
4bd4fb1aa4 Throw a more descriptive exception when blocking 'eval' via CSP.
BUG=140191

R=svenpanne@chromium.org,mkwst@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10837358

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12525 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-17 09:58:22 +00:00
yangguo@chromium.org
474e34e3c5 Fix TypeError message for Date builtins.
BUG=

Review URL: https://chromiumcodereview.appspot.com/10928108

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-11 12:43:17 +00:00
yangguo@chromium.org
1a0c14f12c Add checks to runtime functions.
BUG=

Review URL: https://chromiumcodereview.appspot.com/10915062

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12471 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-10 08:35:26 +00:00