| 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 4989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5000 ArrayBuffer::Allocator* allocator) { | 5000 ArrayBuffer::Allocator* allocator) { |
| 5001 if (!ApiCheck(i::V8::ArrayBufferAllocator() == NULL, | 5001 if (!ApiCheck(i::V8::ArrayBufferAllocator() == NULL, |
| 5002 "v8::V8::SetArrayBufferAllocator", | 5002 "v8::V8::SetArrayBufferAllocator", |
| 5003 "ArrayBufferAllocator might only be set once")) | 5003 "ArrayBufferAllocator might only be set once")) |
| 5004 return; | 5004 return; |
| 5005 i::V8::SetArrayBufferAllocator(allocator); | 5005 i::V8::SetArrayBufferAllocator(allocator); |
| 5006 } | 5006 } |
| 5007 | 5007 |
| 5008 | 5008 |
| 5009 bool v8::V8::Dispose() { | 5009 bool v8::V8::Dispose() { |
| 5010 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 5010 i::Isolate* isolate = i::Isolate::Current(); |
| 5011 if (!ApiCheck(isolate == NULL || isolate->IsDefaultIsolate(), | 5011 if (!ApiCheck(isolate != NULL && isolate->IsDefaultIsolate(), |
| 5012 "v8::V8::Dispose()", | 5012 "v8::V8::Dispose()", |
| 5013 "Use v8::Isolate::Dispose() for a non-default isolate.")) { | 5013 "Use v8::Isolate::Dispose() for a non-default isolate.")) { |
| 5014 return false; | 5014 return false; |
| 5015 } | 5015 } |
| 5016 return i::V8::TearDown(); | 5016 i::V8::TearDown(); |
| 5017 return true; |
| 5017 } | 5018 } |
| 5018 | 5019 |
| 5019 | 5020 |
| 5020 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 5021 HeapStatistics::HeapStatistics(): total_heap_size_(0), |
| 5021 total_heap_size_executable_(0), | 5022 total_heap_size_executable_(0), |
| 5022 total_physical_size_(0), | 5023 total_physical_size_(0), |
| 5023 used_heap_size_(0), | 5024 used_heap_size_(0), |
| 5024 heap_size_limit_(0) { } | 5025 heap_size_limit_(0) { } |
| 5025 | 5026 |
| 5026 | 5027 |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6480 | 6481 |
| 6481 | 6482 |
| 6482 void V8::CancelTerminateExecution(Isolate* isolate) { | 6483 void V8::CancelTerminateExecution(Isolate* isolate) { |
| 6483 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6484 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6484 i_isolate->stack_guard()->CancelTerminateExecution(); | 6485 i_isolate->stack_guard()->CancelTerminateExecution(); |
| 6485 } | 6486 } |
| 6486 | 6487 |
| 6487 | 6488 |
| 6488 Isolate* Isolate::GetCurrent() { | 6489 Isolate* Isolate::GetCurrent() { |
| 6489 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 6490 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 6490 if (isolate == NULL) { | |
| 6491 isolate = i::Isolate::EnsureDefaultIsolate(true); | |
| 6492 ASSERT(isolate == i::Isolate::UncheckedCurrent()); | |
| 6493 } | |
| 6494 return reinterpret_cast<Isolate*>(isolate); | 6491 return reinterpret_cast<Isolate*>(isolate); |
| 6495 } | 6492 } |
| 6496 | 6493 |
| 6497 | 6494 |
| 6498 Isolate* Isolate::New() { | 6495 Isolate* Isolate::New() { |
| 6499 i::Isolate* isolate = new i::Isolate(); | 6496 i::Isolate* isolate = new i::Isolate(); |
| 6500 return reinterpret_cast<Isolate*>(isolate); | 6497 return reinterpret_cast<Isolate*>(isolate); |
| 6501 } | 6498 } |
| 6502 | 6499 |
| 6503 | 6500 |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7531 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7528 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7532 Address callback_address = | 7529 Address callback_address = |
| 7533 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7530 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7534 VMState<EXTERNAL> state(isolate); | 7531 VMState<EXTERNAL> state(isolate); |
| 7535 ExternalCallbackScope call_scope(isolate, callback_address); | 7532 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7536 callback(info); | 7533 callback(info); |
| 7537 } | 7534 } |
| 7538 | 7535 |
| 7539 | 7536 |
| 7540 } } // namespace v8::internal | 7537 } } // namespace v8::internal |
| OLD | NEW |