|
|
|
|
| 1 |
# HG changeset patch |
1 |
# HG changeset patch |
| 2 |
# Parent 5f79304fcefe891a964f2d03212db895a405ba13 |
2 |
# Parent 3673d2c688b44ba9e5914e4f7202d30764700b47 |
| 3 |
# User Nikhil Marathe <nsm.nikhil@gmail.com> |
3 |
# User Nikhil Marathe <nsm.nikhil@gmail.com> |
| 4 |
Bug 578700 - Binary Data initialize architecture. |
4 |
Bug 578700 - Binary Data initialize architecture. |
| 5 |
|
5 |
|
| 6 |
diff --git a/js/src/Makefile.in b/js/src/Makefile.in |
6 |
diff --git a/js/src/Makefile.in b/js/src/Makefile.in |
| 7 |
--- a/js/src/Makefile.in |
7 |
--- a/js/src/Makefile.in |
| 8 |
+++ b/js/src/Makefile.in |
8 |
+++ b/js/src/Makefile.in |
| 9 |
@@ -67,16 +67,20 @@ VPATH += \ |
9 |
@@ -67,16 +67,20 @@ VPATH += \ |
| 10 |
|
10 |
|
|
|
| 232 |
+ if (!InitComplexClasses(cx, global)) |
232 |
+ if (!InitComplexClasses(cx, global)) |
| 233 |
+ return NULL; |
233 |
+ return NULL; |
| 234 |
+ return global; |
234 |
+ return global; |
| 235 |
+} |
235 |
+} |
| 236 |
diff --git a/js/src/builtin/BinaryData.h b/js/src/builtin/BinaryData.h |
236 |
diff --git a/js/src/builtin/BinaryData.h b/js/src/builtin/BinaryData.h |
| 237 |
new file mode 100644 |
237 |
new file mode 100644 |
| 238 |
--- /dev/null |
238 |
--- /dev/null |
| 239 |
+++ b/js/src/builtin/BinaryData.h |
239 |
+++ b/js/src/builtin/BinaryData.h |
| 240 |
@@ -0,0 +1,106 @@ |
240 |
@@ -0,0 +1,103 @@ |
| 241 |
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
241 |
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 242 |
+ */ |
242 |
+ */ |
| 243 |
+/* This Source Code Form is subject to the terms of the Mozilla Public |
243 |
+/* This Source Code Form is subject to the terms of the Mozilla Public |
| 244 |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
244 |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 245 |
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
245 |
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 246 |
+ |
246 |
+ |
| 247 |
+#ifndef builtin_BinaryData_h |
247 |
+#ifndef builtin_BinaryData_h |
| 248 |
+#define builtin_BinaryData_h |
248 |
+#define builtin_BinaryData_h |
|
|
| 335 |
+ |
335 |
+ |
| 336 |
+class ArrayTypeObject : public JSObject |
336 |
+class ArrayTypeObject : public JSObject |
| 337 |
+{ |
337 |
+{ |
| 338 |
+ public: |
338 |
+ public: |
| 339 |
+ static JSBool repeat(JSContext *cx, unsigned int argc, jsval *vp); |
339 |
+ static JSBool repeat(JSContext *cx, unsigned int argc, jsval *vp); |
| 340 |
+}; |
340 |
+}; |
| 341 |
+} |
341 |
+} |
| 342 |
+ |
342 |
+ |
| 343 |
+extern JS_FRIEND_API(JSObject *) |
|
|
| 344 |
+js_InitBinaryDataClasses(JSContext *cx, js::HandleObject obj); |
| 345 |
+ |
| 346 |
+#endif /* builtin_BinaryData_h */ |
343 |
+#endif /* builtin_BinaryData_h */ |
| 347 |
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp |
344 |
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp |
| 348 |
--- a/js/src/builtin/TestingFunctions.cpp |
345 |
--- a/js/src/builtin/TestingFunctions.cpp |
| 349 |
+++ b/js/src/builtin/TestingFunctions.cpp |
346 |
+++ b/js/src/builtin/TestingFunctions.cpp |
| 350 |
@@ -172,16 +172,24 @@ GetBuildConfiguration(JSContext *cx, uns |
347 |
@@ -172,16 +172,24 @@ GetBuildConfiguration(JSContext *cx, uns |
| 351 |
#ifdef ENABLE_PARALLEL_JS |
348 |
#ifdef ENABLE_PARALLEL_JS |
| 352 |
value = BooleanValue(true); |
349 |
value = BooleanValue(true); |
| 353 |
#else |
350 |
#else |
|
Lines 388-430
diff --git a/js/src/jsapi.cpp b/js/src/j
|
Link Here
|
|---|
|
| 388 |
#include "builtin/Eval.h" |
385 |
#include "builtin/Eval.h" |
| 389 |
#include "builtin/Intl.h" |
386 |
#include "builtin/Intl.h" |
| 390 |
#include "builtin/MapObject.h" |
387 |
#include "builtin/MapObject.h" |
| 391 |
#include "builtin/RegExp.h" |
388 |
#include "builtin/RegExp.h" |
| 392 |
#include "builtin/ParallelArray.h" |
389 |
#include "builtin/ParallelArray.h" |
| 393 |
#include "frontend/BytecodeCompiler.h" |
390 |
#include "frontend/BytecodeCompiler.h" |
| 394 |
#include "frontend/FullParseHandler.h" // for JS_BufferIsCompileableUnit |
391 |
#include "frontend/FullParseHandler.h" // for JS_BufferIsCompileableUnit |
| 395 |
#include "frontend/Parser.h" // for JS_BufferIsCompileableUnit |
392 |
#include "frontend/Parser.h" // for JS_BufferIsCompileableUnit |
| 396 |
@@ -1777,16 +1778,26 @@ static const JSStdName standard_class_at |
393 |
@@ -1777,16 +1778,19 @@ static const JSStdName standard_class_at |
| 397 |
{js_InitSetClass, EAGER_ATOM_AND_OCLASP(Set)}, |
394 |
{js_InitSetClass, EAGER_ATOM_AND_OCLASP(Set)}, |
| 398 |
#ifdef ENABLE_PARALLEL_JS |
395 |
#ifdef ENABLE_PARALLEL_JS |
| 399 |
{js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)}, |
396 |
{js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)}, |
| 400 |
#endif |
397 |
#endif |
| 401 |
{js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)}, |
398 |
{js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)}, |
| 402 |
#if ENABLE_INTL_API |
399 |
#if ENABLE_INTL_API |
| 403 |
{js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)}, |
400 |
{js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)}, |
| 404 |
#endif |
401 |
#endif |
| 405 |
+#ifdef ENABLE_BINARYDATA |
402 |
+#ifdef ENABLE_BINARYDATA |
| 406 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(Type)}, |
403 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(Type)}, |
| 407 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(Data)}, |
|
|
| 408 |
+#define BINARYDATA_NUMERIC_NAMES(type_)\ |
| 409 |
+ {js_InitBinaryDataClasses, EAGER_CLASS_ATOM(type_), CLASP(type_##Block)}, |
| 410 |
+ BINARYDATA_FOR_EACH_NUMERIC_TYPES(BINARYDATA_NUMERIC_NAMES) |
| 411 |
+#undef BINARYDATA_NUMERIC_NAMES |
| 412 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(ArrayType)}, |
| 413 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(StructType)}, |
| 414 |
+#endif |
404 |
+#endif |
| 415 |
{NULL, 0, NULL} |
405 |
{NULL, 0, NULL} |
| 416 |
}; |
406 |
}; |
| 417 |
|
407 |
|
| 418 |
/* |
408 |
/* |
| 419 |
* Table of top-level function and constant names and their init functions. |
409 |
* Table of top-level function and constant names and their init functions. |
| 420 |
* If you add a "standard" global function or property, remember to update |
410 |
* If you add a "standard" global function or property, remember to update |
| 421 |
* this table. |
411 |
* this table. |
| 422 |
*/ |
412 |
*/ |
|
|
413 |
@@ -1833,16 +1837,27 @@ static const JSStdName standard_class_na |
| 414 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(Int32Array), TYPED_ARRAY_CLASP(TYPE_INT32)}, |
| 415 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(Uint32Array), TYPED_ARRAY_CLASP(TYPE_UINT32)}, |
| 416 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(Float32Array), TYPED_ARRAY_CLASP(TYPE_FLOAT32)}, |
| 417 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(Float64Array), TYPED_ARRAY_CLASP(TYPE_FLOAT64)}, |
| 418 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(Uint8ClampedArray), |
| 419 |
TYPED_ARRAY_CLASP(TYPE_UINT8_CLAMPED)}, |
| 420 |
{js_InitTypedArrayClasses, EAGER_CLASS_ATOM(DataView), &DataViewObject::class_}, |
| 421 |
|
| 422 |
+ /* Binary Data */ |
| 423 |
+#ifdef ENABLE_BINARYDATA |
| 424 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(Type)}, |
| 425 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(Data)}, |
| 426 |
+#define BINARYDATA_NUMERIC_NAMES(type_)\ |
| 427 |
+ {js_InitBinaryDataClasses, EAGER_CLASS_ATOM(type_), CLASP(type_##Block)}, |
| 428 |
+ BINARYDATA_FOR_EACH_NUMERIC_TYPES(BINARYDATA_NUMERIC_NAMES) |
| 429 |
+#undef BINARYDATA_NUMERIC_NAMES |
| 430 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(ArrayType)}, |
| 431 |
+ {js_InitBinaryDataClasses, EAGER_ATOM_AND_CLASP(StructType)}, |
| 432 |
+#endif |
| 433 |
{NULL, 0, NULL} |
| 434 |
}; |
| 435 |
|
| 436 |
static const JSStdName object_prototype_names[] = { |
| 437 |
/* Object.prototype properties (global delegates to Object.prototype). */ |
| 438 |
{js_InitObjectClass, EAGER_ATOM(proto), &JSObject::class_}, |
| 439 |
#if JS_HAS_TOSOURCE |
| 440 |
{js_InitObjectClass, EAGER_ATOM(toSource), &JSObject::class_}, |
| 423 |
diff --git a/js/src/jsprototypes.h b/js/src/jsprototypes.h |
441 |
diff --git a/js/src/jsprototypes.h b/js/src/jsprototypes.h |
| 424 |
--- a/js/src/jsprototypes.h |
442 |
--- a/js/src/jsprototypes.h |
| 425 |
+++ b/js/src/jsprototypes.h |
443 |
+++ b/js/src/jsprototypes.h |
| 426 |
@@ -51,10 +51,24 @@ |
444 |
@@ -51,10 +51,24 @@ |
| 427 |
macro(Uint8ClampedArray, 30, js_InitTypedArrayClasses) \ |
445 |
macro(Uint8ClampedArray, 30, js_InitTypedArrayClasses) \ |
| 428 |
macro(Proxy, 31, js_InitProxyClass) \ |
446 |
macro(Proxy, 31, js_InitProxyClass) \ |
| 429 |
macro(WeakMap, 32, js_InitWeakMapClass) \ |
447 |
macro(WeakMap, 32, js_InitWeakMapClass) \ |
| 430 |
macro(Map, 33, js_InitMapClass) \ |
448 |
macro(Map, 33, js_InitMapClass) \ |