| 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 "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
| 9 #include "src/natives.h" | 9 #include "src/natives.h" |
| 10 #include "src/rempio2.h" |
| 10 #include "src/snapshot.h" | 11 #include "src/snapshot.h" |
| 11 #include "src/trig-table.h" | |
| 12 #include "src/extensions/externalize-string-extension.h" | 12 #include "src/extensions/externalize-string-extension.h" |
| 13 #include "src/extensions/free-buffer-extension.h" | 13 #include "src/extensions/free-buffer-extension.h" |
| 14 #include "src/extensions/gc-extension.h" | 14 #include "src/extensions/gc-extension.h" |
| 15 #include "src/extensions/statistics-extension.h" | 15 #include "src/extensions/statistics-extension.h" |
| 16 #include "src/extensions/trigger-failure-extension.h" | 16 #include "src/extensions/trigger-failure-extension.h" |
| 17 #include "src/code-stubs.h" | 17 #include "src/code-stubs.h" |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2641 Utils::OpenHandle(*buffer)->set_should_be_freed(true); | 2641 Utils::OpenHandle(*buffer)->set_should_be_freed(true); |
| 2642 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); | 2642 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); |
| 2643 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); | 2643 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); |
| 2644 Runtime::ForceSetObjectProperty(builtins, | 2644 Runtime::ForceSetObjectProperty(builtins, |
| 2645 factory()->InternalizeOneByteString( | 2645 factory()->InternalizeOneByteString( |
| 2646 STATIC_ASCII_VECTOR("rngstate")), | 2646 STATIC_ASCII_VECTOR("rngstate")), |
| 2647 Utils::OpenHandle(*ta), | 2647 Utils::OpenHandle(*ta), |
| 2648 NONE).Assert(); | 2648 NONE).Assert(); |
| 2649 | 2649 |
| 2650 // Initialize trigonometric lookup tables and constants. | 2650 // Initialize trigonometric lookup tables and constants. |
| 2651 const int table_num_bytes = TrigonometricLookupTable::table_num_bytes(); | 2651 const int table_num_bytes = TrigonometricConstants::kSize * kDoubleSize; |
| 2652 v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New( | 2652 v8::Local<v8::ArrayBuffer> trig_buffer = v8::ArrayBuffer::New( |
| 2653 reinterpret_cast<v8::Isolate*>(isolate), | 2653 reinterpret_cast<v8::Isolate*>(isolate), |
| 2654 TrigonometricLookupTable::sin_table(), table_num_bytes); | 2654 TrigonometricConstants::constants(), table_num_bytes); |
| 2655 v8::Local<v8::ArrayBuffer> cos_buffer = v8::ArrayBuffer::New( | 2655 v8::Local<v8::Float64Array> trig_table = v8::Float64Array::New( |
| 2656 reinterpret_cast<v8::Isolate*>(isolate), | 2656 trig_buffer, 0, TrigonometricConstants::kSize); |
| 2657 TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes); | |
| 2658 v8::Local<v8::Float64Array> sin_table = v8::Float64Array::New( | |
| 2659 sin_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2660 v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New( | |
| 2661 cos_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2662 | |
| 2663 Runtime::ForceSetObjectProperty(builtins, | 2657 Runtime::ForceSetObjectProperty(builtins, |
| 2664 factory()->InternalizeOneByteString( | 2658 factory()->InternalizeOneByteString( |
| 2665 STATIC_ASCII_VECTOR("kSinTable")), | 2659 STATIC_ASCII_VECTOR("kTrig")), |
| 2666 Utils::OpenHandle(*sin_table), | 2660 Utils::OpenHandle(*trig_table), |
| 2667 NONE).Assert(); | 2661 NONE).Assert(); |
| 2668 Runtime::ForceSetObjectProperty( | |
| 2669 builtins, | |
| 2670 factory()->InternalizeOneByteString( | |
| 2671 STATIC_ASCII_VECTOR("kCosXIntervalTable")), | |
| 2672 Utils::OpenHandle(*cos_table), | |
| 2673 NONE).Assert(); | |
| 2674 Runtime::ForceSetObjectProperty( | |
| 2675 builtins, | |
| 2676 factory()->InternalizeOneByteString( | |
| 2677 STATIC_ASCII_VECTOR("kSamples")), | |
| 2678 factory()->NewHeapNumber( | |
| 2679 TrigonometricLookupTable::samples()), | |
| 2680 NONE).Assert(); | |
| 2681 Runtime::ForceSetObjectProperty( | |
| 2682 builtins, | |
| 2683 factory()->InternalizeOneByteString( | |
| 2684 STATIC_ASCII_VECTOR("kIndexConvert")), | |
| 2685 factory()->NewHeapNumber( | |
| 2686 TrigonometricLookupTable::samples_over_pi_half()), | |
| 2687 NONE).Assert(); | |
| 2688 } | 2662 } |
| 2689 | 2663 |
| 2690 result_ = native_context(); | 2664 result_ = native_context(); |
| 2691 } | 2665 } |
| 2692 | 2666 |
| 2693 | 2667 |
| 2694 // Support for thread preemption. | 2668 // Support for thread preemption. |
| 2695 | 2669 |
| 2696 // Reserve space for statics needing saving and restoring. | 2670 // Reserve space for statics needing saving and restoring. |
| 2697 int Bootstrapper::ArchiveSpacePerThread() { | 2671 int Bootstrapper::ArchiveSpacePerThread() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2713 return from + sizeof(NestingCounterType); | 2687 return from + sizeof(NestingCounterType); |
| 2714 } | 2688 } |
| 2715 | 2689 |
| 2716 | 2690 |
| 2717 // Called when the top-level V8 mutex is destroyed. | 2691 // Called when the top-level V8 mutex is destroyed. |
| 2718 void Bootstrapper::FreeThreadResources() { | 2692 void Bootstrapper::FreeThreadResources() { |
| 2719 ASSERT(!IsActive()); | 2693 ASSERT(!IsActive()); |
| 2720 } | 2694 } |
| 2721 | 2695 |
| 2722 } } // namespace v8::internal | 2696 } } // namespace v8::internal |
| OLD | NEW |