| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VM_BIGINT_STORE_H_ | |
| 6 #define VM_BIGINT_STORE_H_ | |
| 7 | |
| 8 #include "vm/globals.h" | |
| 9 #include "vm/isolate.h" | |
| 10 | |
| 11 namespace dart { | |
| 12 | |
| 13 // Use to store teporary BIGNUMs. | |
| 14 class BigintStore { | |
| 15 public: | |
| 16 BigintStore() : bn_(NULL), bn_ctx_(NULL) {} | |
| 17 ~BigintStore() { | |
| 18 BN_free(bn_); | |
| 19 BN_CTX_free(bn_ctx_); | |
| 20 } | |
| 21 | |
| 22 static BigintStore* Get() { | |
| 23 BigintStore* store = Isolate::Current()->bigint_store(); | |
| 24 if (store == NULL) { | |
| 25 store = new BigintStore(); | |
| 26 Isolate::Current()->set_bigint_store(store); | |
| 27 } | |
| 28 return store; | |
| 29 } | |
| 30 | |
| 31 BIGNUM* bn_; | |
| 32 BN_CTX* bn_ctx_; | |
| 33 }; | |
| 34 | |
| 35 } // namespace dart | |
| 36 | |
| 37 #endif // VM_BIGINT_STORE_H_ | |
| OLD | NEW |