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 5392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5403 v8::Local<v8::Context> Context::GetCalling() { | 5403 v8::Local<v8::Context> Context::GetCalling() { |
5404 i::Isolate* isolate = i::Isolate::Current(); | 5404 i::Isolate* isolate = i::Isolate::Current(); |
5405 return reinterpret_cast<Isolate*>(isolate)->GetCallingContext(); | 5405 return reinterpret_cast<Isolate*>(isolate)->GetCallingContext(); |
5406 } | 5406 } |
5407 | 5407 |
5408 | 5408 |
5409 v8::Local<v8::Object> Context::Global() { | 5409 v8::Local<v8::Object> Context::Global() { |
5410 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5410 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5411 i::Isolate* isolate = context->GetIsolate(); | 5411 i::Isolate* isolate = context->GetIsolate(); |
5412 i::Handle<i::Object> global(context->global_proxy(), isolate); | 5412 i::Handle<i::Object> global(context->global_proxy(), isolate); |
| 5413 ASSERT(!i::Handle<i::JSGlobalProxy>::cast(global)->IsDetached()); |
5413 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global)); | 5414 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global)); |
5414 } | 5415 } |
5415 | 5416 |
5416 | 5417 |
5417 void Context::DetachGlobal() { | 5418 void Context::DetachGlobal() { |
5418 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5419 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5419 i::Isolate* isolate = context->GetIsolate(); | 5420 i::Isolate* isolate = context->GetIsolate(); |
5420 ENTER_V8(isolate); | 5421 ENTER_V8(isolate); |
5421 isolate->bootstrapper()->DetachGlobal(context); | 5422 isolate->bootstrapper()->DetachGlobal(context); |
5422 } | 5423 } |
5423 | 5424 |
5424 | 5425 |
5425 void Context::ReattachGlobal(Handle<Object> global_object) { | |
5426 i::Handle<i::Context> context = Utils::OpenHandle(this); | |
5427 i::Isolate* isolate = context->GetIsolate(); | |
5428 ENTER_V8(isolate); | |
5429 i::Handle<i::JSGlobalProxy> global_proxy = | |
5430 i::Handle<i::JSGlobalProxy>::cast(Utils::OpenHandle(*global_object)); | |
5431 isolate->bootstrapper()->ReattachGlobal(context, global_proxy); | |
5432 } | |
5433 | |
5434 | |
5435 void Context::AllowCodeGenerationFromStrings(bool allow) { | 5426 void Context::AllowCodeGenerationFromStrings(bool allow) { |
5436 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5427 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5437 i::Isolate* isolate = context->GetIsolate(); | 5428 i::Isolate* isolate = context->GetIsolate(); |
5438 ENTER_V8(isolate); | 5429 ENTER_V8(isolate); |
5439 context->set_allow_code_gen_from_strings( | 5430 context->set_allow_code_gen_from_strings( |
5440 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); | 5431 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); |
5441 } | 5432 } |
5442 | 5433 |
5443 | 5434 |
5444 bool Context::IsCodeGenerationFromStringsAllowed() { | 5435 bool Context::IsCodeGenerationFromStringsAllowed() { |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7780 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7771 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7781 Address callback_address = | 7772 Address callback_address = |
7782 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7773 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7783 VMState<EXTERNAL> state(isolate); | 7774 VMState<EXTERNAL> state(isolate); |
7784 ExternalCallbackScope call_scope(isolate, callback_address); | 7775 ExternalCallbackScope call_scope(isolate, callback_address); |
7785 callback(info); | 7776 callback(info); |
7786 } | 7777 } |
7787 | 7778 |
7788 | 7779 |
7789 } } // namespace v8::internal | 7780 } } // namespace v8::internal |
OLD | NEW |