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

Side by Side Diff: src/bootstrapper.cc

Issue 1409143011: Revert of Initialize maths result array in JS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | src/js/prologue.js » ('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 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/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // The native context has a ScriptContextTable that store declarative bindings 190 // The native context has a ScriptContextTable that store declarative bindings
191 // made in script scopes. Add a "this" binding to that table pointing to the 191 // made in script scopes. Add a "this" binding to that table pointing to the
192 // global proxy. 192 // global proxy.
193 void InstallGlobalThisBinding(); 193 void InstallGlobalThisBinding();
194 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts); 194 void HookUpGlobalThisBinding(Handle<FixedArray> outdated_contexts);
195 // New context initialization. Used for creating a context from scratch. 195 // New context initialization. Used for creating a context from scratch.
196 void InitializeGlobal(Handle<GlobalObject> global_object, 196 void InitializeGlobal(Handle<GlobalObject> global_object,
197 Handle<JSFunction> empty_function, 197 Handle<JSFunction> empty_function,
198 ContextType context_type); 198 ContextType context_type);
199 void InitializeExperimentalGlobal(); 199 void InitializeExperimentalGlobal();
200 // Typed arrays are not serializable and have to initialized afterwards.
201 bool InitializeBuiltinTypedArrays();
200 // Depending on the situation, expose and/or get rid of the utils object. 202 // Depending on the situation, expose and/or get rid of the utils object.
201 void ConfigureUtilsObject(ContextType context_type); 203 void ConfigureUtilsObject(ContextType context_type);
202 204
203 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ 205 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \
204 void InitializeGlobal_##id(); 206 void InitializeGlobal_##id();
205 207
206 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) 208 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
207 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) 209 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
208 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) 210 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
209 #undef DECLARE_FEATURE_INITIALIZATION 211 #undef DECLARE_FEATURE_INITIALIZATION
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 *data = reinterpret_cast<Data*>( 1782 *data = reinterpret_cast<Data*>(
1781 isolate->array_buffer_allocator()->Allocate(byte_length)); 1783 isolate->array_buffer_allocator()->Allocate(byte_length));
1782 } 1784 }
1783 JSArrayBuffer::Setup(buffer, isolate, is_external, *data, byte_length, 1785 JSArrayBuffer::Setup(buffer, isolate, is_external, *data, byte_length,
1784 SharedFlag::kNotShared); 1786 SharedFlag::kNotShared);
1785 return isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements, 1787 return isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements,
1786 TENURED); 1788 TENURED);
1787 } 1789 }
1788 1790
1789 1791
1792 bool Genesis::InitializeBuiltinTypedArrays() {
1793 HandleScope scope(isolate());
1794 const size_t num_elements = 2;
1795 double* data = NULL;
1796 Handle<JSTypedArray> rempio2result =
1797 CreateTypedArray(isolate(), kExternalFloat64Array, num_elements, &data);
1798 for (size_t i = 0; i < num_elements; i++) data[i] = 0;
1799
1800 Handle<JSObject> utils =
1801 Handle<JSObject>::cast(isolate()->natives_utils_object());
1802 Handle<String> name_string = isolate()->factory()->NewStringFromAsciiChecked(
1803 "InitializeBuiltinTypedArrays");
1804 Handle<Object> fun = JSObject::GetDataProperty(utils, name_string);
1805 Handle<Object> receiver = isolate()->factory()->undefined_value();
1806 Handle<Object> args[] = {utils, rempio2result};
1807 return !Execution::Call(isolate(), fun, receiver, arraysize(args), args)
1808 .is_null();
1809 }
1810
1811
1790 void Genesis::ConfigureUtilsObject(ContextType context_type) { 1812 void Genesis::ConfigureUtilsObject(ContextType context_type) {
1791 switch (context_type) { 1813 switch (context_type) {
1792 // We still need the utils object to find debug functions. 1814 // We still need the utils object to find debug functions.
1793 case DEBUG_CONTEXT: 1815 case DEBUG_CONTEXT:
1794 return; 1816 return;
1795 // Expose the natives in global if a valid name for it is specified. 1817 // Expose the natives in global if a valid name for it is specified.
1796 case FULL_CONTEXT: { 1818 case FULL_CONTEXT: {
1797 // We still need the utils object after deserialization. 1819 // We still need the utils object after deserialization.
1798 if (isolate()->serializer_enabled()) return; 1820 if (isolate()->serializer_enabled()) return;
1799 if (FLAG_expose_natives_as == NULL) break; 1821 if (FLAG_expose_natives_as == NULL) break;
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
3224 if (!InstallExtraNatives()) return; 3246 if (!InstallExtraNatives()) return;
3225 if (!ConfigureGlobalObjects(global_proxy_template)) return; 3247 if (!ConfigureGlobalObjects(global_proxy_template)) return;
3226 } 3248 }
3227 isolate->counters()->contexts_created_from_scratch()->Increment(); 3249 isolate->counters()->contexts_created_from_scratch()->Increment();
3228 } 3250 }
3229 3251
3230 // Install experimental natives. Do not include them into the 3252 // Install experimental natives. Do not include them into the
3231 // snapshot as we should be able to turn them off at runtime. Re-installing 3253 // snapshot as we should be able to turn them off at runtime. Re-installing
3232 // them after they have already been deserialized would also fail. 3254 // them after they have already been deserialized would also fail.
3233 if (context_type == FULL_CONTEXT) { 3255 if (context_type == FULL_CONTEXT) {
3256 if (!InitializeBuiltinTypedArrays()) return;
3234 if (!isolate->serializer_enabled()) { 3257 if (!isolate->serializer_enabled()) {
3235 InitializeExperimentalGlobal(); 3258 InitializeExperimentalGlobal();
3236 if (!InstallExperimentalNatives()) return; 3259 if (!InstallExperimentalNatives()) return;
3237 3260
3238 if (FLAG_experimental_extras) { 3261 if (FLAG_experimental_extras) {
3239 if (!InstallExperimentalExtraNatives()) return; 3262 if (!InstallExperimentalExtraNatives()) return;
3240 } 3263 }
3241 } 3264 }
3242 // The serializer cannot serialize typed arrays. Reset those typed arrays 3265 // The serializer cannot serialize typed arrays. Reset those typed arrays
3243 // for each new context. 3266 // for each new context.
3244 } else if (context_type == DEBUG_CONTEXT) { 3267 } else if (context_type == DEBUG_CONTEXT) {
3245 DCHECK(!isolate->serializer_enabled()); 3268 DCHECK(!isolate->serializer_enabled());
3269 if (!InitializeBuiltinTypedArrays()) return;
3246 InitializeExperimentalGlobal(); 3270 InitializeExperimentalGlobal();
3247 if (!InstallDebuggerNatives()) return; 3271 if (!InstallDebuggerNatives()) return;
3248 } 3272 }
3249 3273
3250 ConfigureUtilsObject(context_type); 3274 ConfigureUtilsObject(context_type);
3251 3275
3252 // Check that the script context table is empty except for the 'this' binding. 3276 // Check that the script context table is empty except for the 'this' binding.
3253 // We do not need script contexts for native scripts. 3277 // We do not need script contexts for native scripts.
3254 if (!FLAG_global_var_shortcuts) { 3278 if (!FLAG_global_var_shortcuts) {
3255 DCHECK_EQ(1, native_context()->script_context_table()->used()); 3279 DCHECK_EQ(1, native_context()->script_context_table()->used());
(...skipping 26 matching lines...) Expand all
3282 } 3306 }
3283 3307
3284 3308
3285 // Called when the top-level V8 mutex is destroyed. 3309 // Called when the top-level V8 mutex is destroyed.
3286 void Bootstrapper::FreeThreadResources() { 3310 void Bootstrapper::FreeThreadResources() {
3287 DCHECK(!IsActive()); 3311 DCHECK(!IsActive());
3288 } 3312 }
3289 3313
3290 } // namespace internal 3314 } // namespace internal
3291 } // namespace v8 3315 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/js/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698