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

Unified Diff: src/harmony-typedarray.js

Issue 1149773003: Revert of Revert of Hook up more import/exports in natives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « src/harmony-tostring.js ('k') | src/i18n.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-typedarray.js
diff --git a/src/harmony-typedarray.js b/src/harmony-typedarray.js
index c3cf8e9e308d2c2d716724641f7cd964bfc6f783..88048b44c9e854cb5d57856b8abf86a4a3694a97 100644
--- a/src/harmony-typedarray.js
+++ b/src/harmony-typedarray.js
@@ -7,6 +7,9 @@
"use strict";
%CheckIsBootstrapping();
+
+// -------------------------------------------------------------------
+// Imports
macro TYPED_ARRAYS(FUNCTION)
// arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
@@ -28,6 +31,40 @@
TYPED_ARRAYS(DECLARE_GLOBALS)
DECLARE_GLOBALS(Array)
+var ArrayFrom;
+var InnerArrayCopyWithin;
+var InnerArrayEvery;
+var InnerArrayFill;
+var InnerArrayFilter;
+var InnerArrayFind;
+var InnerArrayFindIndex;
+var InnerArrayForEach;
+var InnerArrayIndexOf;
+var InnerArrayLastIndexOf;
+var InnerArrayMap;
+var InnerArrayReverse;
+var InnerArraySome;
+var InnerArraySort;
+var IsNaN;
+
+utils.Import(function(from) {
+ ArrayFrom = from.ArrayFrom;
+ InnerArrayCopyWithin = from.InnerArrayCopyWithin;
+ InnerArrayEvery = from.InnerArrayEvery;
+ InnerArrayFill = from.InnerArrayFill;
+ InnerArrayFilter = from.InnerArrayFilter;
+ InnerArrayFind = from.InnerArrayFind;
+ InnerArrayFindIndex = from.InnerArrayFindIndex;
+ InnerArrayForEach = from.InnerArrayForEach;
+ InnerArrayIndexOf = from.InnerArrayIndexOf;
+ InnerArrayLastIndexOf = from.InnerArrayLastIndexOf;
+ InnerArrayMap = from.InnerArrayMap;
+ InnerArrayReverse = from.InnerArrayReverse;
+ InnerArraySome = from.InnerArraySome;
+ InnerArraySort = from.InnerArraySort;
+ IsNaN = from.IsNaN;
+});
+
// -------------------------------------------------------------------
function ConstructTypedArray(constructor, array) {
@@ -58,7 +95,7 @@
var length = %_TypedArrayGetLength(this);
// TODO(littledan): Replace with a memcpy for better performance
- return $innerArrayCopyWithin(target, start, end, this, length);
+ return InnerArrayCopyWithin(target, start, end, this, length);
}
%FunctionSetLength(TypedArrayCopyWithin, 2);
@@ -68,7 +105,7 @@
var length = %_TypedArrayGetLength(this);
- return $innerArrayEvery(f, receiver, this, length);
+ return InnerArrayEvery(f, receiver, this, length);
}
%FunctionSetLength(TypedArrayEvery, 1);
@@ -78,7 +115,7 @@
var length = %_TypedArrayGetLength(this);
- $innerArrayForEach(f, receiver, this, length);
+ InnerArrayForEach(f, receiver, this, length);
}
%FunctionSetLength(TypedArrayForEach, 1);
@@ -88,7 +125,7 @@
var length = %_TypedArrayGetLength(this);
- return $innerArrayFill(value, start, end, this, length);
+ return InnerArrayFill(value, start, end, this, length);
}
%FunctionSetLength(TypedArrayFill, 1);
@@ -97,7 +134,7 @@
if (!%IsTypedArray(this)) throw MakeTypeError(kNotTypedArray);
var length = %_TypedArrayGetLength(this);
- var array = $innerArrayFilter(predicate, thisArg, this, length);
+ var array = InnerArrayFilter(predicate, thisArg, this, length);
return ConstructTypedArrayLike(this, array);
}
%FunctionSetLength(TypedArrayFilter, 1);
@@ -108,7 +145,7 @@
var length = %_TypedArrayGetLength(this);
- return $innerArrayFind(predicate, thisArg, this, length);
+ return InnerArrayFind(predicate, thisArg, this, length);
}
%FunctionSetLength(TypedArrayFind, 1);
@@ -118,7 +155,7 @@
var length = %_TypedArrayGetLength(this);
- return $innerArrayFindIndex(predicate, thisArg, this, length);
+ return InnerArrayFindIndex(predicate, thisArg, this, length);
}
%FunctionSetLength(TypedArrayFindIndex, 1);
@@ -128,15 +165,15 @@
var length = %_TypedArrayGetLength(this);
- return $innerArrayReverse(this, length);
+ return InnerArrayReverse(this, length);
}
function TypedArrayComparefn(x, y) {
- if ($isNaN(x) && $isNaN(y)) {
- return $isNaN(y) ? 0 : 1;
- }
- if ($isNaN(x)) {
+ if (IsNaN(x) && IsNaN(y)) {
+ return IsNaN(y) ? 0 : 1;
+ }
+ if (IsNaN(x)) {
return 1;
}
if (x === 0 && x === y) {
@@ -162,7 +199,7 @@
comparefn = TypedArrayComparefn;
}
- return %_CallFunction(this, length, comparefn, $innerArraySort);
+ return %_CallFunction(this, length, comparefn, InnerArraySort);
}
@@ -172,7 +209,7 @@
var length = %_TypedArrayGetLength(this);
- return %_CallFunction(this, element, index, length, $innerArrayIndexOf);
+ return %_CallFunction(this, element, index, length, InnerArrayIndexOf);
}
%FunctionSetLength(TypedArrayIndexOf, 1);
@@ -184,7 +221,7 @@
var length = %_TypedArrayGetLength(this);
return %_CallFunction(this, element, index, length,
- %_ArgumentsLength(), $innerArrayLastIndexOf);
+ %_ArgumentsLength(), InnerArrayLastIndexOf);
}
%FunctionSetLength(TypedArrayLastIndexOf, 1);
@@ -196,7 +233,7 @@
// TODO(littledan): Preallocate rather than making an intermediate
// InternalArray, for better performance.
var length = %_TypedArrayGetLength(this);
- var array = $innerArrayMap(predicate, thisArg, this, length);
+ var array = InnerArrayMap(predicate, thisArg, this, length);
return ConstructTypedArrayLike(this, array);
}
%FunctionSetLength(TypedArrayMap, 1);
@@ -208,7 +245,7 @@
var length = %_TypedArrayGetLength(this);
- return $innerArraySome(f, receiver, this, length);
+ return InnerArraySome(f, receiver, this, length);
}
%FunctionSetLength(TypedArraySome, 1);
@@ -227,7 +264,7 @@
function TypedArrayFrom(source, mapfn, thisArg) {
// TODO(littledan): Investigate if there is a receiver which could be
// faster to accumulate on than Array, e.g., a TypedVector.
- var array = %_CallFunction(GlobalArray, source, mapfn, thisArg, $arrayFrom);
+ var array = %_CallFunction(GlobalArray, source, mapfn, thisArg, ArrayFrom);
return ConstructTypedArray(this, array);
}
%FunctionSetLength(TypedArrayFrom, 1);
@@ -235,13 +272,13 @@
// TODO(littledan): Fix the TypedArray proto chain (bug v8:4085).
macro EXTEND_TYPED_ARRAY(NAME)
// Set up non-enumerable functions on the object.
- $installFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
+ utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
"from", TypedArrayFrom,
"of", TypedArrayOf
]);
// Set up non-enumerable functions on the prototype object.
- $installFunctions(GlobalNAME.prototype, DONT_ENUM, [
+ utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
"copyWithin", TypedArrayCopyWithin,
"every", TypedArrayEvery,
"fill", TypedArrayFill,
« no previous file with comments | « src/harmony-tostring.js ('k') | src/i18n.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698