OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4935 bool v8::V8::Initialize() { | 4935 bool v8::V8::Initialize() { |
4936 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 4936 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
4937 if (isolate != NULL && isolate->IsInitialized()) { | 4937 if (isolate != NULL && isolate->IsInitialized()) { |
4938 return true; | 4938 return true; |
4939 } | 4939 } |
4940 return InitializeHelper(isolate); | 4940 return InitializeHelper(isolate); |
4941 } | 4941 } |
4942 | 4942 |
4943 | 4943 |
4944 void v8::V8::SetEntropySource(EntropySource entropy_source) { | 4944 void v8::V8::SetEntropySource(EntropySource entropy_source) { |
4945 // The entropy source must be set before the library is initialized, | |
4946 // as otherwise not all random number generators will pick up the | |
4947 // entropy source and will fall back to weak entropy instead. | |
4948 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | |
4949 ApiCheck(isolate != NULL && isolate->IsInitialized(), | |
4950 "v8::V8::SetEntropySource", | |
4951 "Cannot set entropy source once V8 is initialized."); | |
4952 i::RandomNumberGenerator::SetEntropySource(entropy_source); | 4945 i::RandomNumberGenerator::SetEntropySource(entropy_source); |
4953 } | 4946 } |
4954 | 4947 |
4955 | 4948 |
4956 void v8::V8::SetReturnAddressLocationResolver( | 4949 void v8::V8::SetReturnAddressLocationResolver( |
4957 ReturnAddressLocationResolver return_address_resolver) { | 4950 ReturnAddressLocationResolver return_address_resolver) { |
4958 i::V8::SetReturnAddressLocationResolver(return_address_resolver); | 4951 i::V8::SetReturnAddressLocationResolver(return_address_resolver); |
4959 } | 4952 } |
4960 | 4953 |
4961 | 4954 |
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7535 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7528 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7536 Address callback_address = | 7529 Address callback_address = |
7537 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7530 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7538 VMState<EXTERNAL> state(isolate); | 7531 VMState<EXTERNAL> state(isolate); |
7539 ExternalCallbackScope call_scope(isolate, callback_address); | 7532 ExternalCallbackScope call_scope(isolate, callback_address); |
7540 callback(info); | 7533 callback(info); |
7541 } | 7534 } |
7542 | 7535 |
7543 | 7536 |
7544 } } // namespace v8::internal | 7537 } } // namespace v8::internal |
OLD | NEW |