| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
| 10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
| 11 #include "src/extensions/gc-extension.h" | 11 #include "src/extensions/gc-extension.h" |
| 12 #include "src/extensions/statistics-extension.h" | 12 #include "src/extensions/statistics-extension.h" |
| 13 #include "src/extensions/trigger-failure-extension.h" | 13 #include "src/extensions/trigger-failure-extension.h" |
| 14 #include "src/isolate-inl.h" | 14 #include "src/isolate-inl.h" |
| 15 #include "src/natives.h" | 15 #include "src/natives.h" |
| 16 #include "src/rempio2.h" |
| 16 #include "src/snapshot.h" | 17 #include "src/snapshot.h" |
| 17 #include "src/trig-table.h" | |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 NativesExternalStringResource::NativesExternalStringResource( | 22 NativesExternalStringResource::NativesExternalStringResource( |
| 23 Bootstrapper* bootstrapper, | 23 Bootstrapper* bootstrapper, |
| 24 const char* source, | 24 const char* source, |
| 25 size_t length) | 25 size_t length) |
| 26 : data_(source), length_(length) { | 26 : data_(source), length_(length) { |
| 27 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { | 27 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { |
| (...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 Utils::OpenHandle(*buffer)->set_should_be_freed(true); | 2620 Utils::OpenHandle(*buffer)->set_should_be_freed(true); |
| 2621 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); | 2621 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); |
| 2622 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); | 2622 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); |
| 2623 Runtime::DefineObjectProperty(builtins, | 2623 Runtime::DefineObjectProperty(builtins, |
| 2624 factory()->InternalizeOneByteString( | 2624 factory()->InternalizeOneByteString( |
| 2625 STATIC_ASCII_VECTOR("rngstate")), | 2625 STATIC_ASCII_VECTOR("rngstate")), |
| 2626 Utils::OpenHandle(*ta), | 2626 Utils::OpenHandle(*ta), |
| 2627 NONE).Assert(); | 2627 NONE).Assert(); |
| 2628 | 2628 |
| 2629 // Initialize trigonometric lookup tables and constants. | 2629 // Initialize trigonometric lookup tables and constants. |
| 2630 const int table_num_bytes = TrigonometricLookupTable::table_num_bytes(); | 2630 const int constants_size = ARRAY_SIZE(TrigonometricConstants::constants); |
| 2631 v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New( | 2631 const int table_num_bytes = constants_size * kDoubleSize; |
| 2632 v8::Local<v8::ArrayBuffer> trig_buffer = v8::ArrayBuffer::New( |
| 2632 reinterpret_cast<v8::Isolate*>(isolate), | 2633 reinterpret_cast<v8::Isolate*>(isolate), |
| 2633 TrigonometricLookupTable::sin_table(), table_num_bytes); | 2634 const_cast<double*>(TrigonometricConstants::constants), |
| 2634 v8::Local<v8::ArrayBuffer> cos_buffer = v8::ArrayBuffer::New( | 2635 table_num_bytes); |
| 2635 reinterpret_cast<v8::Isolate*>(isolate), | 2636 v8::Local<v8::Float64Array> trig_table = |
| 2636 TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes); | 2637 v8::Float64Array::New(trig_buffer, 0, constants_size); |
| 2637 v8::Local<v8::Float64Array> sin_table = v8::Float64Array::New( | |
| 2638 sin_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2639 v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New( | |
| 2640 cos_buffer, 0, TrigonometricLookupTable::table_size()); | |
| 2641 | 2638 |
| 2642 Runtime::DefineObjectProperty(builtins, | |
| 2643 factory()->InternalizeOneByteString( | |
| 2644 STATIC_ASCII_VECTOR("kSinTable")), | |
| 2645 Utils::OpenHandle(*sin_table), | |
| 2646 NONE).Assert(); | |
| 2647 Runtime::DefineObjectProperty( | 2639 Runtime::DefineObjectProperty( |
| 2648 builtins, | 2640 builtins, |
| 2649 factory()->InternalizeOneByteString( | 2641 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("kTrig")), |
| 2650 STATIC_ASCII_VECTOR("kCosXIntervalTable")), | 2642 Utils::OpenHandle(*trig_table), NONE).Assert(); |
| 2651 Utils::OpenHandle(*cos_table), | |
| 2652 NONE).Assert(); | |
| 2653 Runtime::DefineObjectProperty( | |
| 2654 builtins, | |
| 2655 factory()->InternalizeOneByteString( | |
| 2656 STATIC_ASCII_VECTOR("kSamples")), | |
| 2657 factory()->NewHeapNumber( | |
| 2658 TrigonometricLookupTable::samples()), | |
| 2659 NONE).Assert(); | |
| 2660 Runtime::DefineObjectProperty( | |
| 2661 builtins, | |
| 2662 factory()->InternalizeOneByteString( | |
| 2663 STATIC_ASCII_VECTOR("kIndexConvert")), | |
| 2664 factory()->NewHeapNumber( | |
| 2665 TrigonometricLookupTable::samples_over_pi_half()), | |
| 2666 NONE).Assert(); | |
| 2667 } | 2643 } |
| 2668 | 2644 |
| 2669 result_ = native_context(); | 2645 result_ = native_context(); |
| 2670 } | 2646 } |
| 2671 | 2647 |
| 2672 | 2648 |
| 2673 // Support for thread preemption. | 2649 // Support for thread preemption. |
| 2674 | 2650 |
| 2675 // Reserve space for statics needing saving and restoring. | 2651 // Reserve space for statics needing saving and restoring. |
| 2676 int Bootstrapper::ArchiveSpacePerThread() { | 2652 int Bootstrapper::ArchiveSpacePerThread() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2692 return from + sizeof(NestingCounterType); | 2668 return from + sizeof(NestingCounterType); |
| 2693 } | 2669 } |
| 2694 | 2670 |
| 2695 | 2671 |
| 2696 // Called when the top-level V8 mutex is destroyed. | 2672 // Called when the top-level V8 mutex is destroyed. |
| 2697 void Bootstrapper::FreeThreadResources() { | 2673 void Bootstrapper::FreeThreadResources() { |
| 2698 ASSERT(!IsActive()); | 2674 ASSERT(!IsActive()); |
| 2699 } | 2675 } |
| 2700 | 2676 |
| 2701 } } // namespace v8::internal | 2677 } } // namespace v8::internal |
| OLD | NEW |