js/src/jit/AsmJSModule.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef jit_AsmJSModule_h
michael@0 8 #define jit_AsmJSModule_h
michael@0 9
michael@0 10 #ifdef JS_ION
michael@0 11
michael@0 12 #include "mozilla/Move.h"
michael@0 13 #include "mozilla/PodOperations.h"
michael@0 14
michael@0 15 #include "jsscript.h"
michael@0 16
michael@0 17 #include "gc/Marking.h"
michael@0 18 #include "jit/AsmJS.h"
michael@0 19 #include "jit/IonMacroAssembler.h"
michael@0 20 #ifdef JS_ION_PERF
michael@0 21 # include "jit/PerfSpewer.h"
michael@0 22 #endif
michael@0 23 #include "jit/RegisterSets.h"
michael@0 24 #include "vm/TypedArrayObject.h"
michael@0 25
michael@0 26 namespace js {
michael@0 27
michael@0 28 // These EcmaScript-defined coercions form the basis of the asm.js type system.
michael@0 29 enum AsmJSCoercion
michael@0 30 {
michael@0 31 AsmJS_ToInt32,
michael@0 32 AsmJS_ToNumber,
michael@0 33 AsmJS_FRound
michael@0 34 };
michael@0 35
michael@0 36 // The asm.js spec recognizes this set of builtin Math functions.
michael@0 37 enum AsmJSMathBuiltinFunction
michael@0 38 {
michael@0 39 AsmJSMathBuiltin_sin, AsmJSMathBuiltin_cos, AsmJSMathBuiltin_tan,
michael@0 40 AsmJSMathBuiltin_asin, AsmJSMathBuiltin_acos, AsmJSMathBuiltin_atan,
michael@0 41 AsmJSMathBuiltin_ceil, AsmJSMathBuiltin_floor, AsmJSMathBuiltin_exp,
michael@0 42 AsmJSMathBuiltin_log, AsmJSMathBuiltin_pow, AsmJSMathBuiltin_sqrt,
michael@0 43 AsmJSMathBuiltin_abs, AsmJSMathBuiltin_atan2, AsmJSMathBuiltin_imul,
michael@0 44 AsmJSMathBuiltin_fround, AsmJSMathBuiltin_min, AsmJSMathBuiltin_max
michael@0 45 };
michael@0 46
michael@0 47 // An asm.js module represents the collection of functions nested inside a
michael@0 48 // single outer "use asm" function. For example, this asm.js module:
michael@0 49 // function() { "use asm"; function f() {} function g() {} return f }
michael@0 50 // contains the functions 'f' and 'g'.
michael@0 51 //
michael@0 52 // An asm.js module contains both the jit-code produced by compiling all the
michael@0 53 // functions in the module as well all the data required to perform the
michael@0 54 // link-time validation step in the asm.js spec.
michael@0 55 //
michael@0 56 // NB: this means that AsmJSModule must be GC-safe.
michael@0 57 class AsmJSModule
michael@0 58 {
michael@0 59 public:
michael@0 60 class Global
michael@0 61 {
michael@0 62 public:
michael@0 63 enum Which { Variable, FFI, ArrayView, MathBuiltinFunction, Constant };
michael@0 64 enum VarInitKind { InitConstant, InitImport };
michael@0 65 enum ConstantKind { GlobalConstant, MathConstant };
michael@0 66
michael@0 67 private:
michael@0 68 struct Pod {
michael@0 69 Which which_;
michael@0 70 union {
michael@0 71 struct {
michael@0 72 uint32_t index_;
michael@0 73 VarInitKind initKind_;
michael@0 74 AsmJSCoercion coercion_;
michael@0 75 union {
michael@0 76 Value constant_; // will only contain int32/double
michael@0 77 } init;
michael@0 78 } var;
michael@0 79 uint32_t ffiIndex_;
michael@0 80 ArrayBufferView::ViewType viewType_;
michael@0 81 AsmJSMathBuiltinFunction mathBuiltinFunc_;
michael@0 82 struct {
michael@0 83 ConstantKind kind_;
michael@0 84 double value_;
michael@0 85 } constant;
michael@0 86 } u;
michael@0 87 } pod;
michael@0 88 PropertyName *name_;
michael@0 89
michael@0 90 friend class AsmJSModule;
michael@0 91
michael@0 92 Global(Which which, PropertyName *name) {
michael@0 93 pod.which_ = which;
michael@0 94 name_ = name;
michael@0 95 JS_ASSERT_IF(name_, name_->isTenured());
michael@0 96 }
michael@0 97
michael@0 98 void trace(JSTracer *trc) {
michael@0 99 if (name_)
michael@0 100 MarkStringUnbarriered(trc, &name_, "asm.js global name");
michael@0 101 JS_ASSERT_IF(pod.which_ == Variable && pod.u.var.initKind_ == InitConstant,
michael@0 102 !pod.u.var.init.constant_.isMarkable());
michael@0 103 }
michael@0 104
michael@0 105 public:
michael@0 106 Global() {}
michael@0 107 Which which() const {
michael@0 108 return pod.which_;
michael@0 109 }
michael@0 110 uint32_t varIndex() const {
michael@0 111 JS_ASSERT(pod.which_ == Variable);
michael@0 112 return pod.u.var.index_;
michael@0 113 }
michael@0 114 VarInitKind varInitKind() const {
michael@0 115 JS_ASSERT(pod.which_ == Variable);
michael@0 116 return pod.u.var.initKind_;
michael@0 117 }
michael@0 118 const Value &varInitConstant() const {
michael@0 119 JS_ASSERT(pod.which_ == Variable);
michael@0 120 JS_ASSERT(pod.u.var.initKind_ == InitConstant);
michael@0 121 return pod.u.var.init.constant_;
michael@0 122 }
michael@0 123 AsmJSCoercion varInitCoercion() const {
michael@0 124 JS_ASSERT(pod.which_ == Variable);
michael@0 125 return pod.u.var.coercion_;
michael@0 126 }
michael@0 127 PropertyName *varImportField() const {
michael@0 128 JS_ASSERT(pod.which_ == Variable);
michael@0 129 JS_ASSERT(pod.u.var.initKind_ == InitImport);
michael@0 130 return name_;
michael@0 131 }
michael@0 132 PropertyName *ffiField() const {
michael@0 133 JS_ASSERT(pod.which_ == FFI);
michael@0 134 return name_;
michael@0 135 }
michael@0 136 uint32_t ffiIndex() const {
michael@0 137 JS_ASSERT(pod.which_ == FFI);
michael@0 138 return pod.u.ffiIndex_;
michael@0 139 }
michael@0 140 PropertyName *viewName() const {
michael@0 141 JS_ASSERT(pod.which_ == ArrayView);
michael@0 142 return name_;
michael@0 143 }
michael@0 144 ArrayBufferView::ViewType viewType() const {
michael@0 145 JS_ASSERT(pod.which_ == ArrayView);
michael@0 146 return pod.u.viewType_;
michael@0 147 }
michael@0 148 PropertyName *mathName() const {
michael@0 149 JS_ASSERT(pod.which_ == MathBuiltinFunction);
michael@0 150 return name_;
michael@0 151 }
michael@0 152 AsmJSMathBuiltinFunction mathBuiltinFunction() const {
michael@0 153 JS_ASSERT(pod.which_ == MathBuiltinFunction);
michael@0 154 return pod.u.mathBuiltinFunc_;
michael@0 155 }
michael@0 156 PropertyName *constantName() const {
michael@0 157 JS_ASSERT(pod.which_ == Constant);
michael@0 158 return name_;
michael@0 159 }
michael@0 160 ConstantKind constantKind() const {
michael@0 161 JS_ASSERT(pod.which_ == Constant);
michael@0 162 return pod.u.constant.kind_;
michael@0 163 }
michael@0 164 double constantValue() const {
michael@0 165 JS_ASSERT(pod.which_ == Constant);
michael@0 166 return pod.u.constant.value_;
michael@0 167 }
michael@0 168
michael@0 169 size_t serializedSize() const;
michael@0 170 uint8_t *serialize(uint8_t *cursor) const;
michael@0 171 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 172 bool clone(ExclusiveContext *cx, Global *out) const;
michael@0 173 };
michael@0 174
michael@0 175 class Exit
michael@0 176 {
michael@0 177 unsigned ffiIndex_;
michael@0 178 unsigned globalDataOffset_;
michael@0 179 unsigned interpCodeOffset_;
michael@0 180 unsigned ionCodeOffset_;
michael@0 181
michael@0 182 friend class AsmJSModule;
michael@0 183
michael@0 184 public:
michael@0 185 Exit() {}
michael@0 186 Exit(unsigned ffiIndex, unsigned globalDataOffset)
michael@0 187 : ffiIndex_(ffiIndex), globalDataOffset_(globalDataOffset),
michael@0 188 interpCodeOffset_(0), ionCodeOffset_(0)
michael@0 189 {}
michael@0 190 unsigned ffiIndex() const {
michael@0 191 return ffiIndex_;
michael@0 192 }
michael@0 193 unsigned globalDataOffset() const {
michael@0 194 return globalDataOffset_;
michael@0 195 }
michael@0 196 void initInterpOffset(unsigned off) {
michael@0 197 JS_ASSERT(!interpCodeOffset_);
michael@0 198 interpCodeOffset_ = off;
michael@0 199 }
michael@0 200 void initIonOffset(unsigned off) {
michael@0 201 JS_ASSERT(!ionCodeOffset_);
michael@0 202 ionCodeOffset_ = off;
michael@0 203 }
michael@0 204 void updateOffsets(jit::MacroAssembler &masm) {
michael@0 205 interpCodeOffset_ = masm.actualOffset(interpCodeOffset_);
michael@0 206 ionCodeOffset_ = masm.actualOffset(ionCodeOffset_);
michael@0 207 }
michael@0 208
michael@0 209 size_t serializedSize() const;
michael@0 210 uint8_t *serialize(uint8_t *cursor) const;
michael@0 211 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 212 bool clone(ExclusiveContext *cx, Exit *out) const;
michael@0 213 };
michael@0 214 typedef int32_t (*CodePtr)(uint64_t *args, uint8_t *global);
michael@0 215
michael@0 216 typedef Vector<AsmJSCoercion, 0, SystemAllocPolicy> ArgCoercionVector;
michael@0 217
michael@0 218 enum ReturnType { Return_Int32, Return_Double, Return_Void };
michael@0 219
michael@0 220 class ExportedFunction
michael@0 221 {
michael@0 222 PropertyName *name_;
michael@0 223 PropertyName *maybeFieldName_;
michael@0 224 ArgCoercionVector argCoercions_;
michael@0 225 struct Pod {
michael@0 226 ReturnType returnType_;
michael@0 227 uint32_t codeOffset_;
michael@0 228 // These two fields are offsets to the beginning of the ScriptSource
michael@0 229 // of the module, and thus invariant under serialization (unlike
michael@0 230 // absolute offsets into ScriptSource).
michael@0 231 uint32_t startOffsetInModule_;
michael@0 232 uint32_t endOffsetInModule_;
michael@0 233 } pod;
michael@0 234
michael@0 235 friend class AsmJSModule;
michael@0 236
michael@0 237 ExportedFunction(PropertyName *name,
michael@0 238 uint32_t startOffsetInModule, uint32_t endOffsetInModule,
michael@0 239 PropertyName *maybeFieldName,
michael@0 240 ArgCoercionVector &&argCoercions,
michael@0 241 ReturnType returnType)
michael@0 242 {
michael@0 243 name_ = name;
michael@0 244 maybeFieldName_ = maybeFieldName;
michael@0 245 argCoercions_ = mozilla::Move(argCoercions);
michael@0 246 pod.returnType_ = returnType;
michael@0 247 pod.codeOffset_ = UINT32_MAX;
michael@0 248 pod.startOffsetInModule_ = startOffsetInModule;
michael@0 249 pod.endOffsetInModule_ = endOffsetInModule;
michael@0 250 JS_ASSERT_IF(maybeFieldName_, name_->isTenured());
michael@0 251 }
michael@0 252
michael@0 253 void trace(JSTracer *trc) {
michael@0 254 MarkStringUnbarriered(trc, &name_, "asm.js export name");
michael@0 255 if (maybeFieldName_)
michael@0 256 MarkStringUnbarriered(trc, &maybeFieldName_, "asm.js export field");
michael@0 257 }
michael@0 258
michael@0 259 public:
michael@0 260 ExportedFunction() {}
michael@0 261 ExportedFunction(ExportedFunction &&rhs) {
michael@0 262 name_ = rhs.name_;
michael@0 263 maybeFieldName_ = rhs.maybeFieldName_;
michael@0 264 argCoercions_ = mozilla::Move(rhs.argCoercions_);
michael@0 265 pod = rhs.pod;
michael@0 266 }
michael@0 267 void updateCodeOffset(jit::MacroAssembler &masm) {
michael@0 268 pod.codeOffset_ = masm.actualOffset(pod.codeOffset_);
michael@0 269 }
michael@0 270
michael@0 271 void initCodeOffset(unsigned off) {
michael@0 272 JS_ASSERT(pod.codeOffset_ == UINT32_MAX);
michael@0 273 pod.codeOffset_ = off;
michael@0 274 }
michael@0 275
michael@0 276 PropertyName *name() const {
michael@0 277 return name_;
michael@0 278 }
michael@0 279 uint32_t startOffsetInModule() const {
michael@0 280 return pod.startOffsetInModule_;
michael@0 281 }
michael@0 282 uint32_t endOffsetInModule() const {
michael@0 283 return pod.endOffsetInModule_;
michael@0 284 }
michael@0 285 PropertyName *maybeFieldName() const {
michael@0 286 return maybeFieldName_;
michael@0 287 }
michael@0 288 unsigned numArgs() const {
michael@0 289 return argCoercions_.length();
michael@0 290 }
michael@0 291 AsmJSCoercion argCoercion(unsigned i) const {
michael@0 292 return argCoercions_[i];
michael@0 293 }
michael@0 294 ReturnType returnType() const {
michael@0 295 return pod.returnType_;
michael@0 296 }
michael@0 297
michael@0 298 size_t serializedSize() const;
michael@0 299 uint8_t *serialize(uint8_t *cursor) const;
michael@0 300 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 301 bool clone(ExclusiveContext *cx, ExportedFunction *out) const;
michael@0 302 };
michael@0 303
michael@0 304 class Name
michael@0 305 {
michael@0 306 PropertyName *name_;
michael@0 307 public:
michael@0 308 Name() : name_(nullptr) {}
michael@0 309 Name(PropertyName *name) : name_(name) {}
michael@0 310 PropertyName *name() const { return name_; }
michael@0 311 PropertyName *&name() { return name_; }
michael@0 312 size_t serializedSize() const;
michael@0 313 uint8_t *serialize(uint8_t *cursor) const;
michael@0 314 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 315 bool clone(ExclusiveContext *cx, Name *out) const;
michael@0 316 };
michael@0 317
michael@0 318 #if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
michael@0 319 // Function information to add to the VTune JIT profiler following linking.
michael@0 320 struct ProfiledFunction
michael@0 321 {
michael@0 322 PropertyName *name;
michael@0 323 struct Pod {
michael@0 324 unsigned startCodeOffset;
michael@0 325 unsigned endCodeOffset;
michael@0 326 unsigned lineno;
michael@0 327 unsigned columnIndex;
michael@0 328 } pod;
michael@0 329
michael@0 330 explicit ProfiledFunction()
michael@0 331 : name(nullptr)
michael@0 332 { }
michael@0 333
michael@0 334 ProfiledFunction(PropertyName *name, unsigned start, unsigned end,
michael@0 335 unsigned line = 0, unsigned column = 0)
michael@0 336 : name(name)
michael@0 337 {
michael@0 338 JS_ASSERT(name->isTenured());
michael@0 339
michael@0 340 pod.startCodeOffset = start;
michael@0 341 pod.endCodeOffset = end;
michael@0 342 pod.lineno = line;
michael@0 343 pod.columnIndex = column;
michael@0 344 }
michael@0 345
michael@0 346 void trace(JSTracer *trc) {
michael@0 347 if (name)
michael@0 348 MarkStringUnbarriered(trc, &name, "asm.js profiled function name");
michael@0 349 }
michael@0 350
michael@0 351 size_t serializedSize() const;
michael@0 352 uint8_t *serialize(uint8_t *cursor) const;
michael@0 353 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 354 };
michael@0 355 #endif
michael@0 356
michael@0 357 #if defined(JS_ION_PERF)
michael@0 358 struct ProfiledBlocksFunction : public ProfiledFunction
michael@0 359 {
michael@0 360 unsigned endInlineCodeOffset;
michael@0 361 jit::BasicBlocksVector blocks;
michael@0 362
michael@0 363 ProfiledBlocksFunction(PropertyName *name, unsigned start, unsigned endInline, unsigned end,
michael@0 364 jit::BasicBlocksVector &blocksVector)
michael@0 365 : ProfiledFunction(name, start, end), endInlineCodeOffset(endInline),
michael@0 366 blocks(mozilla::Move(blocksVector))
michael@0 367 {
michael@0 368 JS_ASSERT(name->isTenured());
michael@0 369 }
michael@0 370
michael@0 371 ProfiledBlocksFunction(ProfiledBlocksFunction &&copy)
michael@0 372 : ProfiledFunction(copy.name, copy.pod.startCodeOffset, copy.pod.endCodeOffset),
michael@0 373 endInlineCodeOffset(copy.endInlineCodeOffset), blocks(mozilla::Move(copy.blocks))
michael@0 374 { }
michael@0 375 };
michael@0 376 #endif
michael@0 377
michael@0 378 struct RelativeLink
michael@0 379 {
michael@0 380 uint32_t patchAtOffset;
michael@0 381 uint32_t targetOffset;
michael@0 382 };
michael@0 383
michael@0 384 typedef Vector<RelativeLink, 0, SystemAllocPolicy> RelativeLinkVector;
michael@0 385
michael@0 386 struct AbsoluteLink
michael@0 387 {
michael@0 388 jit::CodeOffsetLabel patchAt;
michael@0 389 jit::AsmJSImmKind target;
michael@0 390 };
michael@0 391
michael@0 392 typedef Vector<AbsoluteLink, 0, SystemAllocPolicy> AbsoluteLinkVector;
michael@0 393
michael@0 394 // Static-link data is used to patch a module either after it has been
michael@0 395 // compiled or deserialized with various absolute addresses (of code or
michael@0 396 // data in the process) or relative addresses (of code or data in the same
michael@0 397 // AsmJSModule).
michael@0 398 struct StaticLinkData
michael@0 399 {
michael@0 400 uint32_t interruptExitOffset;
michael@0 401 RelativeLinkVector relativeLinks;
michael@0 402 AbsoluteLinkVector absoluteLinks;
michael@0 403
michael@0 404 size_t serializedSize() const;
michael@0 405 uint8_t *serialize(uint8_t *cursor) const;
michael@0 406 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 407 bool clone(ExclusiveContext *cx, StaticLinkData *out) const;
michael@0 408
michael@0 409 size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
michael@0 410 };
michael@0 411
michael@0 412 private:
michael@0 413 typedef Vector<Global, 0, SystemAllocPolicy> GlobalVector;
michael@0 414 typedef Vector<Exit, 0, SystemAllocPolicy> ExitVector;
michael@0 415 typedef Vector<ExportedFunction, 0, SystemAllocPolicy> ExportedFunctionVector;
michael@0 416 typedef Vector<jit::CallSite, 0, SystemAllocPolicy> CallSiteVector;
michael@0 417 typedef Vector<Name, 0, SystemAllocPolicy> FunctionNameVector;
michael@0 418 typedef Vector<jit::AsmJSHeapAccess, 0, SystemAllocPolicy> HeapAccessVector;
michael@0 419 typedef Vector<jit::IonScriptCounts *, 0, SystemAllocPolicy> FunctionCountsVector;
michael@0 420 #if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
michael@0 421 typedef Vector<ProfiledFunction, 0, SystemAllocPolicy> ProfiledFunctionVector;
michael@0 422 #endif
michael@0 423 #if defined(JS_ION_PERF)
michael@0 424 typedef Vector<ProfiledBlocksFunction, 0, SystemAllocPolicy> ProfiledBlocksFunctionVector;
michael@0 425 #endif
michael@0 426
michael@0 427 private:
michael@0 428 PropertyName * globalArgumentName_;
michael@0 429 PropertyName * importArgumentName_;
michael@0 430 PropertyName * bufferArgumentName_;
michael@0 431
michael@0 432 GlobalVector globals_;
michael@0 433 ExitVector exits_;
michael@0 434 ExportedFunctionVector exports_;
michael@0 435 CallSiteVector callSites_;
michael@0 436 FunctionNameVector functionNames_;
michael@0 437 HeapAccessVector heapAccesses_;
michael@0 438 #if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
michael@0 439 ProfiledFunctionVector profiledFunctions_;
michael@0 440 #endif
michael@0 441 #if defined(JS_ION_PERF)
michael@0 442 ProfiledBlocksFunctionVector perfProfiledBlocksFunctions_;
michael@0 443 #endif
michael@0 444
michael@0 445 struct Pod {
michael@0 446 uint32_t funcLength_;
michael@0 447 uint32_t funcLengthWithRightBrace_;
michael@0 448 bool strict_;
michael@0 449 uint32_t numGlobalVars_;
michael@0 450 uint32_t numFFIs_;
michael@0 451 size_t funcPtrTableAndExitBytes_;
michael@0 452 bool hasArrayView_;
michael@0 453 size_t functionBytes_; // just the function bodies, no stubs
michael@0 454 size_t codeBytes_; // function bodies and stubs
michael@0 455 size_t totalBytes_; // function bodies, stubs, and global data
michael@0 456 uint32_t minHeapLength_;
michael@0 457 } pod;
michael@0 458
michael@0 459 uint8_t * code_;
michael@0 460 uint8_t * interruptExit_;
michael@0 461
michael@0 462 StaticLinkData staticLinkData_;
michael@0 463 bool dynamicallyLinked_;
michael@0 464 bool loadedFromCache_;
michael@0 465 HeapPtr<ArrayBufferObject> maybeHeap_;
michael@0 466
michael@0 467 // The next two fields need to be kept out of the Pod as they depend on the
michael@0 468 // position of the module within the ScriptSource and thus aren't invariant
michael@0 469 // with caching.
michael@0 470 uint32_t funcStart_;
michael@0 471 uint32_t offsetToEndOfUseAsm_;
michael@0 472
michael@0 473 ScriptSource * scriptSource_;
michael@0 474
michael@0 475 // This field is accessed concurrently when requesting an interrupt.
michael@0 476 // Access must be synchronized via the runtime's interrupt lock.
michael@0 477 mutable bool codeIsProtected_;
michael@0 478
michael@0 479 public:
michael@0 480 explicit AsmJSModule(ScriptSource *scriptSource, uint32_t functStart,
michael@0 481 uint32_t offsetToEndOfUseAsm, bool strict);
michael@0 482 ~AsmJSModule();
michael@0 483
michael@0 484 void trace(JSTracer *trc) {
michael@0 485 for (unsigned i = 0; i < globals_.length(); i++)
michael@0 486 globals_[i].trace(trc);
michael@0 487 for (unsigned i = 0; i < exports_.length(); i++)
michael@0 488 exports_[i].trace(trc);
michael@0 489 for (unsigned i = 0; i < exits_.length(); i++) {
michael@0 490 if (exitIndexToGlobalDatum(i).fun)
michael@0 491 MarkObject(trc, &exitIndexToGlobalDatum(i).fun, "asm.js imported function");
michael@0 492 }
michael@0 493 for (unsigned i = 0; i < functionNames_.length(); i++)
michael@0 494 MarkStringUnbarriered(trc, &functionNames_[i].name(), "asm.js module function name");
michael@0 495 #if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
michael@0 496 for (unsigned i = 0; i < profiledFunctions_.length(); i++)
michael@0 497 profiledFunctions_[i].trace(trc);
michael@0 498 #endif
michael@0 499 #if defined(JS_ION_PERF)
michael@0 500 for (unsigned i = 0; i < perfProfiledBlocksFunctions_.length(); i++)
michael@0 501 perfProfiledBlocksFunctions_[i].trace(trc);
michael@0 502 #endif
michael@0 503 if (maybeHeap_)
michael@0 504 gc::MarkObject(trc, &maybeHeap_, "asm.js heap");
michael@0 505
michael@0 506 if (globalArgumentName_)
michael@0 507 MarkStringUnbarriered(trc, &globalArgumentName_, "asm.js global argument name");
michael@0 508 if (importArgumentName_)
michael@0 509 MarkStringUnbarriered(trc, &importArgumentName_, "asm.js import argument name");
michael@0 510 if (bufferArgumentName_)
michael@0 511 MarkStringUnbarriered(trc, &bufferArgumentName_, "asm.js buffer argument name");
michael@0 512 }
michael@0 513
michael@0 514 ScriptSource *scriptSource() const {
michael@0 515 JS_ASSERT(scriptSource_ != nullptr);
michael@0 516 return scriptSource_;
michael@0 517 }
michael@0 518
michael@0 519 /*
michael@0 520 * funcStart() refers to the offset in the ScriptSource to the beginning
michael@0 521 * of the function. If the function has been created with the Function
michael@0 522 * constructor, this will be the first character in the function source.
michael@0 523 * Otherwise, it will be the opening parenthesis of the arguments list.
michael@0 524 */
michael@0 525 uint32_t funcStart() const {
michael@0 526 return funcStart_;
michael@0 527 }
michael@0 528 uint32_t offsetToEndOfUseAsm() const {
michael@0 529 return offsetToEndOfUseAsm_;
michael@0 530 }
michael@0 531 void initFuncEnd(uint32_t endBeforeCurly, uint32_t endAfterCurly) {
michael@0 532 JS_ASSERT(endBeforeCurly >= offsetToEndOfUseAsm_);
michael@0 533 JS_ASSERT(endAfterCurly >= offsetToEndOfUseAsm_);
michael@0 534 pod.funcLength_ = endBeforeCurly - funcStart_;
michael@0 535 pod.funcLengthWithRightBrace_ = endAfterCurly - funcStart_;
michael@0 536 }
michael@0 537 uint32_t funcEndBeforeCurly() const {
michael@0 538 return funcStart_ + pod.funcLength_;
michael@0 539 }
michael@0 540 uint32_t funcEndAfterCurly() const {
michael@0 541 return funcStart_ + pod.funcLengthWithRightBrace_;
michael@0 542 }
michael@0 543 bool strict() const {
michael@0 544 return pod.strict_;
michael@0 545 }
michael@0 546
michael@0 547 bool addGlobalVarInit(const Value &v, AsmJSCoercion coercion, uint32_t *globalIndex) {
michael@0 548 JS_ASSERT(pod.funcPtrTableAndExitBytes_ == 0);
michael@0 549 if (pod.numGlobalVars_ == UINT32_MAX)
michael@0 550 return false;
michael@0 551 Global g(Global::Variable, nullptr);
michael@0 552 g.pod.u.var.initKind_ = Global::InitConstant;
michael@0 553 g.pod.u.var.init.constant_ = v;
michael@0 554 g.pod.u.var.coercion_ = coercion;
michael@0 555 g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++;
michael@0 556 return globals_.append(g);
michael@0 557 }
michael@0 558 bool addGlobalVarImport(PropertyName *name, AsmJSCoercion coercion, uint32_t *globalIndex) {
michael@0 559 JS_ASSERT(pod.funcPtrTableAndExitBytes_ == 0);
michael@0 560 Global g(Global::Variable, name);
michael@0 561 g.pod.u.var.initKind_ = Global::InitImport;
michael@0 562 g.pod.u.var.coercion_ = coercion;
michael@0 563 g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++;
michael@0 564 return globals_.append(g);
michael@0 565 }
michael@0 566 bool addFFI(PropertyName *field, uint32_t *ffiIndex) {
michael@0 567 if (pod.numFFIs_ == UINT32_MAX)
michael@0 568 return false;
michael@0 569 Global g(Global::FFI, field);
michael@0 570 g.pod.u.ffiIndex_ = *ffiIndex = pod.numFFIs_++;
michael@0 571 return globals_.append(g);
michael@0 572 }
michael@0 573 bool addArrayView(ArrayBufferView::ViewType vt, PropertyName *field) {
michael@0 574 pod.hasArrayView_ = true;
michael@0 575 Global g(Global::ArrayView, field);
michael@0 576 g.pod.u.viewType_ = vt;
michael@0 577 return globals_.append(g);
michael@0 578 }
michael@0 579 bool addMathBuiltinFunction(AsmJSMathBuiltinFunction func, PropertyName *field) {
michael@0 580 Global g(Global::MathBuiltinFunction, field);
michael@0 581 g.pod.u.mathBuiltinFunc_ = func;
michael@0 582 return globals_.append(g);
michael@0 583 }
michael@0 584 bool addMathBuiltinConstant(double value, PropertyName *field) {
michael@0 585 Global g(Global::Constant, field);
michael@0 586 g.pod.u.constant.value_ = value;
michael@0 587 g.pod.u.constant.kind_ = Global::MathConstant;
michael@0 588 return globals_.append(g);
michael@0 589 }
michael@0 590 bool addGlobalConstant(double value, PropertyName *name) {
michael@0 591 Global g(Global::Constant, name);
michael@0 592 g.pod.u.constant.value_ = value;
michael@0 593 g.pod.u.constant.kind_ = Global::GlobalConstant;
michael@0 594 return globals_.append(g);
michael@0 595 }
michael@0 596 bool addFuncPtrTable(unsigned numElems, uint32_t *globalDataOffset) {
michael@0 597 JS_ASSERT(IsPowerOfTwo(numElems));
michael@0 598 if (SIZE_MAX - pod.funcPtrTableAndExitBytes_ < numElems * sizeof(void*))
michael@0 599 return false;
michael@0 600 *globalDataOffset = globalDataBytes();
michael@0 601 pod.funcPtrTableAndExitBytes_ += numElems * sizeof(void*);
michael@0 602 return true;
michael@0 603 }
michael@0 604 bool addExit(unsigned ffiIndex, unsigned *exitIndex) {
michael@0 605 if (SIZE_MAX - pod.funcPtrTableAndExitBytes_ < sizeof(ExitDatum))
michael@0 606 return false;
michael@0 607 uint32_t globalDataOffset = globalDataBytes();
michael@0 608 JS_STATIC_ASSERT(sizeof(ExitDatum) % sizeof(void*) == 0);
michael@0 609 pod.funcPtrTableAndExitBytes_ += sizeof(ExitDatum);
michael@0 610 *exitIndex = unsigned(exits_.length());
michael@0 611 return exits_.append(Exit(ffiIndex, globalDataOffset));
michael@0 612 }
michael@0 613
michael@0 614 bool addExportedFunction(PropertyName *name, uint32_t srcStart, uint32_t srcEnd,
michael@0 615 PropertyName *maybeFieldName,
michael@0 616 ArgCoercionVector &&argCoercions,
michael@0 617 ReturnType returnType)
michael@0 618 {
michael@0 619 ExportedFunction func(name, srcStart, srcEnd, maybeFieldName,
michael@0 620 mozilla::Move(argCoercions), returnType);
michael@0 621 if (exports_.length() >= UINT32_MAX)
michael@0 622 return false;
michael@0 623 return exports_.append(mozilla::Move(func));
michael@0 624 }
michael@0 625 unsigned numExportedFunctions() const {
michael@0 626 return exports_.length();
michael@0 627 }
michael@0 628 const ExportedFunction &exportedFunction(unsigned i) const {
michael@0 629 return exports_[i];
michael@0 630 }
michael@0 631 ExportedFunction &exportedFunction(unsigned i) {
michael@0 632 return exports_[i];
michael@0 633 }
michael@0 634 CodePtr entryTrampoline(const ExportedFunction &func) const {
michael@0 635 JS_ASSERT(func.pod.codeOffset_ != UINT32_MAX);
michael@0 636 return JS_DATA_TO_FUNC_PTR(CodePtr, code_ + func.pod.codeOffset_);
michael@0 637 }
michael@0 638
michael@0 639 bool addFunctionName(PropertyName *name, uint32_t *nameIndex) {
michael@0 640 JS_ASSERT(name->isTenured());
michael@0 641 if (functionNames_.length() > jit::CallSiteDesc::FUNCTION_NAME_INDEX_MAX)
michael@0 642 return false;
michael@0 643 *nameIndex = functionNames_.length();
michael@0 644 return functionNames_.append(name);
michael@0 645 }
michael@0 646 PropertyName *functionName(uint32_t i) const {
michael@0 647 return functionNames_[i].name();
michael@0 648 }
michael@0 649
michael@0 650 #if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
michael@0 651 bool trackProfiledFunction(PropertyName *name, unsigned startCodeOffset, unsigned endCodeOffset,
michael@0 652 unsigned line, unsigned column)
michael@0 653 {
michael@0 654 ProfiledFunction func(name, startCodeOffset, endCodeOffset, line, column);
michael@0 655 return profiledFunctions_.append(func);
michael@0 656 }
michael@0 657 unsigned numProfiledFunctions() const {
michael@0 658 return profiledFunctions_.length();
michael@0 659 }
michael@0 660 ProfiledFunction &profiledFunction(unsigned i) {
michael@0 661 return profiledFunctions_[i];
michael@0 662 }
michael@0 663 #endif
michael@0 664
michael@0 665 #ifdef JS_ION_PERF
michael@0 666 bool trackPerfProfiledBlocks(PropertyName *name, unsigned startCodeOffset, unsigned endInlineCodeOffset,
michael@0 667 unsigned endCodeOffset, jit::BasicBlocksVector &basicBlocks) {
michael@0 668 ProfiledBlocksFunction func(name, startCodeOffset, endInlineCodeOffset, endCodeOffset, basicBlocks);
michael@0 669 return perfProfiledBlocksFunctions_.append(mozilla::Move(func));
michael@0 670 }
michael@0 671 unsigned numPerfBlocksFunctions() const {
michael@0 672 return perfProfiledBlocksFunctions_.length();
michael@0 673 }
michael@0 674 ProfiledBlocksFunction &perfProfiledBlocksFunction(unsigned i) {
michael@0 675 return perfProfiledBlocksFunctions_[i];
michael@0 676 }
michael@0 677 #endif
michael@0 678
michael@0 679 bool hasArrayView() const {
michael@0 680 return pod.hasArrayView_;
michael@0 681 }
michael@0 682 unsigned numFFIs() const {
michael@0 683 return pod.numFFIs_;
michael@0 684 }
michael@0 685 unsigned numGlobalVars() const {
michael@0 686 return pod.numGlobalVars_;
michael@0 687 }
michael@0 688 unsigned numGlobals() const {
michael@0 689 return globals_.length();
michael@0 690 }
michael@0 691 Global &global(unsigned i) {
michael@0 692 return globals_[i];
michael@0 693 }
michael@0 694 unsigned numExits() const {
michael@0 695 return exits_.length();
michael@0 696 }
michael@0 697 Exit &exit(unsigned i) {
michael@0 698 return exits_[i];
michael@0 699 }
michael@0 700 const Exit &exit(unsigned i) const {
michael@0 701 return exits_[i];
michael@0 702 }
michael@0 703 uint8_t *interpExitTrampoline(const Exit &exit) const {
michael@0 704 JS_ASSERT(exit.interpCodeOffset_);
michael@0 705 return code_ + exit.interpCodeOffset_;
michael@0 706 }
michael@0 707 uint8_t *ionExitTrampoline(const Exit &exit) const {
michael@0 708 JS_ASSERT(exit.ionCodeOffset_);
michael@0 709 return code_ + exit.ionCodeOffset_;
michael@0 710 }
michael@0 711
michael@0 712 // An Exit holds bookkeeping information about an exit; the ExitDatum
michael@0 713 // struct overlays the actual runtime data stored in the global data
michael@0 714 // section.
michael@0 715 struct ExitDatum
michael@0 716 {
michael@0 717 uint8_t *exit;
michael@0 718 HeapPtrFunction fun;
michael@0 719 };
michael@0 720
michael@0 721 // Global data section
michael@0 722 //
michael@0 723 // The global data section is placed after the executable code (i.e., at
michael@0 724 // offset codeBytes_) in the module's linear allocation. The global data
michael@0 725 // are laid out in this order:
michael@0 726 // 0. a pointer/descriptor for the heap that was linked to the module
michael@0 727 // 1. global variable state (elements are sizeof(uint64_t))
michael@0 728 // 2. interleaved function-pointer tables and exits. These are allocated
michael@0 729 // while type checking function bodies (as exits and uses of
michael@0 730 // function-pointer tables are encountered).
michael@0 731 size_t offsetOfGlobalData() const {
michael@0 732 JS_ASSERT(code_);
michael@0 733 return pod.codeBytes_;
michael@0 734 }
michael@0 735 uint8_t *globalData() const {
michael@0 736 return code_ + offsetOfGlobalData();
michael@0 737 }
michael@0 738 size_t globalDataBytes() const {
michael@0 739 return sizeof(void*) +
michael@0 740 pod.numGlobalVars_ * sizeof(uint64_t) +
michael@0 741 pod.funcPtrTableAndExitBytes_;
michael@0 742 }
michael@0 743 unsigned heapOffset() const {
michael@0 744 return 0;
michael@0 745 }
michael@0 746 uint8_t *&heapDatum() const {
michael@0 747 return *(uint8_t**)(globalData() + heapOffset());
michael@0 748 }
michael@0 749 unsigned globalVarIndexToGlobalDataOffset(unsigned i) const {
michael@0 750 JS_ASSERT(i < pod.numGlobalVars_);
michael@0 751 return sizeof(void*) +
michael@0 752 i * sizeof(uint64_t);
michael@0 753 }
michael@0 754 void *globalVarIndexToGlobalDatum(unsigned i) const {
michael@0 755 return (void *)(globalData() + globalVarIndexToGlobalDataOffset(i));
michael@0 756 }
michael@0 757 uint8_t **globalDataOffsetToFuncPtrTable(unsigned globalDataOffset) const {
michael@0 758 JS_ASSERT(globalDataOffset < globalDataBytes());
michael@0 759 return (uint8_t **)(globalData() + globalDataOffset);
michael@0 760 }
michael@0 761 unsigned exitIndexToGlobalDataOffset(unsigned exitIndex) const {
michael@0 762 return exits_[exitIndex].globalDataOffset();
michael@0 763 }
michael@0 764 ExitDatum &exitIndexToGlobalDatum(unsigned exitIndex) const {
michael@0 765 return *(ExitDatum *)(globalData() + exitIndexToGlobalDataOffset(exitIndex));
michael@0 766 }
michael@0 767
michael@0 768 void initFunctionBytes(size_t functionBytes) {
michael@0 769 JS_ASSERT(pod.functionBytes_ == 0);
michael@0 770 pod.functionBytes_ = functionBytes;
michael@0 771 }
michael@0 772 void updateFunctionBytes(jit::MacroAssembler &masm) {
michael@0 773 pod.functionBytes_ = masm.actualOffset(pod.functionBytes_);
michael@0 774 JS_ASSERT(pod.functionBytes_ % AsmJSPageSize == 0);
michael@0 775 }
michael@0 776 size_t functionBytes() const {
michael@0 777 JS_ASSERT(pod.functionBytes_);
michael@0 778 JS_ASSERT(pod.functionBytes_ % AsmJSPageSize == 0);
michael@0 779 return pod.functionBytes_;
michael@0 780 }
michael@0 781 bool containsPC(void *pc) const {
michael@0 782 return pc >= code_ && pc < (code_ + functionBytes());
michael@0 783 }
michael@0 784
michael@0 785 void assignHeapAccesses(jit::AsmJSHeapAccessVector &&accesses) {
michael@0 786 heapAccesses_ = Move(accesses);
michael@0 787 }
michael@0 788 unsigned numHeapAccesses() const {
michael@0 789 return heapAccesses_.length();
michael@0 790 }
michael@0 791 const jit::AsmJSHeapAccess &heapAccess(unsigned i) const {
michael@0 792 return heapAccesses_[i];
michael@0 793 }
michael@0 794 jit::AsmJSHeapAccess &heapAccess(unsigned i) {
michael@0 795 return heapAccesses_[i];
michael@0 796 }
michael@0 797
michael@0 798 void assignCallSites(jit::CallSiteVector &&callsites) {
michael@0 799 callSites_ = Move(callsites);
michael@0 800 }
michael@0 801 unsigned numCallSites() const {
michael@0 802 return callSites_.length();
michael@0 803 }
michael@0 804 const jit::CallSite &callSite(unsigned i) const {
michael@0 805 return callSites_[i];
michael@0 806 }
michael@0 807 jit::CallSite &callSite(unsigned i) {
michael@0 808 return callSites_[i];
michael@0 809 }
michael@0 810
michael@0 811 void initHeap(Handle<ArrayBufferObject*> heap, JSContext *cx);
michael@0 812
michael@0 813 void requireHeapLengthToBeAtLeast(uint32_t len) {
michael@0 814 if (len > pod.minHeapLength_)
michael@0 815 pod.minHeapLength_ = len;
michael@0 816 }
michael@0 817 uint32_t minHeapLength() const {
michael@0 818 return pod.minHeapLength_;
michael@0 819 }
michael@0 820
michael@0 821 bool allocateAndCopyCode(ExclusiveContext *cx, jit::MacroAssembler &masm);
michael@0 822
michael@0 823 // StaticLinkData setters (called after finishing compilation, before
michael@0 824 // staticLink).
michael@0 825 bool addRelativeLink(RelativeLink link) {
michael@0 826 return staticLinkData_.relativeLinks.append(link);
michael@0 827 }
michael@0 828 bool addAbsoluteLink(AbsoluteLink link) {
michael@0 829 return staticLinkData_.absoluteLinks.append(link);
michael@0 830 }
michael@0 831 void setInterruptOffset(uint32_t offset) {
michael@0 832 staticLinkData_.interruptExitOffset = offset;
michael@0 833 }
michael@0 834
michael@0 835 void restoreToInitialState(ArrayBufferObject *maybePrevBuffer, ExclusiveContext *cx);
michael@0 836 void setAutoFlushICacheRange();
michael@0 837 void staticallyLink(ExclusiveContext *cx);
michael@0 838
michael@0 839 uint8_t *codeBase() const {
michael@0 840 JS_ASSERT(code_);
michael@0 841 JS_ASSERT(uintptr_t(code_) % AsmJSPageSize == 0);
michael@0 842 return code_;
michael@0 843 }
michael@0 844
michael@0 845 uint8_t *interruptExit() const {
michael@0 846 return interruptExit_;
michael@0 847 }
michael@0 848
michael@0 849 void setIsDynamicallyLinked() {
michael@0 850 JS_ASSERT(!dynamicallyLinked_);
michael@0 851 dynamicallyLinked_ = true;
michael@0 852 }
michael@0 853 bool isDynamicallyLinked() const {
michael@0 854 return dynamicallyLinked_;
michael@0 855 }
michael@0 856 uint8_t *maybeHeap() const {
michael@0 857 JS_ASSERT(dynamicallyLinked_);
michael@0 858 return heapDatum();
michael@0 859 }
michael@0 860 ArrayBufferObject *maybeHeapBufferObject() const {
michael@0 861 JS_ASSERT(dynamicallyLinked_);
michael@0 862 return maybeHeap_;
michael@0 863 }
michael@0 864 size_t heapLength() const {
michael@0 865 JS_ASSERT(dynamicallyLinked_);
michael@0 866 return maybeHeap_ ? maybeHeap_->byteLength() : 0;
michael@0 867 }
michael@0 868
michael@0 869 void initGlobalArgumentName(PropertyName *n) {
michael@0 870 JS_ASSERT_IF(n, n->isTenured());
michael@0 871 globalArgumentName_ = n;
michael@0 872 }
michael@0 873 void initImportArgumentName(PropertyName *n) {
michael@0 874 JS_ASSERT_IF(n, n->isTenured());
michael@0 875 importArgumentName_ = n;
michael@0 876 }
michael@0 877 void initBufferArgumentName(PropertyName *n) {
michael@0 878 JS_ASSERT_IF(n, n->isTenured());
michael@0 879 bufferArgumentName_ = n;
michael@0 880 }
michael@0 881
michael@0 882 PropertyName *globalArgumentName() const {
michael@0 883 return globalArgumentName_;
michael@0 884 }
michael@0 885 PropertyName *importArgumentName() const {
michael@0 886 return importArgumentName_;
michael@0 887 }
michael@0 888 PropertyName *bufferArgumentName() const {
michael@0 889 return bufferArgumentName_;
michael@0 890 }
michael@0 891
michael@0 892 void detachIonCompilation(size_t exitIndex) const {
michael@0 893 exitIndexToGlobalDatum(exitIndex).exit = interpExitTrampoline(exit(exitIndex));
michael@0 894 }
michael@0 895
michael@0 896 void addSizeOfMisc(mozilla::MallocSizeOf mallocSizeOf, size_t *asmJSModuleCode,
michael@0 897 size_t *asmJSModuleData);
michael@0 898
michael@0 899 size_t serializedSize() const;
michael@0 900 uint8_t *serialize(uint8_t *cursor) const;
michael@0 901 const uint8_t *deserialize(ExclusiveContext *cx, const uint8_t *cursor);
michael@0 902 bool loadedFromCache() const { return loadedFromCache_; }
michael@0 903
michael@0 904 bool clone(JSContext *cx, ScopedJSDeletePtr<AsmJSModule> *moduleOut) const;
michael@0 905
michael@0 906 // These methods may only be called while holding the Runtime's interrupt
michael@0 907 // lock.
michael@0 908 void protectCode(JSRuntime *rt) const;
michael@0 909 void unprotectCode(JSRuntime *rt) const;
michael@0 910 bool codeIsProtected(JSRuntime *rt) const;
michael@0 911 };
michael@0 912
michael@0 913 // Store the just-parsed module in the cache using AsmJSCacheOps.
michael@0 914 extern bool
michael@0 915 StoreAsmJSModuleInCache(AsmJSParser &parser,
michael@0 916 const AsmJSModule &module,
michael@0 917 ExclusiveContext *cx);
michael@0 918
michael@0 919 // Attempt to load the asm.js module that is about to be parsed from the cache
michael@0 920 // using AsmJSCacheOps. On cache hit, *module will be non-null. Note: the
michael@0 921 // return value indicates whether or not an error was encountered, not whether
michael@0 922 // there was a cache hit.
michael@0 923 extern bool
michael@0 924 LookupAsmJSModuleInCache(ExclusiveContext *cx,
michael@0 925 AsmJSParser &parser,
michael@0 926 ScopedJSDeletePtr<AsmJSModule> *module,
michael@0 927 ScopedJSFreePtr<char> *compilationTimeReport);
michael@0 928
michael@0 929 // An AsmJSModuleObject is an internal implementation object (i.e., not exposed
michael@0 930 // directly to user script) which manages the lifetime of an AsmJSModule. A
michael@0 931 // JSObject is necessary since we want LinkAsmJS/CallAsmJS JSFunctions to be
michael@0 932 // able to point to their module via their extended slots.
michael@0 933 class AsmJSModuleObject : public JSObject
michael@0 934 {
michael@0 935 static const unsigned MODULE_SLOT = 0;
michael@0 936
michael@0 937 public:
michael@0 938 static const unsigned RESERVED_SLOTS = 1;
michael@0 939
michael@0 940 // On success, return an AsmJSModuleClass JSObject that has taken ownership
michael@0 941 // (and release()ed) the given module.
michael@0 942 static AsmJSModuleObject *create(ExclusiveContext *cx, ScopedJSDeletePtr<AsmJSModule> *module);
michael@0 943
michael@0 944 AsmJSModule &module() const;
michael@0 945
michael@0 946 void addSizeOfMisc(mozilla::MallocSizeOf mallocSizeOf, size_t *asmJSModuleCode,
michael@0 947 size_t *asmJSModuleData) {
michael@0 948 module().addSizeOfMisc(mallocSizeOf, asmJSModuleCode, asmJSModuleData);
michael@0 949 }
michael@0 950
michael@0 951 static const Class class_;
michael@0 952 };
michael@0 953
michael@0 954 } // namespace js
michael@0 955
michael@0 956 #endif // JS_ION
michael@0 957
michael@0 958 #endif /* jit_AsmJSModule_h */

mercurial