| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "natives.h" | 9 #include "natives.h" |
| 10 #include "snapshot.h" | 10 #include "snapshot.h" |
| 11 #include "trig-table.h" | |
| 12 #include "extensions/externalize-string-extension.h" | 11 #include "extensions/externalize-string-extension.h" |
| 13 #include "extensions/free-buffer-extension.h" | 12 #include "extensions/free-buffer-extension.h" |
| 14 #include "extensions/gc-extension.h" | 13 #include "extensions/gc-extension.h" |
| 15 #include "extensions/statistics-extension.h" | 14 #include "extensions/statistics-extension.h" |
| 16 #include "extensions/trigger-failure-extension.h" | 15 #include "extensions/trigger-failure-extension.h" |
| 17 #include "code-stubs.h" | 16 #include "code-stubs.h" |
| 18 | 17 |
| 19 namespace v8 { | 18 namespace v8 { |
| 20 namespace internal { | 19 namespace internal { |
| 21 | 20 |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New( | 2626 v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New( |
| 2628 reinterpret_cast<v8::Isolate*>(isolate), state, num_bytes); | 2627 reinterpret_cast<v8::Isolate*>(isolate), state, num_bytes); |
| 2629 Utils::OpenHandle(*buffer)->set_should_be_freed(true); | 2628 Utils::OpenHandle(*buffer)->set_should_be_freed(true); |
| 2630 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); | 2629 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); |
| 2631 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); | 2630 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); |
| 2632 Runtime::ForceSetObjectProperty(builtins, | 2631 Runtime::ForceSetObjectProperty(builtins, |
| 2633 factory()->InternalizeOneByteString( | 2632 factory()->InternalizeOneByteString( |
| 2634 STATIC_ASCII_VECTOR("rngstate")), | 2633 STATIC_ASCII_VECTOR("rngstate")), |
| 2635 Utils::OpenHandle(*ta), | 2634 Utils::OpenHandle(*ta), |
| 2636 NONE).Assert(); | 2635 NONE).Assert(); |
| 2637 | |
| 2638 // Initialize trigonometric lookup tables and constants. | |
| 2639 const int table_num_bytes = TrigonometricLookupTable::table_num_bytes(); | |
| 2640 v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New( | |
| 2641 reinterpret_cast<v8::Isolate*>(isolate), | |
| 2642 TrigonometricLookupTable::sin_table(), table_num_bytes); | |
| 2643 v8::Local<v8::ArrayBuffer> cos_buffer = v8::ArrayBuffer::New( | |
| 2644 reinterpret_cast<v8::Isolate*>(isolate), | |
| 2645 TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes); | |
| 2646 v8::Local<v8::Float64Array> sin_table = v8::Float64Array::New( | |
| 2647 sin_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2648 v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New( | |
| 2649 cos_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2650 | |
| 2651 Runtime::ForceSetObjectProperty(builtins, | |
| 2652 factory()->InternalizeOneByteString( | |
| 2653 STATIC_ASCII_VECTOR("kSinTable")), | |
| 2654 Utils::OpenHandle(*sin_table), | |
| 2655 NONE).Assert(); | |
| 2656 Runtime::ForceSetObjectProperty( | |
| 2657 builtins, | |
| 2658 factory()->InternalizeOneByteString( | |
| 2659 STATIC_ASCII_VECTOR("kCosXIntervalTable")), | |
| 2660 Utils::OpenHandle(*cos_table), | |
| 2661 NONE).Assert(); | |
| 2662 Runtime::ForceSetObjectProperty( | |
| 2663 builtins, | |
| 2664 factory()->InternalizeOneByteString( | |
| 2665 STATIC_ASCII_VECTOR("kSamples")), | |
| 2666 factory()->NewHeapNumber( | |
| 2667 TrigonometricLookupTable::samples()), | |
| 2668 NONE).Assert(); | |
| 2669 Runtime::ForceSetObjectProperty( | |
| 2670 builtins, | |
| 2671 factory()->InternalizeOneByteString( | |
| 2672 STATIC_ASCII_VECTOR("kIndexConvert")), | |
| 2673 factory()->NewHeapNumber( | |
| 2674 TrigonometricLookupTable::samples_over_pi_half()), | |
| 2675 NONE).Assert(); | |
| 2676 } | 2636 } |
| 2677 | 2637 |
| 2678 result_ = native_context(); | 2638 result_ = native_context(); |
| 2679 } | 2639 } |
| 2680 | 2640 |
| 2681 | 2641 |
| 2682 // Support for thread preemption. | 2642 // Support for thread preemption. |
| 2683 | 2643 |
| 2684 // Reserve space for statics needing saving and restoring. | 2644 // Reserve space for statics needing saving and restoring. |
| 2685 int Bootstrapper::ArchiveSpacePerThread() { | 2645 int Bootstrapper::ArchiveSpacePerThread() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2701 return from + sizeof(NestingCounterType); | 2661 return from + sizeof(NestingCounterType); |
| 2702 } | 2662 } |
| 2703 | 2663 |
| 2704 | 2664 |
| 2705 // Called when the top-level V8 mutex is destroyed. | 2665 // Called when the top-level V8 mutex is destroyed. |
| 2706 void Bootstrapper::FreeThreadResources() { | 2666 void Bootstrapper::FreeThreadResources() { |
| 2707 ASSERT(!IsActive()); | 2667 ASSERT(!IsActive()); |
| 2708 } | 2668 } |
| 2709 | 2669 |
| 2710 } } // namespace v8::internal | 2670 } } // namespace v8::internal |
| OLD | NEW |