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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 static MayAccessDecision MayAccessPreCheck(Isolate* isolate, | 785 static MayAccessDecision MayAccessPreCheck(Isolate* isolate, |
786 JSObject* receiver, | 786 JSObject* receiver, |
787 v8::AccessType type) { | 787 v8::AccessType type) { |
788 // During bootstrapping, callback functions are not enabled yet. | 788 // During bootstrapping, callback functions are not enabled yet. |
789 if (isolate->bootstrapper()->IsActive()) return YES; | 789 if (isolate->bootstrapper()->IsActive()) return YES; |
790 | 790 |
791 if (receiver->IsJSGlobalProxy()) { | 791 if (receiver->IsJSGlobalProxy()) { |
792 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); | 792 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); |
793 if (!receiver_context->IsContext()) return NO; | 793 if (!receiver_context->IsContext()) return NO; |
794 | 794 |
795 // Get the global context of current top context. | 795 // Get the native context of current top context. |
796 // avoid using Isolate::global_context() because it uses Handle. | 796 // avoid using Isolate::native_context() because it uses Handle. |
797 Context* global_context = isolate->context()->global()->global_context(); | 797 Context* native_context = isolate->context()->global()->native_context(); |
798 if (receiver_context == global_context) return YES; | 798 if (receiver_context == native_context) return YES; |
799 | 799 |
800 if (Context::cast(receiver_context)->security_token() == | 800 if (Context::cast(receiver_context)->security_token() == |
801 global_context->security_token()) | 801 native_context->security_token()) |
802 return YES; | 802 return YES; |
803 } | 803 } |
804 | 804 |
805 return UNKNOWN; | 805 return UNKNOWN; |
806 } | 806 } |
807 | 807 |
808 | 808 |
809 bool Isolate::MayNamedAccess(JSObject* receiver, Object* key, | 809 bool Isolate::MayNamedAccess(JSObject* receiver, Object* key, |
810 v8::AccessType type) { | 810 v8::AccessType type) { |
811 ASSERT(receiver->IsAccessCheckNeeded()); | 811 ASSERT(receiver->IsAccessCheckNeeded()); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 | 1206 |
1207 return true; | 1207 return true; |
1208 } | 1208 } |
1209 | 1209 |
1210 | 1210 |
1211 void Isolate::ReportPendingMessages() { | 1211 void Isolate::ReportPendingMessages() { |
1212 ASSERT(has_pending_exception()); | 1212 ASSERT(has_pending_exception()); |
1213 PropagatePendingExceptionToExternalTryCatch(); | 1213 PropagatePendingExceptionToExternalTryCatch(); |
1214 | 1214 |
1215 // If the pending exception is OutOfMemoryException set out_of_memory in | 1215 // If the pending exception is OutOfMemoryException set out_of_memory in |
1216 // the global context. Note: We have to mark the global context here | 1216 // the native context. Note: We have to mark the native context here |
1217 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to | 1217 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to |
1218 // set it. | 1218 // set it. |
1219 HandleScope scope; | 1219 HandleScope scope; |
1220 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { | 1220 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { |
1221 context()->mark_out_of_memory(); | 1221 context()->mark_out_of_memory(); |
1222 } else if (thread_local_top_.pending_exception_ == | 1222 } else if (thread_local_top_.pending_exception_ == |
1223 heap()->termination_exception()) { | 1223 heap()->termination_exception()) { |
1224 // Do nothing: if needed, the exception has been already propagated to | 1224 // Do nothing: if needed, the exception has been already propagated to |
1225 // v8::TryCatch. | 1225 // v8::TryCatch. |
1226 } else { | 1226 } else { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 if (has_scheduled_exception()) { | 1316 if (has_scheduled_exception()) { |
1317 MaybeObject* e = scheduled_exception(); | 1317 MaybeObject* e = scheduled_exception(); |
1318 if (e->IsFailure() && Failure::cast(e)->IsOutOfMemoryException()) { | 1318 if (e->IsFailure() && Failure::cast(e)->IsOutOfMemoryException()) { |
1319 return true; | 1319 return true; |
1320 } | 1320 } |
1321 } | 1321 } |
1322 return false; | 1322 return false; |
1323 } | 1323 } |
1324 | 1324 |
1325 | 1325 |
1326 Handle<Context> Isolate::global_context() { | 1326 Handle<Context> Isolate::native_context() { |
1327 GlobalObject* global = thread_local_top()->context_->global(); | 1327 GlobalObject* global = thread_local_top()->context_->global(); |
1328 return Handle<Context>(global->global_context()); | 1328 return Handle<Context>(global->native_context()); |
1329 } | 1329 } |
1330 | 1330 |
1331 | 1331 |
1332 Handle<Context> Isolate::GetCallingGlobalContext() { | 1332 Handle<Context> Isolate::GetCallingNativeContext() { |
1333 JavaScriptFrameIterator it; | 1333 JavaScriptFrameIterator it; |
1334 #ifdef ENABLE_DEBUGGER_SUPPORT | 1334 #ifdef ENABLE_DEBUGGER_SUPPORT |
1335 if (debug_->InDebugger()) { | 1335 if (debug_->InDebugger()) { |
1336 while (!it.done()) { | 1336 while (!it.done()) { |
1337 JavaScriptFrame* frame = it.frame(); | 1337 JavaScriptFrame* frame = it.frame(); |
1338 Context* context = Context::cast(frame->context()); | 1338 Context* context = Context::cast(frame->context()); |
1339 if (context->global_context() == *debug_->debug_context()) { | 1339 if (context->native_context() == *debug_->debug_context()) { |
1340 it.Advance(); | 1340 it.Advance(); |
1341 } else { | 1341 } else { |
1342 break; | 1342 break; |
1343 } | 1343 } |
1344 } | 1344 } |
1345 } | 1345 } |
1346 #endif // ENABLE_DEBUGGER_SUPPORT | 1346 #endif // ENABLE_DEBUGGER_SUPPORT |
1347 if (it.done()) return Handle<Context>::null(); | 1347 if (it.done()) return Handle<Context>::null(); |
1348 JavaScriptFrame* frame = it.frame(); | 1348 JavaScriptFrame* frame = it.frame(); |
1349 Context* context = Context::cast(frame->context()); | 1349 Context* context = Context::cast(frame->context()); |
1350 return Handle<Context>(context->global_context()); | 1350 return Handle<Context>(context->native_context()); |
1351 } | 1351 } |
1352 | 1352 |
1353 | 1353 |
1354 char* Isolate::ArchiveThread(char* to) { | 1354 char* Isolate::ArchiveThread(char* to) { |
1355 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 1355 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
1356 RuntimeProfiler::IsolateExitedJS(this); | 1356 RuntimeProfiler::IsolateExitedJS(this); |
1357 } | 1357 } |
1358 memcpy(to, reinterpret_cast<char*>(thread_local_top()), | 1358 memcpy(to, reinterpret_cast<char*>(thread_local_top()), |
1359 sizeof(ThreadLocalTop)); | 1359 sizeof(ThreadLocalTop)); |
1360 InitializeThreadLocal(); | 1360 InitializeThreadLocal(); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 | 2032 |
2033 #ifdef DEBUG | 2033 #ifdef DEBUG |
2034 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2034 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2035 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2035 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2036 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2036 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2037 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2037 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2038 #undef ISOLATE_FIELD_OFFSET | 2038 #undef ISOLATE_FIELD_OFFSET |
2039 #endif | 2039 #endif |
2040 | 2040 |
2041 } } // namespace v8::internal | 2041 } } // namespace v8::internal |
OLD | NEW |