OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "api.h" | 5 #include "api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
9 #include "../include/v8-debug.h" | 9 #include "../include/v8-debug.h" |
10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
11 #include "../include/v8-testing.h" | 11 #include "../include/v8-testing.h" |
12 #include "assert-scope.h" | 12 #include "assert-scope.h" |
13 #include "bootstrapper.h" | 13 #include "bootstrapper.h" |
14 #include "code-stubs.h" | 14 #include "code-stubs.h" |
15 #include "compiler.h" | 15 #include "compiler.h" |
16 #include "conversions-inl.h" | 16 #include "conversions-inl.h" |
17 #include "counters.h" | 17 #include "counters.h" |
18 #include "cpu-profiler.h" | 18 #include "cpu-profiler.h" |
19 #include "debug.h" | 19 #include "debug.h" |
20 #include "deoptimizer.h" | 20 #include "deoptimizer.h" |
21 #include "execution.h" | 21 #include "execution.h" |
22 #include "global-handles.h" | 22 #include "global-handles.h" |
23 #include "heap-profiler.h" | 23 #include "heap-profiler.h" |
24 #include "heap-snapshot-generator-inl.h" | 24 #include "heap-snapshot-generator-inl.h" |
25 #include "icu_util.h" | 25 #include "icu_util.h" |
26 #include "json-parser.h" | 26 #include "json-parser.h" |
27 #include "messages.h" | 27 #include "messages.h" |
28 #ifdef COMPRESS_STARTUP_DATA_BZ2 | |
29 #include "natives.h" | 28 #include "natives.h" |
30 #endif | |
31 #include "parser.h" | 29 #include "parser.h" |
32 #include "platform.h" | 30 #include "platform.h" |
33 #include "platform/time.h" | 31 #include "platform/time.h" |
34 #include "profile-generator-inl.h" | 32 #include "profile-generator-inl.h" |
35 #include "property-details.h" | 33 #include "property-details.h" |
36 #include "property.h" | 34 #include "property.h" |
37 #include "runtime.h" | 35 #include "runtime.h" |
38 #include "runtime-profiler.h" | 36 #include "runtime-profiler.h" |
39 #include "scanner-character-streams.h" | 37 #include "scanner-character-streams.h" |
40 #include "snapshot.h" | 38 #include "snapshot.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 340 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
343 decompressed_data[kExperimentalLibraries].raw_size); | 341 decompressed_data[kExperimentalLibraries].raw_size); |
344 i::Vector<const char> exp_libraries_source( | 342 i::Vector<const char> exp_libraries_source( |
345 decompressed_data[kExperimentalLibraries].data, | 343 decompressed_data[kExperimentalLibraries].data, |
346 decompressed_data[kExperimentalLibraries].raw_size); | 344 decompressed_data[kExperimentalLibraries].raw_size); |
347 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 345 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); |
348 #endif | 346 #endif |
349 } | 347 } |
350 | 348 |
351 | 349 |
| 350 void V8::SetNativesDataBlob(StartupData* natives_blob) { |
| 351 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 352 i::SetNativesFromFile(natives_blob); |
| 353 #else |
| 354 CHECK(false); |
| 355 #endif |
| 356 } |
| 357 |
| 358 |
| 359 void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { |
| 360 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 361 i::SetSnapshotFromFile(snapshot_blob); |
| 362 #else |
| 363 CHECK(false); |
| 364 #endif |
| 365 } |
| 366 |
| 367 |
352 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 368 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
353 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 369 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
354 isolate->set_exception_behavior(that); | 370 isolate->set_exception_behavior(that); |
355 } | 371 } |
356 | 372 |
357 | 373 |
358 void V8::SetAllowCodeGenerationFromStringsCallback( | 374 void V8::SetAllowCodeGenerationFromStringsCallback( |
359 AllowCodeGenerationFromStringsCallback callback) { | 375 AllowCodeGenerationFromStringsCallback callback) { |
360 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 376 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
361 isolate->set_allow_code_gen_callback(callback); | 377 isolate->set_allow_code_gen_callback(callback); |
(...skipping 7176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7538 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7554 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7539 Address callback_address = | 7555 Address callback_address = |
7540 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7556 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7541 VMState<EXTERNAL> state(isolate); | 7557 VMState<EXTERNAL> state(isolate); |
7542 ExternalCallbackScope call_scope(isolate, callback_address); | 7558 ExternalCallbackScope call_scope(isolate, callback_address); |
7543 callback(info); | 7559 callback(info); |
7544 } | 7560 } |
7545 | 7561 |
7546 | 7562 |
7547 } } // namespace v8::internal | 7563 } } // namespace v8::internal |
OLD | NEW |