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

Side by Side Diff: src/bootstrapper.cc

Issue 861583002: Serializer: reset typed array cell type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 2806
2807 do { 2807 do {
2808 isolate->random_number_generator()->NextBytes(state, num_bytes); 2808 isolate->random_number_generator()->NextBytes(state, num_bytes);
2809 } while (state[0] == 0 || state[1] == 0); 2809 } while (state[0] == 0 || state[1] == 0);
2810 2810
2811 v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New( 2811 v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(
2812 reinterpret_cast<v8::Isolate*>(isolate), state, num_bytes); 2812 reinterpret_cast<v8::Isolate*>(isolate), state, num_bytes);
2813 Utils::OpenHandle(*buffer)->set_should_be_freed(true); 2813 Utils::OpenHandle(*buffer)->set_should_be_freed(true);
2814 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems); 2814 v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems);
2815 Handle<JSBuiltinsObject> builtins(native_context()->builtins()); 2815 Handle<JSBuiltinsObject> builtins(native_context()->builtins());
2816 Runtime::DefineObjectProperty(builtins, factory()->InternalizeOneByteString( 2816
2817 STATIC_CHAR_VECTOR("rngstate")), 2817 Handle<String> rngstate =
2818 Utils::OpenHandle(*ta), NONE).Assert(); 2818 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("rngstate"));
2819 // Reset property cell type before (re)initializing.
2820 JSBuiltinsObject::InvalidatePropertyCell(builtins, rngstate);
2821 JSObject::SetOwnPropertyIgnoreAttributes(
2822 builtins, rngstate, Utils::OpenHandle(*ta), DONT_DELETE).Assert();
2819 2823
2820 // Initialize trigonometric lookup tables and constants. 2824 // Initialize trigonometric lookup tables and constants.
2821 const int constants_size = arraysize(fdlibm::MathConstants::constants); 2825 const int constants_size = arraysize(fdlibm::MathConstants::constants);
2822 const int table_num_bytes = constants_size * kDoubleSize; 2826 const int table_num_bytes = constants_size * kDoubleSize;
2823 v8::Local<v8::ArrayBuffer> trig_buffer = v8::ArrayBuffer::New( 2827 v8::Local<v8::ArrayBuffer> trig_buffer = v8::ArrayBuffer::New(
2824 reinterpret_cast<v8::Isolate*>(isolate), 2828 reinterpret_cast<v8::Isolate*>(isolate),
2825 const_cast<double*>(fdlibm::MathConstants::constants), table_num_bytes); 2829 const_cast<double*>(fdlibm::MathConstants::constants), table_num_bytes);
2826 v8::Local<v8::Float64Array> trig_table = 2830 v8::Local<v8::Float64Array> trig_table =
2827 v8::Float64Array::New(trig_buffer, 0, constants_size); 2831 v8::Float64Array::New(trig_buffer, 0, constants_size);
2828 2832
2829 Runtime::DefineObjectProperty( 2833 Handle<String> kmath =
2830 builtins, 2834 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("kMath"));
2831 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("kMath")), 2835 // Reset property cell type before (re)initializing.
2832 Utils::OpenHandle(*trig_table), NONE).Assert(); 2836 JSBuiltinsObject::InvalidatePropertyCell(builtins, kmath);
2837 JSObject::SetOwnPropertyIgnoreAttributes(
2838 builtins, kmath, Utils::OpenHandle(*trig_table), DONT_DELETE).Assert();
2833 } 2839 }
2834 2840
2835 result_ = native_context(); 2841 result_ = native_context();
2836 } 2842 }
2837 2843
2838 2844
2839 // Support for thread preemption. 2845 // Support for thread preemption.
2840 2846
2841 // Reserve space for statics needing saving and restoring. 2847 // Reserve space for statics needing saving and restoring.
2842 int Bootstrapper::ArchiveSpacePerThread() { 2848 int Bootstrapper::ArchiveSpacePerThread() {
(...skipping 15 matching lines...) Expand all
2858 return from + sizeof(NestingCounterType); 2864 return from + sizeof(NestingCounterType);
2859 } 2865 }
2860 2866
2861 2867
2862 // Called when the top-level V8 mutex is destroyed. 2868 // Called when the top-level V8 mutex is destroyed.
2863 void Bootstrapper::FreeThreadResources() { 2869 void Bootstrapper::FreeThreadResources() {
2864 DCHECK(!IsActive()); 2870 DCHECK(!IsActive());
2865 } 2871 }
2866 2872
2867 } } // namespace v8::internal 2873 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698