| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 (isolate)->OptionalRescheduleException(call_depth_is_zero); \ | 99 (isolate)->OptionalRescheduleException(call_depth_is_zero); \ |
| 100 do_callback \ | 100 do_callback \ |
| 101 return value; \ | 101 return value; \ |
| 102 } \ | 102 } \ |
| 103 do_callback \ | 103 do_callback \ |
| 104 } while (false) | 104 } while (false) |
| 105 | 105 |
| 106 | 106 |
| 107 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \ | 107 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \ |
| 108 EXCEPTION_BAILOUT_CHECK_GENERIC( \ | 108 EXCEPTION_BAILOUT_CHECK_GENERIC( \ |
| 109 isolate, value, i::V8::FireCallCompletedCallback(isolate);) | 109 isolate, value, isolate->FireCallCompletedCallback();) |
| 110 | 110 |
| 111 | 111 |
| 112 #define EXCEPTION_BAILOUT_CHECK(isolate, value) \ | 112 #define EXCEPTION_BAILOUT_CHECK(isolate, value) \ |
| 113 EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;) | 113 EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;) |
| 114 | 114 |
| 115 | 115 |
| 116 // --- E x c e p t i o n B e h a v i o r --- | 116 // --- E x c e p t i o n B e h a v i o r --- |
| 117 | 117 |
| 118 | 118 |
| 119 void i::FatalProcessOutOfMemory(const char* location) { | 119 void i::FatalProcessOutOfMemory(const char* location) { |
| (...skipping 6364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6484 } | 6484 } |
| 6485 | 6485 |
| 6486 | 6486 |
| 6487 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { | 6487 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { |
| 6488 i::Isolate* isolate = i::Isolate::Current(); | 6488 i::Isolate* isolate = i::Isolate::Current(); |
| 6489 isolate->memory_allocator()->RemoveMemoryAllocationCallback( | 6489 isolate->memory_allocator()->RemoveMemoryAllocationCallback( |
| 6490 callback); | 6490 callback); |
| 6491 } | 6491 } |
| 6492 | 6492 |
| 6493 | 6493 |
| 6494 void V8::AddCallCompletedCallback(CallCompletedCallback callback) { | |
| 6495 if (callback == NULL) return; | |
| 6496 i::V8::AddCallCompletedCallback(callback); | |
| 6497 } | |
| 6498 | |
| 6499 | |
| 6500 void V8::RunMicrotasks(Isolate* isolate) { | 6494 void V8::RunMicrotasks(Isolate* isolate) { |
| 6501 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6495 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6502 i::HandleScope scope(i_isolate); | 6496 i::HandleScope scope(i_isolate); |
| 6503 i::V8::RunMicrotasks(i_isolate); | 6497 i::V8::RunMicrotasks(i_isolate); |
| 6504 } | 6498 } |
| 6505 | 6499 |
| 6506 | 6500 |
| 6507 void V8::EnqueueMicrotask(Isolate* isolate, Handle<Function> microtask) { | 6501 void V8::EnqueueMicrotask(Isolate* isolate, Handle<Function> microtask) { |
| 6508 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6502 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6509 ENTER_V8(i_isolate); | 6503 ENTER_V8(i_isolate); |
| 6510 i::Execution::EnqueueMicrotask(i_isolate, Utils::OpenHandle(*microtask)); | 6504 i::Execution::EnqueueMicrotask(i_isolate, Utils::OpenHandle(*microtask)); |
| 6511 } | 6505 } |
| 6512 | 6506 |
| 6513 | 6507 |
| 6514 void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) { | 6508 void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) { |
| 6515 reinterpret_cast<i::Isolate*>(isolate)->set_autorun_microtasks(autorun); | 6509 reinterpret_cast<i::Isolate*>(isolate)->set_autorun_microtasks(autorun); |
| 6516 } | 6510 } |
| 6517 | 6511 |
| 6518 | 6512 |
| 6519 void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { | |
| 6520 i::V8::RemoveCallCompletedCallback(callback); | |
| 6521 } | |
| 6522 | |
| 6523 | |
| 6524 void V8::TerminateExecution(Isolate* isolate) { | 6513 void V8::TerminateExecution(Isolate* isolate) { |
| 6525 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); | 6514 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); |
| 6526 } | 6515 } |
| 6527 | 6516 |
| 6528 | 6517 |
| 6529 bool V8::IsExecutionTerminating(Isolate* isolate) { | 6518 bool V8::IsExecutionTerminating(Isolate* isolate) { |
| 6530 i::Isolate* i_isolate = isolate != NULL ? | 6519 i::Isolate* i_isolate = isolate != NULL ? |
| 6531 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 6520 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
| 6532 return IsExecutionTerminatingCheck(i_isolate); | 6521 return IsExecutionTerminatingCheck(i_isolate); |
| 6533 } | 6522 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6662 | 6651 |
| 6663 | 6652 |
| 6664 void Isolate::SetEventLogger(LogEventCallback that) { | 6653 void Isolate::SetEventLogger(LogEventCallback that) { |
| 6665 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6654 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6666 isolate->set_event_logger(that); | 6655 isolate->set_event_logger(that); |
| 6667 } | 6656 } |
| 6668 | 6657 |
| 6669 | 6658 |
| 6670 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { | 6659 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { |
| 6671 if (callback == NULL) return; | 6660 if (callback == NULL) return; |
| 6672 // TODO(jochen): Make this per isolate. | 6661 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6673 i::V8::AddCallCompletedCallback(callback); | 6662 isolate->AddCallCompletedCallback(callback); |
| 6674 } | 6663 } |
| 6675 | 6664 |
| 6676 | 6665 |
| 6677 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { | 6666 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { |
| 6678 // TODO(jochen): Make this per isolate. | 6667 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6679 i::V8::RemoveCallCompletedCallback(callback); | 6668 isolate->RemoveCallCompletedCallback(callback); |
| 6680 } | 6669 } |
| 6681 | 6670 |
| 6682 | 6671 |
| 6683 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 6672 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
| 6684 : str_(NULL), length_(0) { | 6673 : str_(NULL), length_(0) { |
| 6685 i::Isolate* isolate = i::Isolate::Current(); | 6674 i::Isolate* isolate = i::Isolate::Current(); |
| 6686 if (obj.IsEmpty()) return; | 6675 if (obj.IsEmpty()) return; |
| 6687 ENTER_V8(isolate); | 6676 ENTER_V8(isolate); |
| 6688 i::HandleScope scope(isolate); | 6677 i::HandleScope scope(isolate); |
| 6689 TryCatch try_catch; | 6678 TryCatch try_catch; |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7614 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7603 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7615 Address callback_address = | 7604 Address callback_address = |
| 7616 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7605 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7617 VMState<EXTERNAL> state(isolate); | 7606 VMState<EXTERNAL> state(isolate); |
| 7618 ExternalCallbackScope call_scope(isolate, callback_address); | 7607 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7619 callback(info); | 7608 callback(info); |
| 7620 } | 7609 } |
| 7621 | 7610 |
| 7622 | 7611 |
| 7623 } } // namespace v8::internal | 7612 } } // namespace v8::internal |
| OLD | NEW |