Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index bc52fa858feedd970e686368cae17f47eb445e0c..322df912f9942f3eddf91ab727c8b3f62c4e69fc 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -40,6 +40,7 @@ |
#include "objects-visiting.h" |
#include "platform.h" |
#include "snapshot.h" |
+#include "trig-table.h" |
#include "extensions/externalize-string-extension.h" |
#include "extensions/gc-extension.h" |
#include "extensions/statistics-extension.h" |
@@ -2635,6 +2636,44 @@ Genesis::Genesis(Isolate* isolate, |
InitializeExperimentalGlobal(); |
if (!InstallExperimentalNatives()) return; |
+ if (!Serializer::enabled()) { |
+ Handle<JSBuiltinsObject> builtins(native_context()->builtins()); |
+ // Initialize trigonometric lookup tables and constants. |
+ // The snapshot cannot contain typed arrays, and we don't need it to. |
+ const int table_num_bytes = TrigonometricLookupTable::table_num_bytes(); |
+ v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New( |
+ TrigonometricLookupTable::sin_table(), table_num_bytes); |
+ v8::Local<v8::ArrayBuffer> cos_buffer = v8::ArrayBuffer::New( |
+ TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes); |
+ v8::Local<v8::Float64Array> sin_table = v8::Float64Array::New( |
+ sin_buffer, 0, TrigonometricLookupTable::table_size()); |
+ v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New( |
+ cos_buffer, 0, TrigonometricLookupTable::table_size()); |
+ |
+ ForceSetProperty(builtins, |
+ factory()->InternalizeOneByteString( |
+ STATIC_ASCII_VECTOR("kSinTable")), |
+ Utils::OpenHandle(*sin_table), |
+ NONE); |
+ ForceSetProperty(builtins, |
+ factory()->InternalizeOneByteString( |
+ STATIC_ASCII_VECTOR("kCosXIntervalTable")), |
+ Utils::OpenHandle(*cos_table), |
+ NONE); |
+ ForceSetProperty(builtins, |
+ factory()->InternalizeOneByteString( |
+ STATIC_ASCII_VECTOR("kSamples")), |
+ factory()->NewHeapNumber( |
+ TrigonometricLookupTable::samples()), |
+ NONE); |
+ ForceSetProperty(builtins, |
+ factory()->InternalizeOneByteString( |
+ STATIC_ASCII_VECTOR("kIndexConvert")), |
+ factory()->NewHeapNumber( |
+ TrigonometricLookupTable::samples_over_pi_half()), |
+ NONE); |
+ } |
+ |
// Initially seed the per-context random number generator |
// using the per-isolate random number generator. |
uint32_t* state = reinterpret_cast<uint32_t*>( |