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

Unified Diff: src/typedarray.js

Issue 664333003: Add remaining @@toStringTag symbols to builtins (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Oops, forgot to add the test cases for Math / JSON Created 6 years, 2 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
Index: src/typedarray.js
diff --git a/src/typedarray.js b/src/typedarray.js
index c149b35b98e8926094ae7054b977bc29aed2ee10..2f2495937fab9d34e9b17290c042965e63dee711 100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -291,9 +291,17 @@ function TypedArraySet(obj, offset) {
}
}
+function TypedArrayGetToStringTag() {
+ if (!%IsTypedArray(this)) return;
+ var name = %_ClassOf(this);
+ if (IS_UNDEFINED(name)) return;
+ return name;
+}
+
// -------------------------------------------------------------------
function SetupTypedArrays() {
+ //TypedArrayGetToStringTag
Dmitry Lomov (no reviews) 2014/10/24 08:20:48 Stray comment?
macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
%CheckIsBootstrapping();
%SetCode(global.NAME, NAMEConstructor);
@@ -310,7 +318,7 @@ macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset);
InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength);
InstallGetter(global.NAME.prototype, "length", NAME_GetLength);
-
+ InstallGetter(global.NAME.prototype, symbolToStringTag, TypedArrayGetToStringTag);
InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
"subarray", NAMESubArray,
"set", TypedArraySet
@@ -437,6 +445,8 @@ function SetupDataView() {
// Set up constructor property on the DataView prototype.
%AddNamedProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM);
+ %AddNamedProperty(
+ $DataView.prototype, symbolToStringTag, "DataView", READ_ONLY|DONT_ENUM);
InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS);
InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset);

Powered by Google App Engine
This is Rietveld 408576698