Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/bootstrapper.cc

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 22 matching lines...) Expand all
33 #include "compiler.h" 33 #include "compiler.h"
34 #include "debug.h" 34 #include "debug.h"
35 #include "execution.h" 35 #include "execution.h"
36 #include "global-handles.h" 36 #include "global-handles.h"
37 #include "isolate-inl.h" 37 #include "isolate-inl.h"
38 #include "macro-assembler.h" 38 #include "macro-assembler.h"
39 #include "natives.h" 39 #include "natives.h"
40 #include "objects-visiting.h" 40 #include "objects-visiting.h"
41 #include "platform.h" 41 #include "platform.h"
42 #include "snapshot.h" 42 #include "snapshot.h"
43 #include "trig-table.h"
43 #include "extensions/externalize-string-extension.h" 44 #include "extensions/externalize-string-extension.h"
44 #include "extensions/gc-extension.h" 45 #include "extensions/gc-extension.h"
45 #include "extensions/statistics-extension.h" 46 #include "extensions/statistics-extension.h"
46 #include "code-stubs.h" 47 #include "code-stubs.h"
47 48
48 namespace v8 { 49 namespace v8 {
49 namespace internal { 50 namespace internal {
50 51
51 52
52 NativesExternalStringResource::NativesExternalStringResource( 53 NativesExternalStringResource::NativesExternalStringResource(
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 native_context()->set_call_as_constructor_delegate(*delegate); 1302 native_context()->set_call_as_constructor_delegate(*delegate);
1302 delegate->shared()->DontAdaptArguments(); 1303 delegate->shared()->DontAdaptArguments();
1303 } 1304 }
1304 1305
1305 // Initialize the out of memory slot. 1306 // Initialize the out of memory slot.
1306 native_context()->set_out_of_memory(heap->false_value()); 1307 native_context()->set_out_of_memory(heap->false_value());
1307 1308
1308 // Initialize the embedder data slot. 1309 // Initialize the embedder data slot.
1309 Handle<FixedArray> embedder_data = factory->NewFixedArray(2); 1310 Handle<FixedArray> embedder_data = factory->NewFixedArray(2);
1310 native_context()->set_embedder_data(*embedder_data); 1311 native_context()->set_embedder_data(*embedder_data);
1311
1312 // Allocate the random seed slot.
1313 Handle<ByteArray> random_seed = factory->NewByteArray(kRandomStateSize);
1314 native_context()->set_random_seed(*random_seed);
1315 } 1312 }
1316 1313
1317 1314
1318 Handle<JSFunction> Genesis::InstallTypedArray( 1315 Handle<JSFunction> Genesis::InstallTypedArray(
1319 const char* name, ElementsKind elementsKind) { 1316 const char* name, ElementsKind elementsKind) {
1320 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1317 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1321 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, 1318 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
1322 JSTypedArray::kSize, isolate()->initial_object_prototype(), 1319 JSTypedArray::kSize, isolate()->initial_object_prototype(),
1323 Builtins::kIllegal, false, true); 1320 Builtins::kIllegal, false, true);
1324 1321
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 if (!FLAG_disable_native_files) { 2627 if (!FLAG_disable_native_files) {
2631 if (!ConfigureGlobalObjects(global_template)) return; 2628 if (!ConfigureGlobalObjects(global_template)) return;
2632 isolate->counters()->contexts_created_from_scratch()->Increment(); 2629 isolate->counters()->contexts_created_from_scratch()->Increment();
2633 } 2630 }
2634 } 2631 }
2635 2632
2636 // Initialize experimental globals and install experimental natives. 2633 // Initialize experimental globals and install experimental natives.
2637 InitializeExperimentalGlobal(); 2634 InitializeExperimentalGlobal();
2638 if (!InstallExperimentalNatives()) return; 2635 if (!InstallExperimentalNatives()) return;
2639 2636
2640 // Initially seed the per-context random number generator 2637 // We can't (de-)serialize typed arrays currently, but we are lucky: The state
2641 // using the per-isolate random number generator. 2638 // of the random number generator needs no initialization during snapshot
2642 uint32_t* state = reinterpret_cast<uint32_t*>( 2639 // creation time and we don't need trigonometric functions then.
2643 native_context()->random_seed()->GetDataStartAddress()); 2640 if (!Serializer::enabled()) {
2644 do { 2641 // Initially seed the per-context random number generator using the
2645 isolate->random_number_generator()->NextBytes(state, kRandomStateSize); 2642 // per-isolate random number generator.
2646 } while (state[0] == 0 || state[1] == 0); 2643 const int num_elems = 2;
2644 const int num_bytes = num_elems * sizeof(uint32_t);
2645 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes));
2646
2647 do {
2648 isolate->random_number_generator()->NextBytes(state, num_bytes);
2649 } while (state[0] == 0 || state[1] == 0);
2650
2651 v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(state, num_bytes);
2652 Utils::OpenHandle(*buffer)->set_should_be_freed(true);
2653 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems);
2654 Handle<JSBuiltinsObject> builtins(native_context()->builtins());
2655 ForceSetProperty(builtins,
2656 factory()->InternalizeOneByteString(
2657 STATIC_ASCII_VECTOR("rngstate")),
2658 Utils::OpenHandle(*ta),
2659 NONE);
2660
2661 // Initialize trigonometric lookup tables and constants.
2662 const int table_num_bytes = TrigonometricLookupTable::table_num_bytes();
2663 v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New(
2664 TrigonometricLookupTable::sin_table(), table_num_bytes);
2665 v8::Local<v8::ArrayBuffer> cos_buffer = v8::ArrayBuffer::New(
2666 TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes);
2667 v8::Local<v8::Float64Array> sin_table = v8::Float64Array::New(
2668 sin_buffer, 0, TrigonometricLookupTable::table_size());
2669 v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New(
2670 cos_buffer, 0, TrigonometricLookupTable::table_size());
2671
2672 ForceSetProperty(builtins,
2673 factory()->InternalizeOneByteString(
2674 STATIC_ASCII_VECTOR("kSinTable")),
2675 Utils::OpenHandle(*sin_table),
2676 NONE);
2677 ForceSetProperty(builtins,
2678 factory()->InternalizeOneByteString(
2679 STATIC_ASCII_VECTOR("kCosXIntervalTable")),
2680 Utils::OpenHandle(*cos_table),
2681 NONE);
2682 ForceSetProperty(builtins,
2683 factory()->InternalizeOneByteString(
2684 STATIC_ASCII_VECTOR("kSamples")),
2685 factory()->NewHeapNumber(
2686 TrigonometricLookupTable::samples()),
2687 NONE);
2688 ForceSetProperty(builtins,
2689 factory()->InternalizeOneByteString(
2690 STATIC_ASCII_VECTOR("kIndexConvert")),
2691 factory()->NewHeapNumber(
2692 TrigonometricLookupTable::samples_over_pi_half()),
2693 NONE);
2694 }
2647 2695
2648 result_ = native_context(); 2696 result_ = native_context();
2649 } 2697 }
2650 2698
2651 2699
2652 // Support for thread preemption. 2700 // Support for thread preemption.
2653 2701
2654 // Reserve space for statics needing saving and restoring. 2702 // Reserve space for statics needing saving and restoring.
2655 int Bootstrapper::ArchiveSpacePerThread() { 2703 int Bootstrapper::ArchiveSpacePerThread() {
2656 return sizeof(NestingCounterType); 2704 return sizeof(NestingCounterType);
(...skipping 14 matching lines...) Expand all
2671 return from + sizeof(NestingCounterType); 2719 return from + sizeof(NestingCounterType);
2672 } 2720 }
2673 2721
2674 2722
2675 // Called when the top-level V8 mutex is destroyed. 2723 // Called when the top-level V8 mutex is destroyed.
2676 void Bootstrapper::FreeThreadResources() { 2724 void Bootstrapper::FreeThreadResources() {
2677 ASSERT(!IsActive()); 2725 ASSERT(!IsActive());
2678 } 2726 }
2679 2727
2680 } } // namespace v8::internal 2728 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698