| 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 22 matching lines...) Expand all Loading... |
| 33 #include "../include/v8-profiler.h" | 33 #include "../include/v8-profiler.h" |
| 34 #include "../include/v8-testing.h" | 34 #include "../include/v8-testing.h" |
| 35 #include "assert-scope.h" | 35 #include "assert-scope.h" |
| 36 #include "bootstrapper.h" | 36 #include "bootstrapper.h" |
| 37 #include "code-stubs.h" | 37 #include "code-stubs.h" |
| 38 #include "compiler.h" | 38 #include "compiler.h" |
| 39 #include "conversions-inl.h" | 39 #include "conversions-inl.h" |
| 40 #include "counters.h" | 40 #include "counters.h" |
| 41 #include "cpu-profiler.h" | 41 #include "cpu-profiler.h" |
| 42 #include "debug.h" | 42 #include "debug.h" |
| 43 #ifdef V8_USE_DEFAULT_PLATFORM | |
| 44 #include "default-platform.h" | |
| 45 #endif | |
| 46 #include "deoptimizer.h" | 43 #include "deoptimizer.h" |
| 47 #include "execution.h" | 44 #include "execution.h" |
| 48 #include "global-handles.h" | 45 #include "global-handles.h" |
| 49 #include "heap-profiler.h" | 46 #include "heap-profiler.h" |
| 50 #include "heap-snapshot-generator-inl.h" | 47 #include "heap-snapshot-generator-inl.h" |
| 51 #include "icu_util.h" | 48 #include "icu_util.h" |
| 52 #include "json-parser.h" | 49 #include "json-parser.h" |
| 53 #include "messages.h" | 50 #include "messages.h" |
| 54 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 51 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
| 55 #include "natives.h" | 52 #include "natives.h" |
| (...skipping 4992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5048 // Obscure semantics for undefined, but somehow checked in our unit tests... | 5045 // Obscure semantics for undefined, but somehow checked in our unit tests... |
| 5049 if (obj->IsUndefined()) return NULL; | 5046 if (obj->IsUndefined()) return NULL; |
| 5050 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); | 5047 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); |
| 5051 return i::Foreign::cast(foreign)->foreign_address(); | 5048 return i::Foreign::cast(foreign)->foreign_address(); |
| 5052 } | 5049 } |
| 5053 | 5050 |
| 5054 | 5051 |
| 5055 // --- E n v i r o n m e n t --- | 5052 // --- E n v i r o n m e n t --- |
| 5056 | 5053 |
| 5057 | 5054 |
| 5058 void v8::V8::InitializePlatform(Platform* platform) { | |
| 5059 #ifdef V8_USE_DEFAULT_PLATFORM | |
| 5060 FATAL("Can't override v8::Platform when using default implementation"); | |
| 5061 #else | |
| 5062 i::V8::InitializePlatform(platform); | |
| 5063 #endif | |
| 5064 } | |
| 5065 | |
| 5066 | |
| 5067 void v8::V8::ShutdownPlatform() { | |
| 5068 #ifdef V8_USE_DEFAULT_PLATFORM | |
| 5069 FATAL("Can't override v8::Platform when using default implementation"); | |
| 5070 #else | |
| 5071 i::V8::ShutdownPlatform(); | |
| 5072 #endif | |
| 5073 } | |
| 5074 | |
| 5075 | |
| 5076 bool v8::V8::Initialize() { | 5055 bool v8::V8::Initialize() { |
| 5077 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 5056 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 5078 if (isolate != NULL && isolate->IsInitialized()) { | 5057 if (isolate != NULL && isolate->IsInitialized()) { |
| 5079 return true; | 5058 return true; |
| 5080 } | 5059 } |
| 5081 #ifdef V8_USE_DEFAULT_PLATFORM | |
| 5082 i::V8::InitializePlatform(new i::DefaultPlatform); | |
| 5083 #endif | |
| 5084 return InitializeHelper(isolate); | 5060 return InitializeHelper(isolate); |
| 5085 } | 5061 } |
| 5086 | 5062 |
| 5087 | 5063 |
| 5088 void v8::V8::SetEntropySource(EntropySource entropy_source) { | 5064 void v8::V8::SetEntropySource(EntropySource entropy_source) { |
| 5089 i::RandomNumberGenerator::SetEntropySource(entropy_source); | 5065 i::RandomNumberGenerator::SetEntropySource(entropy_source); |
| 5090 } | 5066 } |
| 5091 | 5067 |
| 5092 | 5068 |
| 5093 void v8::V8::SetReturnAddressLocationResolver( | 5069 void v8::V8::SetReturnAddressLocationResolver( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5138 | 5114 |
| 5139 | 5115 |
| 5140 bool v8::V8::Dispose() { | 5116 bool v8::V8::Dispose() { |
| 5141 i::Isolate* isolate = i::Isolate::Current(); | 5117 i::Isolate* isolate = i::Isolate::Current(); |
| 5142 if (!ApiCheck(isolate != NULL && isolate->IsDefaultIsolate(), | 5118 if (!ApiCheck(isolate != NULL && isolate->IsDefaultIsolate(), |
| 5143 "v8::V8::Dispose()", | 5119 "v8::V8::Dispose()", |
| 5144 "Use v8::Isolate::Dispose() for a non-default isolate.")) { | 5120 "Use v8::Isolate::Dispose() for a non-default isolate.")) { |
| 5145 return false; | 5121 return false; |
| 5146 } | 5122 } |
| 5147 i::V8::TearDown(); | 5123 i::V8::TearDown(); |
| 5148 #ifdef V8_USE_DEFAULT_PLATFORM | |
| 5149 i::DefaultPlatform* platform = | |
| 5150 static_cast<i::DefaultPlatform*>(i::V8::GetCurrentPlatform()); | |
| 5151 i::V8::ShutdownPlatform(); | |
| 5152 delete platform; | |
| 5153 #endif | |
| 5154 return true; | 5124 return true; |
| 5155 } | 5125 } |
| 5156 | 5126 |
| 5157 | 5127 |
| 5158 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 5128 HeapStatistics::HeapStatistics(): total_heap_size_(0), |
| 5159 total_heap_size_executable_(0), | 5129 total_heap_size_executable_(0), |
| 5160 total_physical_size_(0), | 5130 total_physical_size_(0), |
| 5161 used_heap_size_(0), | 5131 used_heap_size_(0), |
| 5162 heap_size_limit_(0) { } | 5132 heap_size_limit_(0) { } |
| 5163 | 5133 |
| (...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7697 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7667 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7698 Address callback_address = | 7668 Address callback_address = |
| 7699 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7669 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7700 VMState<EXTERNAL> state(isolate); | 7670 VMState<EXTERNAL> state(isolate); |
| 7701 ExternalCallbackScope call_scope(isolate, callback_address); | 7671 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7702 callback(info); | 7672 callback(info); |
| 7703 } | 7673 } |
| 7704 | 7674 |
| 7705 | 7675 |
| 7706 } } // namespace v8::internal | 7676 } } // namespace v8::internal |
| OLD | NEW |