Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1396)

Unified Diff: src/harmony-array.js

Issue 851163007: Implement IsConstructor() abstract operation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All raw pointers converted to handles Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-array.js
diff --git a/src/harmony-array.js b/src/harmony-array.js
index 5d1262a06d75bfd2444ade2f1fca0fa178079a90..762f746e56d923f1330ac177fa41403a331c18c8 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -149,7 +149,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
var nextValue;
if (!IS_UNDEFINED(iterable)) {
- result = IS_SPEC_FUNCTION(this) && this.prototype ? new this() : [];
+ result = %IsConstructor(this) ? new this() : [];
k = 0;
for (nextValue of items) {
@@ -162,8 +162,7 @@ function ArrayFrom(arrayLike, mapfn, receiver) {
return result;
} else {
var len = ToLength(items.length);
- result = IS_SPEC_FUNCTION(this) && this.prototype ? new this(len) :
- new $Array(len);
+ result = %IsConstructor(this) ? new this(len) : new $Array(len);
for (k = 0; k < len; ++k) {
nextValue = items[k];
@@ -182,7 +181,7 @@ function ArrayOf() {
var length = %_ArgumentsLength();
var constructor = this;
// TODO: Implement IsConstructor (ES6 section 7.2.5)
- var array = IS_SPEC_FUNCTION(constructor) ? new constructor(length) : [];
+ var array = %IsConstructor(constructor) ? new constructor(length) : [];
for (var i = 0; i < length; i++) {
%AddElement(array, i, %_Arguments(i), NONE);
}
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698