| 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 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4163 Utils::OpenHandle(this)->SetInternalField(index, *foreign); | 4163 Utils::OpenHandle(this)->SetInternalField(index, *foreign); |
| 4164 } | 4164 } |
| 4165 ASSERT_EQ(value, GetPointerFromInternalField(index)); | 4165 ASSERT_EQ(value, GetPointerFromInternalField(index)); |
| 4166 } | 4166 } |
| 4167 | 4167 |
| 4168 | 4168 |
| 4169 // --- E n v i r o n m e n t --- | 4169 // --- E n v i r o n m e n t --- |
| 4170 | 4170 |
| 4171 | 4171 |
| 4172 bool v8::V8::Initialize() { | 4172 bool v8::V8::Initialize() { |
| 4173 i::Isolate* isolate = i::Isolate::Current(); | 4173 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 4174 if (isolate != NULL && isolate->IsInitialized()) { | 4174 if (isolate != NULL && isolate->IsInitialized()) { |
| 4175 return true; | 4175 return true; |
| 4176 } | 4176 } |
| 4177 return InitializeHelper(); | 4177 return InitializeHelper(); |
| 4178 } | 4178 } |
| 4179 | 4179 |
| 4180 | 4180 |
| 4181 void v8::V8::SetEntropySource(EntropySource source) { | 4181 void v8::V8::SetEntropySource(EntropySource source) { |
| 4182 i::V8::SetEntropySource(source); | 4182 i::V8::SetEntropySource(source); |
| 4183 } | 4183 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4270 } | 4270 } |
| 4271 return i::Handle<i::FunctionTemplateInfo>( | 4271 return i::Handle<i::FunctionTemplateInfo>( |
| 4272 i::FunctionTemplateInfo::cast(templ->constructor())); | 4272 i::FunctionTemplateInfo::cast(templ->constructor())); |
| 4273 } | 4273 } |
| 4274 | 4274 |
| 4275 | 4275 |
| 4276 Persistent<Context> v8::Context::New( | 4276 Persistent<Context> v8::Context::New( |
| 4277 v8::ExtensionConfiguration* extensions, | 4277 v8::ExtensionConfiguration* extensions, |
| 4278 v8::Handle<ObjectTemplate> global_template, | 4278 v8::Handle<ObjectTemplate> global_template, |
| 4279 v8::Handle<Value> global_object) { | 4279 v8::Handle<Value> global_object) { |
| 4280 i::Isolate::EnsureDefaultIsolate(); |
| 4280 i::Isolate* isolate = i::Isolate::Current(); | 4281 i::Isolate* isolate = i::Isolate::Current(); |
| 4281 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | 4282 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); |
| 4282 LOG_API(isolate, "Context::New"); | 4283 LOG_API(isolate, "Context::New"); |
| 4283 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); | 4284 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); |
| 4284 | 4285 |
| 4285 // Enter V8 via an ENTER_V8 scope. | 4286 // Enter V8 via an ENTER_V8 scope. |
| 4286 i::Handle<i::Context> env; | 4287 i::Handle<i::Context> env; |
| 4287 { | 4288 { |
| 4288 ENTER_V8(isolate); | 4289 ENTER_V8(isolate); |
| 4289 v8::Handle<ObjectTemplate> proxy_template = global_template; | 4290 v8::Handle<ObjectTemplate> proxy_template = global_template; |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5056 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 5057 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
| 5057 value = i::OS::nan_value(); | 5058 value = i::OS::nan_value(); |
| 5058 } | 5059 } |
| 5059 ENTER_V8(isolate); | 5060 ENTER_V8(isolate); |
| 5060 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); | 5061 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); |
| 5061 return Utils::NumberToLocal(result); | 5062 return Utils::NumberToLocal(result); |
| 5062 } | 5063 } |
| 5063 | 5064 |
| 5064 | 5065 |
| 5065 Local<Integer> v8::Integer::New(int32_t value) { | 5066 Local<Integer> v8::Integer::New(int32_t value) { |
| 5066 i::Isolate* isolate = i::Isolate::Current(); | 5067 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 5067 EnsureInitializedForIsolate(isolate, "v8::Integer::New()"); | 5068 EnsureInitializedForIsolate(isolate, "v8::Integer::New()"); |
| 5068 if (i::Smi::IsValid(value)) { | 5069 if (i::Smi::IsValid(value)) { |
| 5069 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), | 5070 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), |
| 5070 isolate)); | 5071 isolate)); |
| 5071 } | 5072 } |
| 5072 ENTER_V8(isolate); | 5073 ENTER_V8(isolate); |
| 5073 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); | 5074 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); |
| 5074 return Utils::IntegerToLocal(result); | 5075 return Utils::IntegerToLocal(result); |
| 5075 } | 5076 } |
| 5076 | 5077 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5262 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { | 5263 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { |
| 5263 i::Isolate* isolate = i::Isolate::Current(); | 5264 i::Isolate* isolate = i::Isolate::Current(); |
| 5264 if (IsDeadCheck(isolate, "v8::V8::RemoveMemoryAllocationCallback()")) return; | 5265 if (IsDeadCheck(isolate, "v8::V8::RemoveMemoryAllocationCallback()")) return; |
| 5265 isolate->memory_allocator()->RemoveMemoryAllocationCallback( | 5266 isolate->memory_allocator()->RemoveMemoryAllocationCallback( |
| 5266 callback); | 5267 callback); |
| 5267 } | 5268 } |
| 5268 | 5269 |
| 5269 | 5270 |
| 5270 void V8::AddCallCompletedCallback(CallCompletedCallback callback) { | 5271 void V8::AddCallCompletedCallback(CallCompletedCallback callback) { |
| 5271 if (callback == NULL) return; | 5272 if (callback == NULL) return; |
| 5273 i::Isolate::EnsureDefaultIsolate(); |
| 5272 i::Isolate* isolate = i::Isolate::Current(); | 5274 i::Isolate* isolate = i::Isolate::Current(); |
| 5273 if (IsDeadCheck(isolate, "v8::V8::AddLeaveScriptCallback()")) return; | 5275 if (IsDeadCheck(isolate, "v8::V8::AddLeaveScriptCallback()")) return; |
| 5274 i::V8::AddCallCompletedCallback(callback); | 5276 i::V8::AddCallCompletedCallback(callback); |
| 5275 } | 5277 } |
| 5276 | 5278 |
| 5277 | 5279 |
| 5278 void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { | 5280 void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { |
| 5281 i::Isolate::EnsureDefaultIsolate(); |
| 5279 i::Isolate* isolate = i::Isolate::Current(); | 5282 i::Isolate* isolate = i::Isolate::Current(); |
| 5280 if (IsDeadCheck(isolate, "v8::V8::RemoveLeaveScriptCallback()")) return; | 5283 if (IsDeadCheck(isolate, "v8::V8::RemoveLeaveScriptCallback()")) return; |
| 5281 i::V8::RemoveCallCompletedCallback(callback); | 5284 i::V8::RemoveCallCompletedCallback(callback); |
| 5282 } | 5285 } |
| 5283 | 5286 |
| 5284 | 5287 |
| 5285 void V8::PauseProfiler() { | 5288 void V8::PauseProfiler() { |
| 5286 i::Isolate* isolate = i::Isolate::Current(); | 5289 i::Isolate* isolate = i::Isolate::Current(); |
| 5287 isolate->logger()->PauseProfiler(); | 5290 isolate->logger()->PauseProfiler(); |
| 5288 } | 5291 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5334 | 5337 |
| 5335 | 5338 |
| 5336 bool V8::IsExecutionTerminating(Isolate* isolate) { | 5339 bool V8::IsExecutionTerminating(Isolate* isolate) { |
| 5337 i::Isolate* i_isolate = isolate != NULL ? | 5340 i::Isolate* i_isolate = isolate != NULL ? |
| 5338 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 5341 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
| 5339 return IsExecutionTerminatingCheck(i_isolate); | 5342 return IsExecutionTerminatingCheck(i_isolate); |
| 5340 } | 5343 } |
| 5341 | 5344 |
| 5342 | 5345 |
| 5343 Isolate* Isolate::GetCurrent() { | 5346 Isolate* Isolate::GetCurrent() { |
| 5344 i::Isolate* isolate = i::Isolate::Current(); | 5347 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 5345 return reinterpret_cast<Isolate*>(isolate); | 5348 return reinterpret_cast<Isolate*>(isolate); |
| 5346 } | 5349 } |
| 5347 | 5350 |
| 5348 | 5351 |
| 5349 Isolate* Isolate::New() { | 5352 Isolate* Isolate::New() { |
| 5350 i::Isolate* isolate = new i::Isolate(); | 5353 i::Isolate* isolate = new i::Isolate(); |
| 5351 return reinterpret_cast<Isolate*>(isolate); | 5354 return reinterpret_cast<Isolate*>(isolate); |
| 5352 } | 5355 } |
| 5353 | 5356 |
| 5354 | 5357 |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6359 | 6362 |
| 6360 | 6363 |
| 6361 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6364 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6362 HandleScopeImplementer* scope_implementer = | 6365 HandleScopeImplementer* scope_implementer = |
| 6363 reinterpret_cast<HandleScopeImplementer*>(storage); | 6366 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6364 scope_implementer->IterateThis(v); | 6367 scope_implementer->IterateThis(v); |
| 6365 return storage + ArchiveSpacePerThread(); | 6368 return storage + ArchiveSpacePerThread(); |
| 6366 } | 6369 } |
| 6367 | 6370 |
| 6368 } } // namespace v8::internal | 6371 } } // namespace v8::internal |
| OLD | NEW |